Function: c-put-char-properties-on-char

c-put-char-properties-on-char is a macro defined in cc-defs.el.gz.

Signature

(c-put-char-properties-on-char FROM TO PROPERTY VALUE CHAR)

Documentation

Put the text property PROPERTY with value VALUE on characters with value CHAR in the region [FROM to). Return the position of the first char changed, if any, else nil.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/cc-defs.el.gz
(defmacro c-put-char-properties-on-char (from to property value char)
  ;; This needs to be a macro because `property' passed to
  ;; `c-put-char-property' must be a constant.
  "Put the text property PROPERTY with value VALUE on characters
with value CHAR in the region [FROM to).  Return the position of the
first char changed, if any, else nil."
  (declare (debug t))
  `(let ((skip-string (concat "^" (list ,char)))
	 (-to- ,to)
	 first)
     (save-excursion
       (goto-char ,from)
       (while (progn (skip-chars-forward skip-string -to-)
		     (< (point) -to-))
	 ,@(when (and (fboundp 'syntax-ppss)
		      (eq (eval property) 'syntax-table))
	     `((setq c-syntax-table-hwm (min c-syntax-table-hwm (point)))))
	 (c-put-char-property (point) ,property ,value)
	 (when (not first) (setq first (point)))
	 (forward-char)))
     first))