diff options
| author | Sam Steingold | 2018-02-20 15:30:51 -0500 |
|---|---|---|
| committer | Sam Steingold | 2018-02-20 15:31:07 -0500 |
| commit | 3d38ab8f1fbfaeb1f3eddbc79ef6ded1d9a87841 (patch) | |
| tree | 9a49eb9087a4fdee7bdb05678a440cb888285c67 | |
| parent | 3efd6aec6e8427f4e1952711a93ccec4aa83abdf (diff) | |
| download | emacs-3d38ab8f1fbfaeb1f3eddbc79ef6ded1d9a87841.tar.gz emacs-3d38ab8f1fbfaeb1f3eddbc79ef6ded1d9a87841.zip | |
command-history-mode inherits from special-mode
(command-history-mode-map): Add `special-mode-map' to parents.
(command-history-mode): Parent is `special-mode', not
`fundamental-mode', set `revert-buffer-function'.
(command-history-revert): Define for `revert-buffer-function'.
| -rw-r--r-- | lisp/chistory.el | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lisp/chistory.el b/lisp/chistory.el index d557c9f4eee..b4a8b6e72f9 100644 --- a/lisp/chistory.el +++ b/lisp/chistory.el | |||
| @@ -125,8 +125,8 @@ The buffer is left in Command History mode." | |||
| 125 | 'command-history-mode-map "24.1") | 125 | 'command-history-mode-map "24.1") |
| 126 | (defvar command-history-mode-map | 126 | (defvar command-history-mode-map |
| 127 | (let ((map (make-sparse-keymap))) | 127 | (let ((map (make-sparse-keymap))) |
| 128 | (set-keymap-parent map lisp-mode-shared-map) | 128 | (set-keymap-parent map (make-composed-keymap lisp-mode-shared-map |
| 129 | (suppress-keymap map) | 129 | special-mode-map)) |
| 130 | (define-key map "x" 'command-history-repeat) | 130 | (define-key map "x" 'command-history-repeat) |
| 131 | (define-key map "\n" 'next-line) | 131 | (define-key map "\n" 'next-line) |
| 132 | (define-key map "\r" 'next-line) | 132 | (define-key map "\r" 'next-line) |
| @@ -134,20 +134,23 @@ The buffer is left in Command History mode." | |||
| 134 | map) | 134 | map) |
| 135 | "Keymap for `command-history-mode'.") | 135 | "Keymap for `command-history-mode'.") |
| 136 | 136 | ||
| 137 | (define-derived-mode command-history-mode fundamental-mode "Command History" | 137 | (define-derived-mode command-history-mode special-mode "Command History" |
| 138 | "Major mode for listing and repeating recent commands. | 138 | "Major mode for listing and repeating recent commands. |
| 139 | 139 | ||
| 140 | Keybindings: | 140 | Keybindings: |
| 141 | \\{command-history-mode-map}" | 141 | \\{command-history-mode-map}" |
| 142 | (lisp-mode-variables nil) | 142 | (lisp-mode-variables nil) |
| 143 | (set-syntax-table emacs-lisp-mode-syntax-table) | 143 | (set (make-local-variable 'revert-buffer-function) 'command-history-revert) |
| 144 | (setq buffer-read-only t)) | 144 | (set-syntax-table emacs-lisp-mode-syntax-table)) |
| 145 | 145 | ||
| 146 | (defcustom command-history-hook nil | 146 | (defcustom command-history-hook nil |
| 147 | "If non-nil, its value is called on entry to `command-history-mode'." | 147 | "If non-nil, its value is called on entry to `command-history-mode'." |
| 148 | :type 'hook | 148 | :type 'hook |
| 149 | :group 'chistory) | 149 | :group 'chistory) |
| 150 | 150 | ||
| 151 | (defun command-history-revert (_ignore-auto _noconfirm) | ||
| 152 | (list-command-history)) | ||
| 153 | |||
| 151 | (defun command-history-repeat () | 154 | (defun command-history-repeat () |
| 152 | "Repeat the command shown on the current line. | 155 | "Repeat the command shown on the current line. |
| 153 | The buffer for that command is the previous current buffer." | 156 | The buffer for that command is the previous current buffer." |