[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/substitute-command-keys c5f9849 2/2: Fix Lisp implementation of
From: |
Stefan Kangas |
Subject: |
scratch/substitute-command-keys c5f9849 2/2: Fix Lisp implementation of shadow_lookup |
Date: |
Thu, 20 Aug 2020 20:14:59 -0400 (EDT) |
branch: scratch/substitute-command-keys
commit c5f984993afcbd558a73a72e1917f1fdd2c5eca1
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>
Fix Lisp implementation of shadow_lookup
* lisp/help.el (help--shadow-lookup): Fix to match shadow_lookup
in keymap.c.
(describe-map): Call above function.
* src/keymap.c (Fdescribe_vector_internal): Minor cleanup.
(Fkeymap__shadow_lookup): Remove defun.
(syms_of_keymap): Remove subr for Fkeymap__shadow_lookup.
---
lisp/help.el | 12 ++++++------
src/keymap.c | 13 -------------
2 files changed, 6 insertions(+), 19 deletions(-)
diff --git a/lisp/help.el b/lisp/help.el
index 40878ed..d9f4dcd 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1210,11 +1210,11 @@ Any inserted text ends in two newlines (used by
Return nil if the key sequence is too long."
;; Converted from shadow_lookup in keymap.c.
(let ((value (lookup-key keymap key accept-default)))
- (when (and (fixnump value) (> 0 value))
- (if (and value remap (symbolp value))
- (or (command-remapping value nil keymap)
- value)
- value))))
+ (cond ((and (fixnump value) (<= 0 value)))
+ ((and value remap (symbolp value))
+ (or (command-remapping value nil keymap)
+ value))
+ (t value))))
(defvar help--previous-description-column)
(defun help--describe-command (definition)
@@ -1296,7 +1296,7 @@ PARTIAL, SHADOW, NOMENU are as in `describe_map_tree'."
;; visible because a local definition of the
;; same key shadows it.
(or (not shadow)
- (let ((tem (keymap--shadow-lookup shadow (vector
event) t 0)))
+ (let ((tem (help--shadow-lookup shadow (vector event)
t nil)))
(cond ((null tem) t)
;; If both bindings are keymaps,
;; this key is a prefix key, so
diff --git a/src/keymap.c b/src/keymap.c
index a1e57ea..7aa11f4 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2391,15 +2391,6 @@ shadow_lookup (Lisp_Object keymap, Lisp_Object key,
Lisp_Object accept_default,
return value;
}
-DEFUN ("keymap--shadow-lookup", Fkeymap__shadow_lookup,
Skeymap__shadow_lookup, 4, 4, 0,
- doc: /* Like `lookup-key', but with command remapping.
-Just returns nil if the key sequence is too long. */)
- (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default,
- Lisp_Object remap)
-{
- return shadow_lookup (keymap, key, accept_default, NILP(remap) ? false :
true);
-}
-
static Lisp_Object Vmouse_events;
struct where_is_internal_data {
@@ -3352,9 +3343,6 @@ DEFUN ("describe-vector-internal",
Fdescribe_vector_internal, Sdescribe_vector_i
bool b_keymap_p = NILP (keymap_p) ? false : true;
bool b_mention_shadow = NILP (mention_shadow) ? false : true;
- /* describe_vector (XCAR (tail), */
- /* prefix, Qnil, elt_describer, partial, shadow, map, */
- /* 1, mention_shadow); */
describe_vector (vector, prefix, Qnil,
b_transl ? describe_translation : describe_command,
b_partial, shadow, entire_map,
@@ -3764,7 +3752,6 @@ This is used for internal purposes only. */);
defsubr (&Saccessible_keymaps);
defsubr (&Skey_description);
defsubr (&Skeymap__get_keyelt);
- defsubr (&Skeymap__shadow_lookup);
defsubr (&Sdescribe_vector);
defsubr (&Sdescribe_vector_internal);
defsubr (&Ssingle_key_description);