From: Robert Pluim <rpluim@gmail.com>
To: emacs-devel@gnu.org
Subject: [PATCH] Allow hiding stashes from vc-dir
Date: Tue, 15 Oct 2019 14:48:28 +0200 [thread overview]
Message-ID: <m2wod62mzn.fsf@gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 237 bytes --]
For various reasons I tend to have a lot of stashes hanging around,
which magit can autohide for you. vc-dir doesnʼt have such an option,
and has no commands for doing things with stashes anyway, so I came up
with the following.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-vc-git-allow-not-showing-git-stash-list-in-vc-dir.patch --]
[-- Type: text/x-patch, Size: 4416 bytes --]
From b02f05fc569f3946366ac2ede27349cd09618265 Mon Sep 17 00:00:00 2001
From: Robert Pluim <rpluim@gmail.com>
Date: Tue, 5 Feb 2019 10:51:42 +0100
Subject: [PATCH] vc-git: allow not showing git stash list in vc-dir
To: emacs-devel@gnu.org
* lisp/vc/vc-git.el (vc-git-show-stash): New variable.
(vc-git-dir-extra-headers): Only show stash list when
vc-git-show-stash is t.
---
etc/NEWS | 3 +++
lisp/vc/vc-git.el | 49 ++++++++++++++++++++++++++---------------------
2 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 271cc6e044..8c3993474c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -733,6 +733,9 @@ The default value is 'find-dired-sort-by-filename'.
*** New command 'log-edit-generate-changelog-from-diff', bound to C-c C-w.
This generates ChangeLog entries from the VC fileset diff.
+*** New customizable variable 'vc-git-show-stash'.
+Default t, set it to nil to hide stashes in 'vc-dir' when using git.
+
*** Recording ChangeLog entries doesn't require an actual file.
If a ChangeLog file doesn't exist, and if the new variable
'add-log-dont-create-changelog-file' is non-nil (which is the
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 9715aea1fd..615474cd76 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -192,6 +192,11 @@ vc-git-grep-template
:type 'string
:version "27.1")
+(defcustom vc-git-show-stash t
+ "Whether to show the git stash list."
+ :type 'boolean
+ :version "27.1")
+
;; History of Git commands.
(defvar vc-git-history nil)
@@ -655,7 +660,7 @@ vc-git-dir-extra-headers
(let ((str (with-output-to-string
(with-current-buffer standard-output
(vc-git--out-ok "symbolic-ref" "HEAD"))))
- (stash (vc-git-stash-list))
+ (stash (when vc-git-show-stash (vc-git-stash-list)))
(stash-help-echo "Use M-x vc-git-stash to create stashes.")
branch remote remote-url)
(if (string-match "^\\(refs/heads/\\)?\\(.+\\)$" str)
@@ -688,30 +693,30 @@ vc-git-dir-extra-headers
(propertize "Remote : " 'face 'font-lock-type-face)
(propertize remote-url
'face 'font-lock-variable-name-face)))
- "\n"
;; For now just a heading, key bindings can be added later for various bisect actions
(when (file-exists-p (expand-file-name ".git/BISECT_START" (vc-git-root dir)))
- (propertize "Bisect : in progress\n" 'face 'font-lock-warning-face))
+ (propertize "\nBisect : in progress" 'face 'font-lock-warning-face))
(when (file-exists-p (expand-file-name ".git/rebase-apply" (vc-git-root dir)))
- (propertize "Rebase : in progress\n" 'face 'font-lock-warning-face))
- (if stash
- (concat
- (propertize "Stash :\n" 'face 'font-lock-type-face
- 'help-echo stash-help-echo)
- (mapconcat
- (lambda (x)
- (propertize x
- 'face 'font-lock-variable-name-face
- 'mouse-face 'highlight
- 'help-echo "mouse-3: Show stash menu\nRET: Show stash\nA: Apply stash\nP: Apply and remove stash (pop)\nC-k: Delete stash"
- 'keymap vc-git-stash-map))
- stash "\n"))
- (concat
- (propertize "Stash : " 'face 'font-lock-type-face
- 'help-echo stash-help-echo)
- (propertize "Nothing stashed"
- 'help-echo stash-help-echo
- 'face 'font-lock-variable-name-face))))))
+ (propertize "\nRebase : in progress" 'face 'font-lock-warning-face))
+ (when vc-git-show-stash
+ (if stash
+ (concat
+ (propertize "\nStash :\n" 'face 'font-lock-type-face
+ 'help-echo stash-help-echo)
+ (mapconcat
+ (lambda (x)
+ (propertize x
+ 'face 'font-lock-variable-name-face
+ 'mouse-face 'highlight
+ 'help-echo "mouse-3: Show stash menu\nRET: Show stash\nA: Apply stash\nP: Apply and remove stash (pop)\nC-k: Delete stash"
+ 'keymap vc-git-stash-map))
+ stash "\n"))
+ (concat
+ (propertize "\nStash : " 'face 'font-lock-type-face
+ 'help-echo stash-help-echo)
+ (propertize "Nothing stashed"
+ 'help-echo stash-help-echo
+ 'face 'font-lock-variable-name-face)))))))
(defun vc-git-branches ()
"Return the existing branches, as a list of strings.
--
2.23.0
next reply other threads:[~2019-10-15 12:48 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-15 12:48 Robert Pluim [this message]
2019-10-15 12:54 ` [PATCH] Allow hiding stashes from vc-dir Lars Ingebrigtsen
2019-10-15 13:06 ` Eli Zaretskii
2019-10-15 14:02 ` Robert Pluim
2019-10-15 16:19 ` Eli Zaretskii
2019-10-15 18:09 ` Juri Linkov
2019-10-16 1:28 ` Lars Ingebrigtsen
2019-10-16 8:57 ` Robert Pluim
2019-10-17 16:26 ` Robert Pluim
2019-10-18 3:14 ` Lars Ingebrigtsen
2019-10-18 8:39 ` Robert Pluim
2019-10-18 9:01 ` Eli Zaretskii
2019-10-18 9:25 ` Robert Pluim
2019-10-18 9:31 ` Eli Zaretskii
2019-10-18 10:18 ` Robert Pluim
2019-10-18 12:22 ` Eli Zaretskii
2019-10-18 13:43 ` Robert Pluim
2019-10-19 3:19 ` Stefan Monnier
2019-10-21 9:38 ` Robert Pluim
2019-10-19 8:18 ` Andreas Schwab
2019-10-18 13:22 ` Stefan Monnier
2019-10-18 14:07 ` Robert Pluim
2019-10-19 3:16 ` Stefan Monnier
2019-10-19 8:15 ` Lars Ingebrigtsen
2019-10-21 9:38 ` Robert Pluim
2019-10-15 14:40 ` Michael Albinus
2019-10-15 16:25 ` Eli Zaretskii
2019-10-16 10:18 ` Michael Albinus
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=m2wod62mzn.fsf@gmail.com \
--to=rpluim@gmail.com \
--cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.