From: David Christensen <david@endpoint.com>
To: git@vger.kernel.org
Cc: julliard@winehq.org, gister@pobox.com,
David Christensen <david@endpoint.com>
Subject: [PATCH] Teach git.el to mark/unmark files by regexp
Date: Thu, 11 Sep 2008 23:22:04 -0500 [thread overview]
Message-ID: <1221193324-59334-2-git-send-email-david@endpoint.com> (raw)
In-Reply-To: <1221193324-59334-1-git-send-email-david@endpoint.com>
Adds the functions git-mark-regexp and git-unmark-regexp to git.el.
Creates a mark-map keymap to support dired-like behavior for
marking/unmarking via regexp. Also adds these functions to the
menubar.
Signed-off-by: David Christensen <david@endpoint.com>
---
contrib/emacs/git.el | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index 580652c..a982fbe 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -950,14 +950,18 @@ Return the list of files that haven't been handled."
(when goal-column (move-to-column goal-column)))
(defun git-mark-regexp (re)
- "Mark all files which match a provided regexp."
- (interactive "sMark files matching regular expression: ")
+ "Mark all files which match a provided regexp. With prefix argument, unmark files which match."
+ (interactive
+ (list
+ (read-from-minibuffer (if current-prefix-arg "Unmark files matching regular expression: " "Mark files matching regular expression: "))))
(unless git-status (error "Not in git-status buffer."))
- (ewoc-map (lambda (info) (unless (git-fileinfo->marked info)
- (when (string-match re (git-fileinfo->name info))
- (setf (git-fileinfo->marked info) t)))) git-status)
- ; move back to goal column after invalidate
- (when goal-column (move-to-column goal-column)))
+ (if current-prefix-arg
+ (git-unmark-regexp re)
+ (ewoc-map (lambda (info) (unless (git-fileinfo->marked info)
+ (when (string-match re (git-fileinfo->name info))
+ (setf (git-fileinfo->marked info) t)))) git-status)
+ ; move back to goal column after invalidate
+ (when goal-column (move-to-column goal-column))))
(defun git-unmark-regexp (re)
"Unmark all files which match a provided regexp."
@@ -1504,7 +1508,12 @@ amended version of it."
(define-key toggle-map "m" 'git-toggle-all-marks)
; the mark submap
(define-key mark-map "%" 'git-mark-regexp)
- (define-key mark-map "\C-?" 'git-unmark-regexp)
+ (define-key mark-map "m" 'git-mark-file)
+ (define-key mark-map "u" 'git-unmark-file)
+ (define-key mark-map "t" 'git-toggle-all-marks)
+ (define-key mark-map "!" 'git-unmark-all)
+ (define-key mark-map "?" 'git-unmark-all)
+ (define-key mark-map "\C-?" 'git-unmark-file-up)
(setq git-status-mode-map map))
(easy-menu-define git-menu git-status-mode-map
"Git Menu"
--
1.6.0.1.90.g27a6e.dirty
prev parent reply other threads:[~2008-09-12 4:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-27 3:24 [PATCH] Teach git.el to mark/unmark files by regexp David Christensen
2008-08-30 18:41 ` Alexandre Julliard
2008-08-30 19:02 ` David Christensen
2008-09-12 4:22 ` [PATCH v2] " David Christensen
2008-09-12 4:22 ` David Christensen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1221193324-59334-2-git-send-email-david@endpoint.com \
--to=david@endpoint.com \
--cc=gister@pobox.com \
--cc=git@vger.kernel.org \
--cc=julliard@winehq.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).