From: Lars Ingebrigtsen Date: Thu, 12 May 2022 01:09:22 +0000 (+0200) Subject: Bind TAB in indent-rigidly-map as a convenience X-Git-Tag: emacs-29.0.90~1910^2~777 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c74e7f801ec353a52faf59e76245834198abeb28;p=emacs.git Bind TAB in indent-rigidly-map as a convenience * lisp/indent.el (indent-rigidly): Mention it. (indent-rigidly-map): Bind TAB so that `C-x TAB TAB...' does the logical thing. --- diff --git a/lisp/indent.el b/lisp/indent.el index 0343439d144..d6dee94016d 100644 --- a/lisp/indent.el +++ b/lisp/indent.el @@ -240,21 +240,23 @@ Blank lines are ignored." (current-indentation)))) indent)))) -(defvar indent-rigidly-map - (let ((map (make-sparse-keymap))) - (define-key map [left] 'indent-rigidly-left) - (define-key map [right] 'indent-rigidly-right) - (define-key map [S-left] 'indent-rigidly-left-to-tab-stop) - (define-key map [S-right] 'indent-rigidly-right-to-tab-stop) - map) - "Transient keymap for adjusting indentation interactively. -It is activated by calling `indent-rigidly' interactively.") +(defvar-keymap indent-rigidly-map + :doc "Transient keymap for adjusting indentation interactively. +It is activated by calling `indent-rigidly' interactively." + "TAB" #'indent-rigidly-right + "" #'indent-rigidly-left + "" #'indent-rigidly-right + "S-" #'indent-rigidly-left-to-tab-stop + "S-" #'indent-rigidly-right-to-tab-stop) +(put 'indent-rigidly-right :advertised-binding (kbd "")) (defun indent-rigidly (start end arg &optional interactive) "Indent all lines starting in the region. If called interactively with no prefix argument, activate a transient mode in which the indentation can be adjusted interactively by typing \\\\[indent-rigidly-left], \\[indent-rigidly-right], \\[indent-rigidly-left-to-tab-stop], or \\[indent-rigidly-right-to-tab-stop]. +In addition, \\`TAB' is also bound (and calls `indent-rigidly-right'). + Typing any other key exits this mode, and this key is then acted upon as normally. If `transient-mark-mode' is enabled, exiting also deactivates the mark.