diff options
| author | Sam Steingold | 2017-11-22 16:14:22 -0500 |
|---|---|---|
| committer | Sam Steingold | 2017-11-22 16:14:36 -0500 |
| commit | f79c33b39f195d1b30d7a3e085804e45ab76358e (patch) | |
| tree | 6e50bcd256be4a3b49097d01291ceccb665d60e6 | |
| parent | a6844ee86e0577acaeb699a26902c4dc9e7352aa (diff) | |
| download | emacs-f79c33b39f195d1b30d7a3e085804e45ab76358e.tar.gz emacs-f79c33b39f195d1b30d7a3e085804e45ab76358e.zip | |
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.
| -rw-r--r-- | lisp/progmodes/etags.el | 9 | ||||
| -rw-r--r-- | 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 619c2ed6877..50a9f8190db 100644 --- a/lisp/progmodes/etags.el +++ b/lisp/progmodes/etags.el | |||
| @@ -274,12 +274,9 @@ buffer-local and set them to nil." | |||
| 274 | (run-hook-with-args-until-success 'tags-table-format-functions)) | 274 | (run-hook-with-args-until-success 'tags-table-format-functions)) |
| 275 | 275 | ||
| 276 | ;;;###autoload | 276 | ;;;###autoload |
| 277 | (defun tags-table-mode () | 277 | (define-derived-mode tags-table-mode special-mode "Tags Table" |
| 278 | "Major mode for tags table file buffers." | 278 | "Major mode for tags table file buffers." |
| 279 | (interactive) | 279 | (setq buffer-undo-list t) |
| 280 | (setq major-mode 'tags-table-mode ;FIXME: Use define-derived-mode. | ||
| 281 | mode-name "Tags Table" | ||
| 282 | buffer-undo-list t) | ||
| 283 | (initialize-new-tags-table)) | 280 | (initialize-new-tags-table)) |
| 284 | 281 | ||
| 285 | ;;;###autoload | 282 | ;;;###autoload |
| @@ -2060,7 +2057,7 @@ see the doc of that variable if you want to add names to the list." | |||
| 2060 | 2057 | ||
| 2061 | (define-derived-mode select-tags-table-mode special-mode "Select Tags Table" | 2058 | (define-derived-mode select-tags-table-mode special-mode "Select Tags Table" |
| 2062 | "Major mode for choosing a current tags table among those already loaded." | 2059 | "Major mode for choosing a current tags table among those already loaded." |
| 2063 | (setq buffer-read-only t)) | 2060 | ) |
| 2064 | 2061 | ||
| 2065 | (defun select-tags-table-select (button) | 2062 | (defun select-tags-table-select (button) |
| 2066 | "Select the tags table named on this line." | 2063 | "Select the tags table named on this line." |
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el index 44e7cd78ee5..30457d1e2d3 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 | |||
| 623 | (setq buffer-read-only nil) | 623 | (setq buffer-read-only nil) |
| 624 | (erase-buffer) | 624 | (erase-buffer) |
| 625 | (cvs-insert-strings files) | 625 | (cvs-insert-strings files) |
| 626 | (setq buffer-read-only t) | 626 | (special-mode) |
| 627 | (goto-char (point-min)) | 627 | (goto-char (point-min)) |
| 628 | (save-selected-window | 628 | (save-selected-window |
| 629 | (cvs-pop-to-buffer-same-frame buf) | 629 | (cvs-pop-to-buffer-same-frame buf) |