emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master f79c33b 3/3: Use special-mode for read-only buffers


From: Sam Steingold
Subject: [Emacs-diffs] master f79c33b 3/3: Use special-mode for read-only buffers.
Date: Wed, 22 Nov 2017 16:15:09 -0500 (EST)

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

    Use special-mode for read-only buffers.
    
    * lisp/progmodes/etags.el (tags-table-mode): Define using
    `define-derived-mode', inheriting from `special-mode'.
    Not only the buffer is now read-only, but you can bury it with "q".
    (select-tags-table-mode): No need to set `buffer-read-only'
    explicitly, `special-mode' takes care of that.
    * lisp/vc/log-edit.el (log-edit-show-files): Use `special-mode'
    instead of setting `buffer-read-only' explicitly.
---
 lisp/progmodes/etags.el | 9 +++------
 lisp/vc/log-edit.el     | 2 +-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 619c2ed..50a9f81 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -274,12 +274,9 @@ buffer-local and set them to nil."
   (run-hook-with-args-until-success 'tags-table-format-functions))
 
 ;;;###autoload
-(defun tags-table-mode ()
+(define-derived-mode tags-table-mode special-mode "Tags Table"
   "Major mode for tags table file buffers."
-  (interactive)
-  (setq major-mode 'tags-table-mode     ;FIXME: Use define-derived-mode.
-        mode-name "Tags Table"
-        buffer-undo-list t)
+  (setq buffer-undo-list t)
   (initialize-new-tags-table))
 
 ;;;###autoload
@@ -2060,7 +2057,7 @@ see the doc of that variable if you want to add names to 
the list."
 
 (define-derived-mode select-tags-table-mode special-mode "Select Tags Table"
   "Major mode for choosing a current tags table among those already loaded."
-  (setq buffer-read-only t))
+  )
 
 (defun select-tags-table-select (button)
   "Select the tags table named on this line."
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 44e7cd7..30457d1 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -623,7 +623,7 @@ Also saves its contents in the comment history and hides
       (setq buffer-read-only nil)
       (erase-buffer)
       (cvs-insert-strings files)
-      (setq buffer-read-only t)
+      (special-mode)
       (goto-char (point-min))
       (save-selected-window
        (cvs-pop-to-buffer-same-frame buf)



reply via email to

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