]> git.eshelyaron.com Git - emacs.git/commitdiff
Make more ranges sort properly in describe-keymap
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 31 Jan 2022 16:31:09 +0000 (17:31 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 31 Jan 2022 16:32:26 +0000 (17:32 +0100)
* lisp/subr.el (keymap-canonicalize): Don't consider two-character
ranges as a range (bug#11325).

lisp/subr.el
test/lisp/help-tests.el

index fccd75361bdba32ff782f5a337d627f932cc4ee0..a1eb6fe3afbc4b20ecf821dd447aeff74f7bb3c5 100644 (file)
@@ -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.
index d27e3d7cd4d9df6a07c5ad2ba66f01ed0d259681..9c9dddcd19ca691bbd1fa3bd379fb4c70702767e 100644 (file)
@@ -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