]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-defs.el
Merge from origin/emacs-25
[gnu-emacs] / lisp / progmodes / cc-defs.el
index 77e949c59d40a279a98cd5fbd90b64800e755cc7..c42fbe7e51f994e7bfaea99444e62e2d74523263 100644 (file)
@@ -206,7 +206,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)))
 
@@ -493,19 +493,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