From: Sam Steingold Date: Wed, 6 Jun 2012 15:19:39 +0000 (-0400) Subject: * lisp/calendar/calendar.el (calendar-in-read-only-buffer): X-Git-Tag: emacs-24.2.90~1199^2~474^2~109 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=628299e039e9b16f7daec2c7afe44e1b43c5753d;p=emacs.git * lisp/calendar/calendar.el (calendar-in-read-only-buffer): Call `special-mode' to enable the standard read-only keybindings. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0911da1a03b..fff6a2295f5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-06-06 Sam Steingold + + * calendar/calendar.el (calendar-in-read-only-buffer): + Call `special-mode' to enable the standard read-only keybindings. + 2012-06-06 Stefan Monnier * emacs-lisp/macroexp.el (macroexpand-all-1): Don't spam the output diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el index 62d09c6b62c..33cb57b352d 100644 --- a/lisp/calendar/calendar.el +++ b/lisp/calendar/calendar.el @@ -1105,9 +1105,8 @@ inclusive. The standard macro `dotimes' is preferable in most cases." ,index (1+ ,index))) sum)) -;; FIXME bind q to bury-buffer? (defmacro calendar-in-read-only-buffer (buffer &rest body) - "Switch to BUFFER and executes the forms in BODY. + "Switch to BUFFER and execute the forms in BODY. First creates or erases BUFFER as needed. Leaves BUFFER read-only, with disabled undo. Leaves point at point-min, displays BUFFER." (declare (indent 1) (debug t)) @@ -1120,6 +1119,7 @@ with disabled undo. Leaves point at point-min, displays BUFFER." (goto-char (point-min)) (set-buffer-modified-p nil) (setq buffer-read-only t) + (special-mode) (display-buffer ,buffer))) ;; The following are in-line for speed; they can be called thousands of times