From: "Gábor Melis" <mega@retes.hu>
To: git@vger.kernel.org
Subject: git emacs mode patch
Date: Thu, 15 Mar 2007 14:03:56 +0100 [thread overview]
Message-ID: <200703151403.56552.mega@retes.hu> (raw)
[-- Attachment #1: Type: text/plain, Size: 186 bytes --]
The attached patch makes it possible to toggle show/hide of files with
up-to-date and unknown statuses with M-d and M-u.
Cheers,
Gábor Melis
Please CC me, I'm not on the list.
[-- Attachment #2: git-el.patch --]
[-- Type: text/x-diff, Size: 3635 bytes --]
diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
index db87a37..2f993de 100644
--- a/contrib/emacs/git.el
+++ b/contrib/emacs/git.el
@@ -97,6 +97,16 @@ if there is already one that displays the same directory."
:group 'git
:type 'string)
+(defcustom git-hide-up-to-date t
+ "Hide files with up-to-date status by default."
+ :group 'git
+ :type 'boolean)
+
+(defcustom git-hide-unknown t
+ "Hide files with unknown status by default."
+ :group 'git
+ :type 'boolean)
+
(defface git-status-face
'((((class color) (background light)) (:foreground "purple")))
@@ -428,6 +438,7 @@ and returns the process output as a string."
(?A 'added)
(?D 'deleted)
(?U 'unmerged)
+ (?H 'uptodate)
(t nil)))
(defun git-status-code-as-string (code)
@@ -1017,15 +1028,18 @@ and returns the process output as a string."
(with-temp-buffer
(git-run-command t nil "diff-index" "-z" "-M" "HEAD")
(git-parse-status status)))
+ (unless (member 'up-to-date hidden-statuses)
(with-temp-buffer
- (git-run-command t nil "ls-files" "-z" "-u")
- (git-parse-ls-unmerged status))
+ (git-run-command t nil "ls-files" "-z" "-t")
+ (git-parse-ls-files status 'unknown)))
+ (unless (member 'unknown hidden-statuses)
(when (file-readable-p ".git/info/exclude")
(with-temp-buffer
(git-run-command t nil "ls-files" "-z" "-t" "-o"
"--exclude-from=.git/info/exclude"
- (concat "--exclude-per-directory=" git-per-dir-ignore-file))
- (git-parse-ls-files status 'unknown)))
+ (concat "--exclude-per-directory="
+ git-per-dir-ignore-file))
+ (git-parse-ls-files status 'unknown))))
(git-refresh-files)
(git-refresh-ewoc-hf status)
; move point to the current file name if any
@@ -1080,6 +1094,8 @@ and returns the process output as a string."
(define-key map "U" 'git-revert-file)
(define-key map "v" 'git-view-file)
(define-key map "x" 'git-remove-handled)
+ (define-key map "\M-d" 'git-toggle-up-to-date)
+ (define-key map "\M-u" 'git-toggle-unknown)
(define-key map "\C-?" 'git-unmark-file-up)
(define-key map "\M-\C-?" 'git-unmark-all)
; the diff submap
@@ -1093,6 +1109,20 @@ and returns the process output as a string."
(define-key diff-map "o" 'git-diff-file-other)
(setq git-status-mode-map map)))
+(defun git-toggle-up-to-date ()
+ (interactive)
+ (if (member 'up-to-date hidden-statuses)
+ (setq hidden-statuses (remove 'up-to-date hidden-statuses))
+ (push 'up-to-date hidden-statuses))
+ (git-refresh-status))
+
+(defun git-toggle-unknown ()
+ (interactive)
+ (if (member 'unknown hidden-statuses)
+ (setq hidden-statuses (remove 'unknown hidden-statuses))
+ (push 'unknown hidden-statuses))
+ (git-refresh-status))
+
;; git mode should only run in the *git status* buffer
(put 'git-status-mode 'mode-class 'special)
@@ -1112,6 +1142,11 @@ Commands:
(let ((status (ewoc-create 'git-fileinfo-prettyprint "" "")))
(set (make-local-variable 'git-status) status))
(set (make-local-variable 'list-buffers-directory) default-directory)
+ (set (make-local-variable 'hidden-statuses) ())
+ (when git-hide-up-to-date
+ (push 'up-to-date hidden-statuses))
+ (when git-hide-unknown
+ (push 'unknown hidden-statuses))
(run-hooks 'git-status-mode-hook)))
(defun git-find-status-buffer (dir)
next reply other threads:[~2007-03-15 14:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-15 13:03 Gábor Melis [this message]
2007-03-17 10:04 ` git emacs mode patch Alexandre Julliard
2007-03-25 17:03 ` Gábor Melis
2007-03-26 10:02 ` Alexandre Julliard
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=200703151403.56552.mega@retes.hu \
--to=mega@retes.hu \
--cc=git@vger.kernel.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).