emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 3d38ab8: command-history-mode inherits from special


From: Sam Steingold
Subject: [Emacs-diffs] master 3d38ab8: command-history-mode inherits from special-mode
Date: Tue, 20 Feb 2018 15:30:56 -0500 (EST)

branch: master
commit 3d38ab8f1fbfaeb1f3eddbc79ef6ded1d9a87841
Author: Sam Steingold <address@hidden>
Commit: Sam Steingold <address@hidden>

    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'.
---
 lisp/chistory.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/chistory.el b/lisp/chistory.el
index d557c9f..b4a8b6e 100644
--- a/lisp/chistory.el
+++ b/lisp/chistory.el
@@ -125,8 +125,8 @@ The buffer is left in Command History mode."
   'command-history-mode-map "24.1")
 (defvar command-history-mode-map
   (let ((map (make-sparse-keymap)))
-    (set-keymap-parent map lisp-mode-shared-map)
-    (suppress-keymap map)
+    (set-keymap-parent map (make-composed-keymap lisp-mode-shared-map
+                                                 special-mode-map))
     (define-key map "x" 'command-history-repeat)
     (define-key map "\n" 'next-line)
     (define-key map "\r" 'next-line)
@@ -134,20 +134,23 @@ The buffer is left in Command History mode."
     map)
   "Keymap for `command-history-mode'.")
 
-(define-derived-mode command-history-mode fundamental-mode "Command History"
+(define-derived-mode command-history-mode special-mode "Command History"
   "Major mode for listing and repeating recent commands.
 
 Keybindings:
 \\{command-history-mode-map}"
   (lisp-mode-variables nil)
-  (set-syntax-table emacs-lisp-mode-syntax-table)
-  (setq buffer-read-only t))
+  (set (make-local-variable 'revert-buffer-function) 'command-history-revert)
+  (set-syntax-table emacs-lisp-mode-syntax-table))
 
 (defcustom command-history-hook nil
   "If non-nil, its value is called on entry to `command-history-mode'."
   :type 'hook
   :group 'chistory)
 
+(defun command-history-revert (_ignore-auto _noconfirm)
+  (list-command-history))
+
 (defun command-history-repeat ()
   "Repeat the command shown on the current line.
 The buffer for that command is the previous current buffer."



reply via email to

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