Function: incf
incf is an autoloaded macro defined in gv.el.gz.
Signature
(incf PLACE &optional DELTA)
Documentation
Increment generalized variable PLACE by DELTA (default to 1).
The DELTA is first added to PLACE, and then stored in PLACE. Return the incremented value of PLACE.
For more information about generalized variables, see Info node
(elisp) Generalized Variables.
See also decf.
Other relevant functions are documented in the number group.
Probably introduced at or before Emacs version 31.1.
Shortdoc
;; number
(let ((x 2)) (incf x) x)
=> 3
(let ((x 2)) (incf x 2) x)
=> 4
Aliases
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/gv.el.gz
;; (defmacro gv-pushnew! (val place)
;; "Like `gv-push!' but only adds VAL if it's not yet in PLACE.
;; Presence is checked with `member'.
;; The return value is unspecified."
;; (declare (debug (form gv-place)))
;; (macroexp-let2 macroexp-copyable-p v val
;; (gv-letplace (getter setter) place
;; `(if (member ,v ,getter) nil
;; ,(funcall setter `(cons ,v ,getter))))))
;;;###autoload
(defmacro incf (place &optional delta)
"Increment generalized variable PLACE by DELTA (default to 1).
The DELTA is first added to PLACE, and then stored in PLACE.
Return the incremented value of PLACE.
For more information about generalized variables, see Info node
`(elisp) Generalized Variables'.
See also `decf'."
(declare (debug (gv-place &optional form)))
(gv-letplace (getter setter) place
(funcall setter `(+ ,getter ,(or delta 1)))))