aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2016-08-09 10:23:31 +0000
committerAlan Mackenzie2016-08-09 10:23:31 +0000
commit8b789c8cfeaee074f581e10009d781b52bf45c81 (patch)
treef3eac38c05e10c9a2713fe6bb7c06219380779f4
parent5126b7d6c201f95fde0d817a64620d152c1c15e1 (diff)
downloademacs-8b789c8cfeaee074f581e10009d781b52bf45c81.tar.gz
emacs-8b789c8cfeaee074f581e10009d781b52bf45c81.zip
Make c-deprepertize-CPP work on deletion/insertion of "s. Fixes bug #24132.
* lisp/progmodes/cc-mode.el (c-depropertize-CPP): Rewrite function.
-rw-r--r--lisp/progmodes/cc-mode.el31
1 files changed, 19 insertions, 12 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 04d2ed6e8d5..8d75eea4da7 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."
892 ;; This function is in the C/C++/ObjC values of 892 ;; This function is in the C/C++/ObjC values of
893 ;; `c-get-state-before-change-functions' and is called exclusively as a 893 ;; `c-get-state-before-change-functions' and is called exclusively as a
894 ;; before change function. 894 ;; before change function.
895 (c-save-buffer-state () 895 (c-save-buffer-state (m-beg ss-found)
896 (goto-char c-new-BEG) 896 (goto-char c-new-BEG)
897 (while (and (< (point) beg) 897 (while (and (< (point) beg)
898 (search-forward-regexp c-anchored-cpp-prefix beg t)) 898 (search-forward-regexp c-anchored-cpp-prefix beg 'bound))
899 (goto-char (match-beginning 1)) 899 (goto-char (match-beginning 1))
900 (let ((m-beg (point))) 900 (setq m-beg (point))
901 (c-end-of-macro) 901 (c-end-of-macro)
902 (c-clear-char-property-with-value 902 (c-clear-char-property-with-value m-beg (point) 'syntax-table '(1)))
903 m-beg (min (point) beg) 'syntax-table '(1)))) 903
904 (while (and (< (point) end)
905 (setq ss-found
906 (search-forward-regexp c-anchored-cpp-prefix end 'bound)))
907 (goto-char (match-beginning 1))
908 (setq m-beg (point))
909 (c-end-of-macro))
910 (if (and ss-found (> (point) end))
911 (c-clear-char-property-with-value m-beg (point) 'syntax-table '(1)))
904 912
905 (goto-char end)
906 (while (and (< (point) c-new-END) 913 (while (and (< (point) c-new-END)
907 (search-forward-regexp c-anchored-cpp-prefix c-new-END t)) 914 (search-forward-regexp c-anchored-cpp-prefix c-new-END 'bound))
908 (goto-char (match-beginning 1)) 915 (goto-char (match-beginning 1))
909 (let ((m-beg (point))) 916 (setq m-beg (point))
910 (c-end-of-macro) 917 (c-end-of-macro)
911 (c-clear-char-property-with-value 918 (c-clear-char-property-with-value
912 m-beg (min (point) c-new-END) 'syntax-table '(1)))))) 919 m-beg (point) 'syntax-table '(1)))))
913 920
914(defun c-extend-region-for-CPP (beg end) 921(defun c-extend-region-for-CPP (beg end)
915 ;; Adjust `c-new-BEG', `c-new-END' respectively to the beginning and end of 922 ;; Adjust `c-new-BEG', `c-new-END' respectively to the beginning and end of