[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 0b42c33: * lisp/progmodes/cc-defs.el: Use with-sile
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] master 0b42c33: * lisp/progmodes/cc-defs.el: Use with-silent-modifications |
Date: |
Wed, 18 Nov 2015 16:51:16 +0000 |
branch: master
commit 0b42c33b1a79ac25304687b10577592051ae185b
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
* lisp/progmodes/cc-defs.el: Use with-silent-modifications
(c-save-buffer-state): Use with-silent-modifications when available.
(c--macroexpand-all): Check macroexpand-all directly rather than
c--mapcan-status.
---
lisp/progmodes/cc-defs.el | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 6bd5815..1b6108e 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -221,7 +221,7 @@ This variant works around bugs in `eval-when-compile' in
various
(eval-and-compile
(defmacro c--macroexpand-all (form &optional environment)
;; Macro to smooth out the renaming of `cl-macroexpand-all' in Emacs 24.3.
- (if (eq c--mapcan-status 'cl-mapcan)
+ (if (fboundp 'macroexpand-all)
`(macroexpand-all ,form ,environment)
`(cl-macroexpand-all ,form ,environment)))
@@ -508,19 +508,21 @@ must not be within a `c-save-buffer-state', since the
user then
wouldn't be able to undo them.
The return value is the value of the last form in BODY."
- `(let* ((modified (buffer-modified-p)) (buffer-undo-list t)
- (inhibit-read-only t) (inhibit-point-motion-hooks t)
- before-change-functions after-change-functions
- deactivate-mark
- buffer-file-name buffer-file-truename ; Prevent primitives checking
- ; for file modification
- ,@varlist)
- (unwind-protect
- (progn ,@body)
- (and (not modified)
- (buffer-modified-p)
- (set-buffer-modified-p nil)))))
-(put 'c-save-buffer-state 'lisp-indent-function 1)
+ (declare (debug t) (indent 1))
+ (if (fboundp 'with-silent-modifications)
+ `(with-silent-modifications (let* ,varlist ,@body))
+ `(let* ((modified (buffer-modified-p)) (buffer-undo-list t)
+ (inhibit-read-only t) (inhibit-point-motion-hooks t)
+ before-change-functions after-change-functions
+ deactivate-mark
+ buffer-file-name buffer-file-truename ; Prevent primitives checking
+ ; for file modification
+ ,@varlist)
+ (unwind-protect
+ (progn ,@body)
+ (and (not modified)
+ (buffer-modified-p)
+ (set-buffer-modified-p nil))))))
(defmacro c-tentative-buffer-changes (&rest body)
"Eval BODY and optionally restore the buffer contents to the state it
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 0b42c33: * lisp/progmodes/cc-defs.el: Use with-silent-modifications,
Stefan Monnier <=