GNU bug report logs -
#79323
30.2; Control-X-prefix not remapable
Previous Next
Reported by: Linn Stanton <linnstanton <at> me.com>
Date: Wed, 27 Aug 2025 17:23:02 UTC
Severity: normal
Found in version 30.2
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
Full log
Message #35 received at 79323 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> If I were a `tab-line` user, I suppose we would have done the same there as
> we did in `tab-bar. See master `tab-bar-define-keys` which I bind to nil
> as I manage my own bindings.
Thanks for the good idea, this should work:
[tab-line-define-keys.patch (text/x-diff, inline)]
diff --git a/lisp/tab-line.el b/lisp/tab-line.el
index 7caae8bc2c1..aba88d8e8f5 100644
--- a/lisp/tab-line.el
+++ b/lisp/tab-line.el
@@ -1277,14 +1277,48 @@ tab-line-event-start
(event-start event)))
+(defcustom tab-line-define-keys t
+ "Define specific tab-line key bindings.
+If t, the default, key mappings for switching and moving tabs
+are defined. If nil, do not define any key mappings."
+ :type 'boolean
+ :initialize #'custom-initialize-default
+ :set (lambda (sym val)
+ (tab-line--undefine-keys)
+ (set-default sym val)
+ ;; Enable the new keybindings
+ (tab-line--define-keys))
+ :group 'tab-line
+ :version "31.1")
+
+(defun tab-line--define-keys ()
+ "Install key bindings to switch between tabs if so configured."
+ (when tab-line-define-keys
+ (when (eq (lookup-key ctl-x-map [left]) 'previous-buffer)
+ (define-key ctl-x-map [left] 'tab-line-switch-to-prev-tab))
+ (when (eq (lookup-key ctl-x-map [C-left]) 'previous-buffer)
+ (define-key ctl-x-map [C-left] 'tab-line-switch-to-prev-tab))
+ (unless (lookup-key ctl-x-map [M-left])
+ (define-key ctl-x-map [M-left] 'tab-line-move-tab-backward))
+ (when (eq (lookup-key ctl-x-map [right]) 'next-buffer)
+ (define-key ctl-x-map [right] 'tab-line-switch-to-next-tab))
+ (when (eq (lookup-key ctl-x-map [C-right]) 'next-buffer)
+ (define-key ctl-x-map [C-right] 'tab-line-switch-to-next-tab))
+ (unless (lookup-key ctl-x-map [M-right])
+ (define-key ctl-x-map [M-right] 'tab-line-move-tab-forward))))
+
+(defun tab-line--undefine-keys ()
+ "Uninstall key bindings previously bound by `tab-line--define-keys'."
+ (when tab-line-define-keys
+ (define-key ctl-x-map [left] 'previous-buffer)
+ (define-key ctl-x-map [C-left] 'previous-buffer)
+ (define-key ctl-x-map [M-left] nil)
+ (define-key ctl-x-map [right] 'next-buffer)
+ (define-key ctl-x-map [C-right] 'next-buffer)
+ (define-key ctl-x-map [M-right] 'next-buffer)))
+
(defvar-keymap tab-line-mode-map
- :doc "Keymap for keys of `tab-line-mode'."
- "C-x <left>" #'tab-line-switch-to-prev-tab
- "C-x C-<left>" #'tab-line-switch-to-prev-tab
- "C-x M-<left>" #'tab-line-move-tab-backward
- "C-x <right>" #'tab-line-switch-to-next-tab
- "C-x C-<right>" #'tab-line-switch-to-next-tab
- "C-x M-<right>" #'tab-line-move-tab-forward)
+ :doc "Keymap for keys of `tab-line-mode'.")
(defvar-keymap tab-line-switch-repeat-map
:doc "Keymap to repeat tab/buffer cycling. Used in `repeat-mode'."
@@ -1374,7 +1408,10 @@ tab-line-mode--turn-on
(define-globalized-minor-mode global-tab-line-mode
tab-line-mode tab-line-mode--turn-on
:group 'tab-line
- :version "27.1")
+ :version "27.1"
+ (if tab-line-mode
+ (tab-line--define-keys)
+ (tab-line--undefine-keys)))
(global-set-key [tab-line down-mouse-3] 'tab-line-context-menu)
This bug report was last modified 9 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.