Commit 84dd5c9b authored by Stefan Kangas's avatar Stefan Kangas

Don't shadow bindings by the same command

* src/keymap.c (describe_vector): Do not say binding is shadowed if
the other key binding points to the same command.  (Bug#9293)
* test/src/keymap-tests.el
(help--describe-vector/bug-9293-same-command-does-not-shadow): New
test.
parent a6490343
......@@ -3130,7 +3130,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
{
shadowed_by = shadow_lookup (shadow, kludge, Qt, 0);
if (!NILP (shadowed_by))
if (!NILP (shadowed_by) && !EQ (shadowed_by, definition))
{
if (mention_shadow)
this_shadowed = 1;
......
......@@ -224,6 +224,30 @@ f foo (binding currently shadowed)
g .. h foo
")))))
(ert-deftest help--describe-vector/bug-9293-same-command-does-not-shadow ()
"Check that a command can't be shadowed by the same command."
(let ((range-map
(let ((map (make-keymap)))
(define-key map "0" 'foo)
(define-key map "1" 'foo)
(define-key map "2" 'foo)
(define-key map "3" 'foo)
map))
(shadow-map
(let ((map (make-keymap)))
(define-key map "0" 'foo)
(define-key map "1" 'foo)
(define-key map "2" 'foo)
(define-key map "3" 'foo)
map)))
(with-temp-buffer
(help--describe-vector (cadr range-map) nil #'help--describe-command
t shadow-map range-map t)
(should (equal (buffer-string)
"
0 .. 3 foo
")))))
;;;; apropos-internal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment