[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Round-tripping key definitions

From: Lars Ingebrigtsen
Subject: Re: Round-tripping key definitions
Date: Mon, 15 Nov 2021 09:21:01 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Lars Ingebrigtsen <larsi@gnus.org> writes:

> D'oh.  That's the global key binding.  Let's see...  With:

The following seems to do the trick (in both GUI and TUI Emacs).

(Not meant as a patch, but to illustrate -- we should instead not bind
the stuff that this unbinds.)

So if we do the same with RET and DEL, we should basically be OK?

diff --git a/lisp/indent.el b/lisp/indent.el
index aa6b8d17c4..e8426ae854 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -805,7 +805,11 @@ move-to-tab-stop
                 (forward-char -1))
               (delete-region (point) before)))))))
-(define-key global-map "\t" 'indent-for-tab-command)
+(define-key global-map [TAB] 'indent-for-tab-command)
+(define-key global-map [?\C-i] nil)
+(define-key global-map [tab] nil)
+(define-key function-key-map [?\C-i] [TAB])
+(define-key function-key-map [tab] [TAB])
 (define-key esc-map "\C-\\" 'indent-region)
 (define-key ctl-x-map "\t" 'indent-rigidly)
 (define-key esc-map "i" 'tab-to-tab-stop)
diff --git a/src/keymap.c b/src/keymap.c
index 29d2ca7ab7..6034b1e569 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1129,8 +1129,10 @@ DEFUN ("define-key", Fdefine_key, Sdefine_key, 3, 3, 0,
            CHECK_CHARACTER_CDR (c);
+         /*
       if (SYMBOLP (c))
        silly_event_symbol_error (c);
+         */
       if (FIXNUMP (c)
          && (XFIXNUM (c) & meta_bit)

(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no

reply via email to

[Prev in Thread] Current Thread [Next in Thread]