(defvar help--keymaps-seen nil)
(defun describe-map-tree (startmap &optional partial shadow prefix title
- no-menu transl always-title mention-shadow)
+ no-menu transl always-title mention-shadow
+ buffer)
"Insert a description of the key bindings in STARTMAP.
This is followed by the key bindings of all maps reachable
through STARTMAP.
If MENTION-SHADOW is non-nil, then when something is shadowed by
SHADOW, don't omit it; instead, mention it but say it is
-shadowed."
+shadowed.
+
+If BUFFER, lookup keys while in that buffer. This only affects
+things like :filters for menu bindings."
(let* ((amaps (accessible-keymaps startmap prefix))
(orig-maps (if no-menu
(progn
(setq sub-shadows (cons (cdr (car tail)) sub-shadows)))
(setq tail (cdr tail))))
(describe-map (cdr elt) elt-prefix transl partial
- sub-shadows no-menu mention-shadow)))
+ sub-shadows no-menu mention-shadow
+ buffer)))
(setq maps (cdr maps)))
;; Print title...
(when (and print-title
(t nil))))
(defun describe-map (map &optional prefix transl partial shadow
- nomenu mention-shadow)
+ nomenu mention-shadow buffer)
"Describe the contents of keymap MAP.
Assume that this keymap itself is reached by the sequence of
prefix keys PREFIX (a string or vector).
-TRANSL, PARTIAL, SHADOW, NOMENU, MENTION-SHADOW are as in
-`describe-map-tree'."
+TRANSL, PARTIAL, SHADOW, NOMENU, MENTION-SHADOW and BUFFER are as
+in `describe-map-tree'."
;; Converted from describe_map in keymap.c.
(let* ((suppress (and partial 'suppress-keymap))
(map (keymap-canonicalize map))
((and mention-shadow (not (eq tem definition)))
(setq this-shadowed t))
(t nil))))
- (eq definition (lookup-key tail (vector event) t))
+ (eq definition (if buffer
+ (with-current-buffer buffer
+ (lookup-key tail (vector event) t))
+ (lookup-key tail (vector event) t)))
(push (list event definition this-shadowed) vect))))
((eq (car tail) 'keymap)
;; The same keymap might be in the structure twice, if
CALLN (Ffuncall,
Qdescribe_map_tree,
Vkey_translation_map, Qnil, Qnil, prefix,
- msg, nomenu, Qt, Qnil, Qnil);
+ msg, nomenu, Qt, Qnil, Qnil, buffer);
}
/* Print the (major mode) local map. */
CALLN (Ffuncall,
Qdescribe_map_tree,
start1, Qt, shadow, prefix,
- msg, nomenu, Qnil, Qnil, Qnil);
+ msg, nomenu, Qnil, Qnil, Qnil, buffer);
shadow = Fcons (start1, shadow);
start1 = Qnil;
}
CALLN (Ffuncall,
Qdescribe_map_tree,
start1, Qt, shadow, prefix,
- msg, nomenu, Qnil, Qnil, Qnil);
+ msg, nomenu, Qnil, Qnil, Qnil, buffer);
shadow = Fcons (start1, shadow);
}
else
CALLN (Ffuncall,
Qdescribe_map_tree,
start1, Qt, shadow, prefix,
- msg, nomenu, Qnil, Qnil, Qnil);
+ msg, nomenu, Qnil, Qnil, Qnil, buffer);
shadow = Fcons (start1, shadow);
}
CALLN (Ffuncall,
Qdescribe_map_tree,
maps[i], Qt, shadow, prefix,
- msg, nomenu, Qnil, Qnil, Qnil);
+ msg, nomenu, Qnil, Qnil, Qnil, buffer);
shadow = Fcons (maps[i], shadow);
SAFE_FREE ();
}
CALLN (Ffuncall,
Qdescribe_map_tree,
start1, Qt, shadow, prefix,
- msg, nomenu, Qnil, Qnil, Qnil);
+ msg, nomenu, Qnil, Qnil, Qnil, buffer);
}
else
{
CALLN (Ffuncall,
Qdescribe_map_tree,
start1, Qt, shadow, prefix,
- msg, nomenu, Qnil, Qnil, Qnil);
+ msg, nomenu, Qnil, Qnil, Qnil, buffer);
}
shadow = Fcons (start1, shadow);
CALLN (Ffuncall,
Qdescribe_map_tree,
current_global_map, Qt, shadow, prefix,
- msg, nomenu, Qnil, Qt, Qnil);
+ msg, nomenu, Qnil, Qt, Qnil, buffer);
/* Print the function-key-map translations under this prefix. */
if (!NILP (KVAR (current_kboard, Vlocal_function_key_map)))
CALLN (Ffuncall,
Qdescribe_map_tree,
KVAR (current_kboard, Vlocal_function_key_map), Qnil, Qnil, prefix,
- msg, nomenu, Qt, Qnil, Qnil);
+ msg, nomenu, Qt, Qnil, Qnil, buffer);
}
/* Print the input-decode-map translations under this prefix. */
CALLN (Ffuncall,
Qdescribe_map_tree,
KVAR (current_kboard, Vinput_decode_map), Qnil, Qnil, prefix,
- msg, nomenu, Qt, Qnil, Qnil);
+ msg, nomenu, Qt, Qnil, Qnil, buffer);
}
return Qnil;
}