emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] Changes to emacs/lisp/progmodes/cc-defs.el, v [EMACS_22_BA


From: Alan Mackenzie
Subject: [Emacs-diffs] Changes to emacs/lisp/progmodes/cc-defs.el, v [EMACS_22_BASE]
Date: Tue, 19 Feb 2008 22:07:34 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Branch:         EMACS_22_BASE
Changes by:     Alan Mackenzie <acmacm> 08/02/19 22:07:34

Index: cc-defs.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/progmodes/cc-defs.el,v
retrieving revision 1.48.2.5
retrieving revision 1.48.2.6
diff -u -b -r1.48.2.5 -r1.48.2.6
--- cc-defs.el  5 Feb 2008 14:18:48 -0000       1.48.2.5
+++ cc-defs.el  19 Feb 2008 22:07:33 -0000      1.48.2.6
@@ -1028,6 +1028,39 @@
     ;; Emacs.
     `(remove-text-properties ,from ,to '(,property nil))))
 
+(defun c-clear-char-property-with-value-function (from to property value)
+  "Remove all text-properties PROPERTY from the region (FROM, TO)
+which have the value VALUE, as tested by `equal'.  These
+properties are assumed to be over individual characters, having
+been put there by c-put-char-property.  POINT remains unchanged."
+  (let ((place from) end-place)
+    (while                       ; loop round occurrances of (PROPERTY VALUE)
+       (progn
+         (while           ; loop round changes in PROPERTY till we find VALUE
+             (and
+              (< place to)
+              (not (equal (get-text-property place property) value)))
+           (setq place (next-single-property-change place property nil to)))
+         (< place to))
+      (setq end-place (next-single-property-change place property nil to))
+      (put-text-property place end-place property nil)
+      ;; Do we have to do anything with stickiness here?
+      (setq place end-place))))
+
+(defmacro c-clear-char-property-with-value (from to property value)
+  "Remove all text-properties PROPERTY from the region [FROM, TO)
+which have the value VALUE, as tested by `equal'.  These
+properties are assumed to be over individual characters, having
+been put there by c-put-char-property.  POINT remains unchanged."
+  (if c-use-extents
+    ;; XEmacs
+      `(let ((-property- ,property))
+        (map-extents (lambda (ext val)
+                       (if (equal (extent-property ext -property-) val)
+                           (delete-extent ext)))
+                     nil ,from ,to ,value nil -property-))
+  ;; Gnu Emacs
+    `(c-clear-char-property-with-value-function ,from ,to ,property ,value)))
 
 ;; Macros to put overlays (Emacs) or extents (XEmacs) on buffer text.
 ;; For our purposes, these are characterized by being possible to




reply via email to

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