diff options
-rw-r--r-- | lisp/ChangeLog | 5 | ||||
-rw-r--r-- | lisp/files.el | 27 |
2 files changed, 20 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e058ab140c..c4ec842eed 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-06-22 Bastien Guerry <[email protected]> + + * files.el (toggle-read-only): Display a message telling whether + the buffer is read-only or not (bug#11726). + 2012-06-22 Stefan Monnier <[email protected]> * emacs-lisp/gv.el: New file. diff --git a/lisp/files.el b/lisp/files.el index 761fc54bdf..857dbc981f 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -4857,18 +4857,21 @@ properties or buffer state) and make changes, temporarily bind (not buffer-read-only))) ; If buffer-read-only is set correctly, nil ; do nothing. ;; Toggle. - (cond - ((and buffer-read-only view-mode) - (View-exit-and-edit) - (make-local-variable 'view-read-only) - (setq view-read-only t)) ; Must leave view mode. - ((and (not buffer-read-only) view-read-only - ;; If view-mode is already active, `view-mode-enter' is a nop. - (not view-mode) - (not (eq (get major-mode 'mode-class) 'special))) - (view-mode-enter)) - (t (setq buffer-read-only (not buffer-read-only)) - (force-mode-line-update))))) + (progn + (cond + ((and buffer-read-only view-mode) + (View-exit-and-edit) + (make-local-variable 'view-read-only) + (setq view-read-only t)) ; Must leave view mode. + ((and (not buffer-read-only) view-read-only + ;; If view-mode is already active, `view-mode-enter' is a nop. + (not view-mode) + (not (eq (get major-mode 'mode-class) 'special))) + (view-mode-enter)) + (t (setq buffer-read-only (not buffer-read-only)) + (force-mode-line-update)))) + (message "Read-only %s for this buffer" + (if buffer-read-only "enabled" "disabled")))) (defun insert-file (filename) "Insert contents of file FILENAME into buffer after point. |