emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/transient 990eb0a292 201/366: Don't bind "M-<key>" to a


From: Jonas Bernoulli
Subject: [elpa] externals/transient 990eb0a292 201/366: Don't bind "M-<key>" to any common commands
Date: Tue, 25 Jan 2022 18:54:41 -0500 (EST)

branch: externals/transient
commit 990eb0a292d622b80b52460d445aa58232ef2645
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    Don't bind "M-<key>" to any common commands
    
    Most transients don't use any bindings that involve any modifiers
    (except shift) for their own individual suffixes.  By following this
    convention they avoid conflicts with common commands that are shared
    between all transients.
    
    Many common commands use the "C-x" prefix or another binding that
    involves the "control" modifier, but a handful of bindings use the
    "meta" modifier instead.
    
    Some transients do not use alphabetic bindings.  Consider this
    (simplified) example:
    
      (global-set-key (kbd "M-g") #'hydrant-goto)
      (transient-define-prefix hydrant-goto ()
        "Transient command replacing and extending `goto-map'."
        :transient-suffix     'transient--do-call
        :transient-non-suffix 'transient--do-stay
        [["Goto locus"
          ("M-u" "first"     first-error)
          ("M-p" "previous"  previous-error)
          ("M-n" "next"      next-error)]
         ["Goto"
          ("M-g" "line"      goto-line      :transient nil)
          ("M-p" "position"  goto-char      :transient nil)
          ("M-c" "column"    move-to-column :transient nil)]])
    
    By using "meta" for all suffix bindings while not preventing outside
    bindings from being invoked, this transient makes it possible to move
    through the locations using "M-p" and "M-n" and to make small edits
    (potentially involving the letters "p" and "n") on the way, without
    having to exit the transient.
    
    Unfortunately "M-p" and "M-n" conflicted with the old bindings for the
    common transient history commands.  Other bindings could have been
    used, but they might have other downsides ("C-p" and "C-n" for example
    would shadow very commands that are needed while making those edits).
    
    Most importantly though this makes it clear that there has be one
    standard modifier that individual transients should be able to use
    without having to worry about (current and future) conflicts with
    common transient commands.
    
    Going forward we reserve "meta" for that purpose (i.e. "M-<key>";
    "C-M-<key>" is still allowed for shared commands).  This means that
    the bindings for three common commands have to be replaced with
    slightly less convenient and consistent bindings.  That cannot be
    prevented without access to a time machine.
---
 docs/transient.org  | 10 ++++++----
 docs/transient.texi | 18 ++++++++++++------
 lisp/transient.el   | 11 ++++++-----
 3 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/docs/transient.org b/docs/transient.org
index 0cc4c95e43..404b97b645 100644
--- a/docs/transient.org
+++ b/docs/transient.org
@@ -8,7 +8,7 @@
 #+TEXINFO_DIR_CATEGORY: Emacs
 #+TEXINFO_DIR_TITLE: Transient: (transient).
 #+TEXINFO_DIR_DESC: Transient Commands
-#+SUBTITLE: for version 0.2.0 (v0.2.0-48-g8423bc69+1)
+#+SUBTITLE: for version 0.2.0 (v0.2.0-49-ga3517747+1)
 
 #+TEXINFO_DEFFN: t
 #+OPTIONS: H:4 num:4 toc:2
@@ -37,7 +37,7 @@ Calling a suffix command usually causes the transient to be 
exited
 but suffix commands can also be configured to not exit the transient.
 
 #+TEXINFO: @noindent
-This manual is for Transient version 0.2.0 (v0.2.0-48-g8423bc69+1).
+This manual is for Transient version 0.2.0 (v0.2.0-49-ga3517747+1).
 
 #+BEGIN_QUOTE
 Copyright (C) 2018-2020 Jonas Bernoulli <jonas@bernoul.li>
@@ -326,12 +326,14 @@ value is saved to its history.  These values can be 
cycled through the
 same way one can cycle through the history of commands that read
 user-input in the minibuffer.
 
-- Key: M-p, transient-history-prev
+- Key: C-M-p, transient-history-prev
+- Key: C-x p, transient-history-prev
 
   This command switches to the previous value used for the active
   transient.
 
-- Key: M-n, transient-history-next
+- Key: C-M-n, transient-history-next
+- Key: C-x n, transient-history-next
 
   This command switches to the next value used for the active
   transient.
diff --git a/docs/transient.texi b/docs/transient.texi
index 66a347da88..46dd21734b 100644
--- a/docs/transient.texi
+++ b/docs/transient.texi
@@ -31,7 +31,7 @@ General Public License for more details.
 @finalout
 @titlepage
 @title Transient User and Developer Manual
-@subtitle for version 0.2.0 (v0.2.0-48-g8423bc69+1)
+@subtitle for version 0.2.0 (v0.2.0-49-ga3517747+1)
 @author Jonas Bernoulli
 @page
 @vskip 0pt plus 1filll
@@ -65,7 +65,7 @@ Calling a suffix command usually causes the transient to be 
exited
 but suffix commands can also be configured to not exit the transient.
 
 @noindent
-This manual is for Transient version 0.2.0 (v0.2.0-48-g8423bc69+1).
+This manual is for Transient version 0.2.0 (v0.2.0-49-ga3517747+1).
 
 @quotation
 Copyright (C) 2018-2020 Jonas Bernoulli <jonas@@bernoul.li>
@@ -471,16 +471,22 @@ same way one can cycle through the history of commands 
that read
 user-input in the minibuffer.
 
 @table @asis
-@kindex M-p
+@kindex C-M-p
 @cindex transient-history-prev
-@item @kbd{M-p} @tie{}@tie{}@tie{}@tie{}(@code{transient-history-prev})
+@item @kbd{C-M-p} @tie{}@tie{}@tie{}@tie{}(@code{transient-history-prev})
+@kindex C-x p
+@cindex transient-history-prev
+@item @kbd{C-x p} @tie{}@tie{}@tie{}@tie{}(@code{transient-history-prev})
 
 This command switches to the previous value used for the active
 transient.
 
-@kindex M-n
+@kindex C-M-n
+@cindex transient-history-next
+@item @kbd{C-M-n} @tie{}@tie{}@tie{}@tie{}(@code{transient-history-next})
+@kindex C-x n
 @cindex transient-history-next
-@item @kbd{M-n} @tie{}@tie{}@tie{}@tie{}(@code{transient-history-next})
+@item @kbd{C-x n} @tie{}@tie{}@tie{}@tie{}(@code{transient-history-next})
 
 This command switches to the next value used for the active
 transient.
diff --git a/lisp/transient.el b/lisp/transient.el
index ff3c3ec978..52ebba6663 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1358,7 +1358,7 @@ then just return it.  Otherwise return the symbol whose
     (define-key map (kbd "C-q") 'transient-quit-all)
     (define-key map (kbd "C-z") 'transient-suspend)
     (define-key map (kbd "C-v") 'transient-scroll-up)
-    (define-key map (kbd "M-v") 'transient-scroll-down)
+    (define-key map (kbd "C-M-v") 'transient-scroll-down)
     (define-key map [next]      'transient-scroll-up)
     (define-key map [prior]     'transient-scroll-down)
     map)
@@ -1382,8 +1382,9 @@ edited using the same functions as used for transients.")
     (define-key map (kbd "C-t") 'transient-show)
     (define-key map (kbd "?")   'transient-help)
     (define-key map (kbd "C-h") 'transient-help)
-    (define-key map (kbd "M-p") 'transient-history-prev)
-    (define-key map (kbd "M-n") 'transient-history-next)
+    ;; Also bound to "C-x p" and "C-x n" in transient-common-commands.
+    (define-key map (kbd "C-M-p") 'transient-history-prev)
+    (define-key map (kbd "C-M-n") 'transient-history-next)
     map)
   "Top-level keymap used by all transients.")
 
@@ -1416,8 +1417,8 @@ edited using the same functions as used for transients.")
          ["Value commands"
           ("C-x s  " "Set"            transient-set)
           ("C-x C-s" "Save"           transient-save)
-          ("M-p    " "Previous value" transient-history-prev)
-          ("M-n    " "Next value"     transient-history-next)]
+          ("C-x p  " "Previous value" transient-history-prev)
+          ("C-x n  " "Next value"     transient-history-next)]
          ["Sticky commands"
           ;; Like `transient-sticky-map' except that
           ;; "C-g" has to be bound to a different command.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]