emacs-diffs
[Top][All Lists]
Advanced

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

master dbf08491a5: Make more ranges sort properly in describe-keymap


From: Lars Ingebrigtsen
Subject: master dbf08491a5: Make more ranges sort properly in describe-keymap
Date: Mon, 31 Jan 2022 11:32:32 -0500 (EST)

branch: master
commit dbf08491a5a45d88048082ba6ece1b61bdbc622b
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make more ranges sort properly in describe-keymap
    
    * lisp/subr.el (keymap-canonicalize): Don't consider two-character
    ranges as a range (bug#11325).
---
 lisp/subr.el            | 13 +++++++++++--
 test/lisp/help-tests.el |  4 ++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index fccd75361b..a1eb6fe3af 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1149,8 +1149,17 @@ Subkeymaps may be modified but are not canonicalized."
       (setq map (map-keymap ;; -internal
                  (lambda (key item)
                    (if (consp key)
-                       ;; Treat char-ranges specially.
-                       (push (cons key item) ranges)
+                       (if (= (car key) (1- (cdr key)))
+                           ;; If we have a two-character range, then
+                           ;; treat it as two separate characters
+                           ;; (because this makes `describe-bindings'
+                           ;; look better and shouldn't affect
+                           ;; anything else).
+                           (progn
+                             (push (cons (car key) item) bindings)
+                             (push (cons (cdr key) item) bindings))
+                         ;; Treat char-ranges specially.
+                         (push (cons key item) ranges))
                      (push (cons key item) bindings)))
                  map)))
     ;; Create the new map.
diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el
index d27e3d7cd4..9c9dddcd19 100644
--- a/test/lisp/help-tests.el
+++ b/test/lisp/help-tests.el
@@ -286,11 +286,11 @@ M-g M-c           switch-to-completions
            "
 Key             Binding
 -+
-( .. )         short-range
 1 .. 4         foo-range
 a .. c         foo-other-range
 
 C-e            foo-something
+( .. )         short-range
 x              foo-original
 <F1>           foo-function-key1
 "))))
@@ -304,12 +304,12 @@ x         foo-original
            "
 Key             Binding
 -+
-( .. )         short-range
 1 .. 4         foo-range
 a .. c         foo-other-range
 
 C-e            foo-something
   (this binding is currently shadowed)
+( .. )         short-range
 x              foo-original
   (this binding is currently shadowed)
 <F1>           foo-function-key1



reply via email to

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