comparison lisp/progmodes/cc-defs.el @ 107937:18526db8f26d

Reverse change 99448: "Change strategy for marking < and > as template delimiters: mark them strictly in matching pairs."
author Alan Mackenzie <acm@muc.de>
date Mon, 12 Apr 2010 15:15:07 +0000
parents 1786f2e6a856
children 1a9d5fee61d1
comparison
equal deleted inserted replaced
107936:10f6e25f2e26 107937:18526db8f26d
1027 (delete-extent ext)) 1027 (delete-extent ext))
1028 nil ,from ,to nil nil ',property) 1028 nil ,from ,to nil nil ',property)
1029 ;; Emacs. 1029 ;; Emacs.
1030 `(remove-text-properties ,from ,to '(,property nil)))) 1030 `(remove-text-properties ,from ,to '(,property nil))))
1031 1031
1032 (defmacro c-search-forward-char-property (property value &optional limit)
1033 "Search forward for a text-property PROPERTY having value VALUE.
1034 LIMIT bounds the search. The comparison is done with `equal'.
1035
1036 Leave point just after the character, and set the match data on
1037 this character, and return point. If VALUE isn't found, Return
1038 nil; point is then left undefined."
1039 `(let ((place (point)))
1040 (while
1041 (and
1042 (< place ,(or limit '(point-max)))
1043 (not (equal (get-text-property place ,property) ,value)))
1044 (setq place (next-single-property-change
1045 place ,property nil ,(or limit '(point-max)))))
1046 (when (< place ,(or limit '(point-max)))
1047 (goto-char place)
1048 (search-forward-regexp ".") ; to set the match-data.
1049 (point))))
1050
1051 (defmacro c-search-backward-char-property (property value &optional limit)
1052 "Search backward for a text-property PROPERTY having value VALUE.
1053 LIMIT bounds the search. The comparison is done with `equal'.
1054
1055 Leave point just before the character, set the match data on this
1056 character, and return point. If VALUE isn't found, Return nil;
1057 point is then left undefined."
1058 `(let ((place (point)))
1059 (while
1060 (and
1061 (> place ,(or limit '(point-min)))
1062 (not (equal (get-text-property (1- place) ,property) ,value)))
1063 (setq place (previous-single-property-change
1064 place ,property nil ,(or limit '(point-min)))))
1065 (when (> place ,(or limit '(point-max)))
1066 (goto-char place)
1067 (search-backward-regexp ".") ; to set the match-data.
1068 (point))))
1069
1070 (defun c-clear-char-property-with-value-function (from to property value) 1032 (defun c-clear-char-property-with-value-function (from to property value)
1071 "Remove all text-properties PROPERTY from the region (FROM, TO) 1033 "Remove all text-properties PROPERTY from the region (FROM, TO)
1072 which have the value VALUE, as tested by `equal'. These 1034 which have the value VALUE, as tested by `equal'. These
1073 properties are assumed to be over individual characters, having 1035 properties are assumed to be over individual characters, having
1074 been put there by c-put-char-property. POINT remains unchanged." 1036 been put there by c-put-char-property. POINT remains unchanged."