[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
scratch/substitute-command-keys 8a14413 6/8: Prefer Lisp version of desc
From: |
Stefan Kangas |
Subject: |
scratch/substitute-command-keys 8a14413 6/8: Prefer Lisp version of describe-map-tree |
Date: |
Sun, 18 Oct 2020 11:54:25 -0400 (EDT) |
branch: scratch/substitute-command-keys
commit 8a1441310aa151e739cfed3bd2eff3358edc8001
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>
Prefer Lisp version of describe-map-tree
This is a prerequisite to remove the old C functions, and gives a
measured 3 ms slowdown on my machine, from 0.27s to 0.30s per call to
describe-buffer-bindings (average over 50 calls).
* src/keymap.c (Fdescribe_buffer_bindings): Call Lisp function
describe-map-tree instead of C function describe_map_tree.
---
src/keymap.c | 89 ++++++++++++++++++++++++++++++++++++++++++------------------
1 file changed, 63 insertions(+), 26 deletions(-)
diff --git a/src/keymap.c b/src/keymap.c
index 5ae8da6..1eded13 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -2750,7 +2750,7 @@ The optional argument MENUS, if non-nil, says to mention
menu bindings.
(Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus)
{
Lisp_Object outbuf, shadow;
- bool nomenu = NILP (menus);
+ Lisp_Object nomenu = NILP (menus) ? Qt : Qnil;
Lisp_Object start1;
const char *alternate_heading
@@ -2799,9 +2799,13 @@ You type Translation\n\
}
if (!NILP (Vkey_translation_map))
- describe_map_tree (Vkey_translation_map, 0, Qnil, prefix,
- "Key translations", nomenu, 1, 0, 0);
-
+ {
+ Lisp_Object msg = build_unibyte_string ("Key translations");
+ CALLN (Ffuncall,
+ Qdescribe_map_tree,
+ Vkey_translation_map, Qnil, Qnil, prefix,
+ msg, nomenu, Qt, Qnil, Qnil);
+ }
/* Print the (major mode) local map. */
start1 = Qnil;
@@ -2810,8 +2814,11 @@ You type Translation\n\
if (!NILP (start1))
{
- describe_map_tree (start1, 1, shadow, prefix,
- "\f\nOverriding Bindings", nomenu, 0, 0, 0);
+ Lisp_Object msg = build_unibyte_string ("\f\nOverriding Bindings");
+ CALLN (Ffuncall,
+ Qdescribe_map_tree,
+ start1, Qt, shadow, prefix,
+ msg, nomenu, Qnil, Qnil, Qnil);
shadow = Fcons (start1, shadow);
start1 = Qnil;
}
@@ -2820,8 +2827,11 @@ You type Translation\n\
if (!NILP (start1))
{
- describe_map_tree (start1, 1, shadow, prefix,
- "\f\nOverriding Bindings", nomenu, 0, 0, 0);
+ Lisp_Object msg = build_unibyte_string ("\f\nOverriding Bindings");
+ CALLN (Ffuncall,
+ Qdescribe_map_tree,
+ start1, Qt, shadow, prefix,
+ msg, nomenu, Qnil, Qnil, Qnil);
shadow = Fcons (start1, shadow);
}
else
@@ -2841,9 +2851,11 @@ You type Translation\n\
XBUFFER (buffer), Qkeymap);
if (!NILP (start1))
{
- describe_map_tree (start1, 1, shadow, prefix,
- "\f\n`keymap' Property Bindings", nomenu,
- 0, 0, 0);
+ Lisp_Object msg = build_unibyte_string ("\f\n`keymap' Property
Bindings");
+ CALLN (Ffuncall,
+ Qdescribe_map_tree,
+ start1, Qt, shadow, prefix,
+ msg, nomenu, Qnil, Qnil, Qnil);
shadow = Fcons (start1, shadow);
}
@@ -2852,7 +2864,7 @@ You type Translation\n\
{
/* The title for a minor mode keymap
is constructed at run time.
- We let describe_map_tree do the actual insertion
+ We let describe-map-tree do the actual insertion
because it takes care of other features when doing so. */
char *title, *p;
@@ -2872,8 +2884,11 @@ You type Translation\n\
p += strlen (" Minor Mode Bindings");
*p = 0;
- describe_map_tree (maps[i], 1, shadow, prefix,
- title, nomenu, 0, 0, 0);
+ Lisp_Object msg = build_unibyte_string (title);
+ CALLN (Ffuncall,
+ Qdescribe_map_tree,
+ maps[i], Qt, shadow, prefix,
+ msg, nomenu, Qnil, Qnil, Qnil);
shadow = Fcons (maps[i], shadow);
SAFE_FREE ();
}
@@ -2883,30 +2898,51 @@ You type Translation\n\
if (!NILP (start1))
{
if (EQ (start1, BVAR (XBUFFER (buffer), keymap)))
- describe_map_tree (start1, 1, shadow, prefix,
- "\f\nMajor Mode Bindings", nomenu, 0, 0, 0);
+ {
+ Lisp_Object msg = build_unibyte_string ("\f\nMajor Mode
Bindings");
+ CALLN (Ffuncall,
+ Qdescribe_map_tree,
+ start1, Qt, shadow, prefix,
+ msg, nomenu, Qnil, Qnil, Qnil);
+ }
else
- describe_map_tree (start1, 1, shadow, prefix,
- "\f\n`local-map' Property Bindings",
- nomenu, 0, 0, 0);
+ {
+ Lisp_Object msg = build_unibyte_string ("\f\n`local-map' Property
Bindings");
+ CALLN (Ffuncall,
+ Qdescribe_map_tree,
+ start1, Qt, shadow, prefix,
+ msg, nomenu, Qnil, Qnil, Qnil);
+ }
shadow = Fcons (start1, shadow);
}
}
- describe_map_tree (current_global_map, 1, shadow, prefix,
- "\f\nGlobal Bindings", nomenu, 0, 1, 0);
+ Lisp_Object msg = build_unibyte_string ("\f\nGlobal Bindings");
+ CALLN (Ffuncall,
+ Qdescribe_map_tree,
+ current_global_map, Qt, shadow, prefix,
+ msg, nomenu, Qnil, Qt, Qnil);
/* Print the function-key-map translations under this prefix. */
if (!NILP (KVAR (current_kboard, Vlocal_function_key_map)))
- describe_map_tree (KVAR (current_kboard, Vlocal_function_key_map), 0,
Qnil, prefix,
- "\f\nFunction key map translations", nomenu, 1, 0, 0);
+ {
+ Lisp_Object msg = build_unibyte_string ("\f\nFunction key map
translations");
+ CALLN (Ffuncall,
+ Qdescribe_map_tree,
+ KVAR (current_kboard, Vlocal_function_key_map), Qnil, Qnil, prefix,
+ msg, nomenu, Qt, Qt, Qt);
+ }
/* Print the input-decode-map translations under this prefix. */
if (!NILP (KVAR (current_kboard, Vinput_decode_map)))
- describe_map_tree (KVAR (current_kboard, Vinput_decode_map), 0, Qnil,
prefix,
- "\f\nInput decoding map translations", nomenu, 1, 0, 0);
-
+ {
+ Lisp_Object msg = build_unibyte_string ("\f\nInput decoding map
translations");
+ CALLN (Ffuncall,
+ Qdescribe_map_tree,
+ KVAR (current_kboard, Vinput_decode_map), Qnil, Qnil, prefix,
+ msg, nomenu, Qt, Qnil, Qnil);
+ }
return Qnil;
}
@@ -3619,6 +3655,7 @@ void
syms_of_keymap (void)
{
DEFSYM (Qkeymap, "keymap");
+ DEFSYM (Qdescribe_map_tree, "describe-map-tree");
staticpro (&apropos_predicate);
staticpro (&apropos_accumulate);
apropos_predicate = Qnil;
- branch scratch/substitute-command-keys created (now 420023a), Stefan Kangas, 2020/10/18
- scratch/substitute-command-keys dcf9cd4 1/8: Add new Lisp implementation of substitute-command-keys, Stefan Kangas, 2020/10/18
- scratch/substitute-command-keys afd31f9 2/8: Translate describe_map_tree to Lisp, Stefan Kangas, 2020/10/18
- scratch/substitute-command-keys afde53c 5/8: Improve substitute-command-keys performance, Stefan Kangas, 2020/10/18
- scratch/substitute-command-keys 5ad2bb0 4/8: Translate describe_vector to Lisp, Stefan Kangas, 2020/10/18
- scratch/substitute-command-keys 8a14413 6/8: Prefer Lisp version of describe-map-tree,
Stefan Kangas <=
- scratch/substitute-command-keys ef5a604 7/8: Remove C version of substitute-command-keys, Stefan Kangas, 2020/10/18
- scratch/substitute-command-keys 420023a 8/8: Prefer Lisp version of describer in help--describe-vector, Stefan Kangas, 2020/10/18
- scratch/substitute-command-keys 647b1c5 3/8: Translate describe_map to Lisp, Stefan Kangas, 2020/10/18