[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#56682: Fix the long lines font locking related slowdowns
From: |
Gregory Heytings |
Subject: |
bug#56682: Fix the long lines font locking related slowdowns |
Date: |
Mon, 01 Aug 2022 18:09:07 +0000 |
Try `M-: (use-global-map (make-keymap)) RET`
Should we prevent users from doing that?
It's a misleading question. No "user" would ever do that. Sure, it's
a nice example, but only an Elisp hacker would do that, in the middle
of a debugging session, and they would do that on purpose (although
perhaps without knowing the effect in advance). Which has nothing to
do with a regular user who just opens a file.
FWIW, the above is my standard example because I ended up doing exactly
that by accident, locking myself out of the session I was trying to
debug, so in a sense, I'd have been happy (that one time) if Emacs had
prevented me from doing it.
So... what do you think of the following? 😉
diff --git a/src/keymap.c b/src/keymap.c
index 506b755e5d..e42bc64717 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1881,6 +1881,17 @@ DEFUN ("use-global-map", Fuse_global_map,
Suse_global_map, 1, 1, 0,
(Lisp_Object keymap)
{
keymap = get_keymap (keymap, 1, 1);
+
+ /* Prevent locking Emacs if someone inadvertently evaluates
+ (use-global-map (make-keymap)) */
+ if (EQ (Fequal (keymap, Fmake_keymap (Qnil)), Qt))
+ {
+ Lisp_Object meta_colon_key = CALLN (Fvector, make_fixnum (134217786));
+ Lisp_Object default_key = CALLN (Fvector, Qt);
+ Fdefine_key (keymap, meta_colon_key, intern ("eval-expression"), Qnil);
+ Fdefine_key (keymap, default_key, intern ("self-insert-command"), Qnil);
+ }
+
current_global_map = keymap;
return Qnil;
- bug#56682: Fix the long lines font locking related slowdowns, (continued)
- bug#56682: Fix the long lines font locking related slowdowns, Eli Zaretskii, 2022/08/01
- bug#56682: Fix the long lines font locking related slowdowns, Gregory Heytings, 2022/08/01
- bug#56682: Fix the long lines font locking related slowdowns, Eli Zaretskii, 2022/08/01
- bug#56682: Fix the long lines font locking related slowdowns, Gregory Heytings, 2022/08/01
- bug#56682: Fix the long lines font locking related slowdowns, Eli Zaretskii, 2022/08/01
bug#56682: Fix the long lines font locking related slowdowns, Eli Zaretskii, 2022/08/01
bug#56682: Fix the long lines font locking related slowdowns,
Gregory Heytings <=
bug#56682: Fix the long lines font locking related slowdowns, Dmitry Gutov, 2022/08/03