emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 8b789c8: Make c-deprepertize-CPP work on deletion/i


From: Alan Mackenzie
Subject: [Emacs-diffs] master 8b789c8: Make c-deprepertize-CPP work on deletion/insertion of "s. Fixes bug #24132.
Date: Tue, 9 Aug 2016 10:26:42 +0000 (UTC)

branch: master
commit 8b789c8cfeaee074f581e10009d781b52bf45c81
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    Make c-deprepertize-CPP work on deletion/insertion of "s.  Fixes bug #24132.
    
    * lisp/progmodes/cc-mode.el (c-depropertize-CPP): Rewrite function.
---
 lisp/progmodes/cc-mode.el |   31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 04d2ed6..8d75eea 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -892,24 +892,31 @@ Note that the style variables are always made local to 
the buffer."
   ;; This function is in the C/C++/ObjC values of
   ;; `c-get-state-before-change-functions' and is called exclusively as a
   ;; before change function.
-  (c-save-buffer-state ()
+  (c-save-buffer-state (m-beg ss-found)
     (goto-char c-new-BEG)
     (while (and (< (point) beg)
-               (search-forward-regexp c-anchored-cpp-prefix beg t))
+               (search-forward-regexp c-anchored-cpp-prefix beg 'bound))
       (goto-char (match-beginning 1))
-      (let ((m-beg (point)))
-       (c-end-of-macro)
-       (c-clear-char-property-with-value
-        m-beg (min (point) beg) 'syntax-table '(1))))
+      (setq m-beg (point))
+      (c-end-of-macro)
+      (c-clear-char-property-with-value m-beg (point) 'syntax-table '(1)))
+
+    (while (and (< (point) end)
+               (setq ss-found
+                     (search-forward-regexp c-anchored-cpp-prefix end 'bound)))
+      (goto-char (match-beginning 1))
+      (setq m-beg (point))
+      (c-end-of-macro))
+    (if (and ss-found (> (point) end))
+       (c-clear-char-property-with-value m-beg (point) 'syntax-table '(1)))
 
-    (goto-char end)
     (while (and (< (point) c-new-END)
-               (search-forward-regexp c-anchored-cpp-prefix c-new-END t))
+               (search-forward-regexp c-anchored-cpp-prefix c-new-END 'bound))
       (goto-char (match-beginning 1))
-      (let ((m-beg (point)))
-       (c-end-of-macro)
-       (c-clear-char-property-with-value
-        m-beg (min (point) c-new-END) 'syntax-table '(1))))))
+      (setq m-beg (point))
+      (c-end-of-macro)
+      (c-clear-char-property-with-value
+       m-beg (point) 'syntax-table '(1)))))
 
 (defun c-extend-region-for-CPP (beg end)
   ;; Adjust `c-new-BEG', `c-new-END' respectively to the beginning and end of



reply via email to

[Prev in Thread] Current Thread [Next in Thread]