[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 0dca455: Make the Git stash commands available in vc-dir Git buff
From: |
Lars Ingebrigtsen |
Subject: |
master 0dca455: Make the Git stash commands available in vc-dir Git buffers |
Date: |
Mon, 6 Dec 2021 00:41:35 -0500 (EST) |
branch: master
commit 0dca455d1446eb7743594b3202b55e57615915c9
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Make the Git stash commands available in vc-dir Git buffers
* lisp/vc/vc-dir.el (vc-dir): Call the backend-specific minor mode
if it exists.
* lisp/vc/vc-git.el (vc-dir-git-mode-map): New map.
(vc-dir-git-mode): New minor mode.
---
lisp/vc/vc-dir.el | 7 ++++++-
lisp/vc/vc-git.el | 10 ++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index 8165d5e..32e4921 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -1427,7 +1427,12 @@ These are the commands available for use in the file
status buffer:
(vc-dir-refresh)
;; FIXME: find a better way to pass the backend to `vc-dir-mode'.
(let ((use-vc-backend backend))
- (vc-dir-mode))))
+ (vc-dir-mode)
+ ;; Activate the backend-specific minor mode, if any.
+ (when-let ((minor-mode
+ (intern-soft (format "vc-dir-%s-mode"
+ (downcase (symbol-name backend))))))
+ (funcall minor-mode 1)))))
(defun vc-default-dir-extra-headers (_backend _dir)
;; Be loud by default to remind people to add code to display
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 0828264..3ceed36 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1872,6 +1872,16 @@ Returns nil if not possible."
(1- (point-max)))))))
(and name (not (string= name "undefined")) name))))
+(defvar-keymap vc-dir-git-mode-map
+ "z c" #'vc-git-stash
+ "z s" #'vc-git-stash-snapshot)
+
+(define-minor-mode vc-dir-git-mode
+ "A minor mode for git-specific commands in `vc-dir-mode' buffers.
+Also note that there are git stash commands available in the
+\"Stash\" section at the head of the buffer."
+ :lighter " Git")
+
(provide 'vc-git)
;;; vc-git.el ends here
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 0dca455: Make the Git stash commands available in vc-dir Git buffers,
Lars Ingebrigtsen <=