diff options
| -rw-r--r-- | lisp/progmodes/cc-defs.el | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index b509fdd7cc2..588e7c3428e 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el | |||
| @@ -1028,6 +1028,39 @@ MODE is either a mode symbol or a list of mode symbols." | |||
| 1028 | ;; Emacs. | 1028 | ;; Emacs. |
| 1029 | `(remove-text-properties ,from ,to '(,property nil)))) | 1029 | `(remove-text-properties ,from ,to '(,property nil)))) |
| 1030 | 1030 | ||
| 1031 | (defun c-clear-char-property-with-value-function (from to property value) | ||
| 1032 | "Remove all text-properties PROPERTY from the region (FROM, TO) | ||
| 1033 | which have the value VALUE, as tested by `equal'. These | ||
| 1034 | properties are assumed to be over individual characters, having | ||
| 1035 | been put there by c-put-char-property. POINT remains unchanged." | ||
| 1036 | (let ((place from) end-place) | ||
| 1037 | (while ; loop round occurrances of (PROPERTY VALUE) | ||
| 1038 | (progn | ||
| 1039 | (while ; loop round changes in PROPERTY till we find VALUE | ||
| 1040 | (and | ||
| 1041 | (< place to) | ||
| 1042 | (not (equal (get-text-property place property) value))) | ||
| 1043 | (setq place (next-single-property-change place property nil to))) | ||
| 1044 | (< place to)) | ||
| 1045 | (setq end-place (next-single-property-change place property nil to)) | ||
| 1046 | (put-text-property place end-place property nil) | ||
| 1047 | ;; Do we have to do anything with stickiness here? | ||
| 1048 | (setq place end-place)))) | ||
| 1049 | |||
| 1050 | (defmacro c-clear-char-property-with-value (from to property value) | ||
| 1051 | "Remove all text-properties PROPERTY from the region [FROM, TO) | ||
| 1052 | which have the value VALUE, as tested by `equal'. These | ||
| 1053 | properties are assumed to be over individual characters, having | ||
| 1054 | been put there by c-put-char-property. POINT remains unchanged." | ||
| 1055 | (if c-use-extents | ||
| 1056 | ;; XEmacs | ||
| 1057 | `(let ((-property- ,property)) | ||
| 1058 | (map-extents (lambda (ext val) | ||
| 1059 | (if (equal (extent-property ext -property-) val) | ||
| 1060 | (delete-extent ext))) | ||
| 1061 | nil ,from ,to ,value nil -property-)) | ||
| 1062 | ;; Gnu Emacs | ||
| 1063 | `(c-clear-char-property-with-value-function ,from ,to ,property ,value))) | ||
| 1031 | 1064 | ||
| 1032 | ;; Macros to put overlays (Emacs) or extents (XEmacs) on buffer text. | 1065 | ;; Macros to put overlays (Emacs) or extents (XEmacs) on buffer text. |
| 1033 | ;; For our purposes, these are characterized by being possible to | 1066 | ;; For our purposes, these are characterized by being possible to |