Function: format-property-increment-region

format-property-increment-region is a byte-compiled function defined in format.el.gz.

Signature

(format-property-increment-region FROM TO PROP DELTA DEFAULT)

Documentation

In the region from FROM to TO increment property PROP by amount DELTA.

DELTA may be negative. If property PROP is nil anywhere in the region, it is treated as though it were DEFAULT.

Source Code

;; Defined in /usr/src/emacs/lisp/format.el.gz
;; This should probably go somewhere other than format.el.  Then again,
;; indent.el has alter-text-property.  NOTE: We can also use
;; next-single-property-change instead of text-property-not-all, but then
;; we have to see if we passed TO.
(defun format-property-increment-region (from to prop delta default)
  "In the region from FROM to TO increment property PROP by amount DELTA.
DELTA may be negative.  If property PROP is nil anywhere
in the region, it is treated as though it were DEFAULT."
  (let ((cur from) val newval next)
    (while cur
      (setq val    (get-text-property cur prop)
	    newval (+ (or val default) delta)
	    next   (text-property-not-all cur to prop val))
      (put-text-property cur (or next to) prop newval)
      (setq cur next))))