all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#46459: 28.0.50; Shared keymap for Git VC dir "Branch" header?
@ 2021-02-12  6:54 Protesilaos Stavrou
  2021-02-12  9:55 ` Robert Pluim
  2021-02-13  0:50 ` Dmitry Gutov
  0 siblings, 2 replies; 9+ messages in thread
From: Protesilaos Stavrou @ 2021-02-12  6:54 UTC (permalink / raw)
  To: 46459

[-- Attachment #1: Type: text/plain, Size: 637 bytes --]

Dear maintainers,

In vc-git.el the header for vc-dir stashes is propertized with its own
keymap.  This means that while point is over the value of the "Stash:"
header, the specified keymap comes into effect, instead of the main one
for vc-dir.  The latter takes effect when point is anywhere but that
header's value.

Should this principle be applied to the value of the "Branch" header as
well?  The attached patch is a proof-of-concept to that end.

If you believe this is worth doing, what else do you think should go
into such a patch from a usability standpoint?

All the best,
Protesilaos

-- 
Protesilaos Stavrou
protesilaos.com

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-shared-keymap-to-Git-VC-dir-Branch-header.patch --]
[-- Type: text/x-patch, Size: 1478 bytes --]

From 8945cf63f2fc16881b95ed5be209885b73b9449f Mon Sep 17 00:00:00 2001
Message-Id: <8945cf63f2fc16881b95ed5be209885b73b9449f.1613112064.git.info@protesilaos.com>
From: Protesilaos Stavrou <info@protesilaos.com>
Date: Fri, 12 Feb 2021 08:40:33 +0200
Subject: [PATCH] Add shared keymap to Git VC dir "Branch" header

* lisp/vc/vc-git.el (vc-git-branch-shared-map): Define new keymap.
(vc-git-dir-extra-headers): Propertize header with new keymap.
---
 lisp/vc/vc-git.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 25ae26d746..030af2a379 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -656,6 +656,13 @@ vc-git-dir-status-files
                                  :files files
                                  :update-function update-function)))
 
+(defvar vc-git-branch-shared-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "c" 'vc-create-tag)
+    (define-key map "l" 'vc-print-branch-log)
+    (define-key map "t" 'vc-retrieve-tag)
+    map))
+
 (defvar vc-git-stash-shared-map
   (let ((map (make-sparse-keymap)))
     (define-key map "S" 'vc-git-stash-snapshot)
@@ -814,7 +821,8 @@ vc-git-dir-extra-headers
     (concat
      (propertize "Branch     : " 'face 'vc-dir-header)
      (propertize branch
-		 'face 'vc-dir-header-value)
+		 'face 'vc-dir-header-value
+                 'keymap vc-git-branch-shared-map)
      (when remote-url
        (concat
 	"\n"
-- 
2.30.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2022-06-17 12:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-12  6:54 bug#46459: 28.0.50; Shared keymap for Git VC dir "Branch" header? Protesilaos Stavrou
2021-02-12  9:55 ` Robert Pluim
2021-02-13  0:51   ` Dmitry Gutov
2021-02-13 18:20   ` Juri Linkov
2021-02-13 20:05     ` Dmitry Gutov
2021-02-14 13:56       ` Robert Pluim
2021-02-13  0:50 ` Dmitry Gutov
2021-02-14  3:54   ` Protesilaos Stavrou
2022-06-17 12:53     ` Lars Ingebrigtsen

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.