Variable: repeat-too-dangerous
repeat-too-dangerous is a customizable variable defined in
repeat.el.gz.
Value
(kill-this-buffer)
Documentation
Commands too dangerous to repeat with C-x z (repeat).
Source Code
;; Defined in /usr/src/emacs/lisp/repeat.el.gz
;;; repeat.el --- convenient way to repeat the previous command -*- lexical-binding: t -*-
;; Copyright (C) 1998, 2001-2022 Free Software Foundation, Inc.
;; Author: Will Mengarini <seldon@eskimo.com>
;; Created: Mo 02 Mar 98
;; Old-Version: 0.51
;; Keywords: convenience, vi, repeat
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Sometimes the fastest way to get something done is just to lean on a key;
;; moving forward through a series of words by leaning on M-f is an example.
;; But 'forward-page is orthodoxly bound to C-x ], so moving forward through
;; several pages requires
;; Loop until desired page is reached:
;; Hold down control key with left pinkie.
;; Tap <x>.
;; Lift left pinkie off control key.
;; Tap <]>.
;; This is a pain in the ass.
;; This package defines a command that repeats the preceding command,
;; whatever that was, including its arguments, whatever they were.
;; This command is connected to the key C-x z.
;; To repeat the previous command once, type C-x z.
;; To repeat it a second time immediately after, type just z.
;; By typing z again and again, you can repeat the command over and over.
;; This works correctly inside a keyboard macro as far as recording and
;; playback go, but `edit-kbd-macro' gets it wrong. That shouldn't really
;; matter; if you need to edit something like
;; C-x ] ;; forward-page
;; C-x z ;; repeat
;; zz ;; self-insert-command * 2
;; C-x ;; Control-X-prefix
;; you can just kill the bogus final 2 lines, then duplicate the repeat line
;; as many times as it's really needed. Also, `edit-kbd-macro' works
;; correctly if `repeat' is invoked through a rebinding to a single keystroke
;; and the global variable repeat-on-final-keystroke is set to a value
;; that doesn't include that keystroke. For example, the lines
;; (global-set-key "\C-z" 'repeat)
;; (setq repeat-on-final-keystroke "z")
;; in your .emacs would allow `edit-kbd-macro' to work correctly when C-z was
;; used in a keyboard macro to invoke `repeat', but would still allow C-x z
;; to be used for `repeat' elsewhere. The real reason for documenting this
;; isn't that anybody would need it for the `edit-kbd-macro' problem, but
;; that there might be other unexpected ramifications of re-executing on
;; repetitions of the final keystroke, and this shows how to do workarounds.
;; If the preceding command had a prefix argument, that argument is applied
;; to the repeat command, unless the repeat command is given a new prefix
;; argument, in which case it applies that new prefix argument to the
;; preceding command. This means a key sequence like C-u - C-x C-t can be
;; repeated. (It shoves the preceding line upward in the buffer.)
;; Here are some other key sequences with which repeat might be useful:
;; C-u - C-t [shove preceding character backward in line]
;; C-u - M-t [shove preceding word backward in sentence]
;; C-x ^ enlarge-window [one line] (assuming frame has > 1 window)
;; C-u - C-x ^ [shrink window one line]
;; C-x ` next-error
;; C-u - C-x ` [previous error]
;; C-x DEL backward-kill-sentence
;; C-x e call-last-kbd-macro
;; C-x r i insert-register
;; C-x r t string-rectangle
;; C-x TAB indent-rigidly [one character]
;; C-u - C-x TAB [outdent rigidly one character]
;; C-x { shrink-window-horizontally
;; C-x } enlarge-window-horizontally
;;; Code:
;;;;; ************************* USER OPTIONS ************************** ;;;;;
(defcustom repeat-too-dangerous '(kill-this-buffer)
"Commands too dangerous to repeat with \\[repeat]."
:group 'convenience
:type '(repeat function))