all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Protesilaos Stavrou <info@protesilaos.com>
To: 46459@debbugs.gnu.org
Subject: bug#46459: 28.0.50; Shared keymap for Git VC dir "Branch" header?
Date: Fri, 12 Feb 2021 08:54:13 +0200	[thread overview]
Message-ID: <87a6s94vze.fsf@protesilaos.com> (raw)

[-- 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


             reply	other threads:[~2021-02-12  6:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-12  6:54 Protesilaos Stavrou [this message]
2021-02-12  9:55 ` bug#46459: 28.0.50; Shared keymap for Git VC dir "Branch" header? 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

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=87a6s94vze.fsf@protesilaos.com \
    --to=info@protesilaos.com \
    --cc=46459@debbugs.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.