Function: c-clear-char-property-with-value

c-clear-char-property-with-value is a macro defined in cc-defs.el.gz.

Signature

(c-clear-char-property-with-value FROM TO PROPERTY VALUE)

Documentation

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. Return the position of the first removed property, or nil.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-defs.el.gz
(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.
Return the position of the first removed property, or nil."
  (declare (debug t))
  (if c-use-extents
    ;; XEmacs
      `(let ((-property- ,property)
	     (first (1+ (point-max))))
	 (map-extents (lambda (ext val)
			;; In the following, the test on the extent's property
			;; is probably redundant.  See documentation of
			;; `map-extents'.  NO it's NOT!  This automatic check
			;; would require another argument to `map-extents',
			;; but the test would use `eq', not `equal', so it's
			;; no good.  :-(
			(when (equal (extent-property ext -property-) val)
			  (setq first (min first
					   (extent-start-position ext)))
			  (delete-extent ext))
			nil)
		      nil ,from ,to ,value nil -property-)
	 (and (<= first (point-max)) first))
    ;; Gnu Emacs
    `(c-clear-char-property-with-value-function ,from ,to ,property ,value)))