Function: cl-incf

cl-incf is an autoloaded macro defined in cl-lib.el.gz.

Signature

(cl-incf PLACE &optional X)

Documentation

Increment PLACE by X (1 by default).

PLACE may be a symbol, or any generalized variable allowed by setf. The return value is the incremented value of PLACE.

Aliases

incf (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/cl-lib.el.gz
;;; Generalized variables.
;; These macros are defined here so that they
;; can safely be used in init files.

;;;###autoload
(defmacro cl-incf (place &optional x)
  "Increment PLACE by X (1 by default).
PLACE may be a symbol, or any generalized variable allowed by `setf'.
The return value is the incremented value of PLACE."
  (declare (debug (place &optional form)))
  (if (symbolp place)
      (list 'setq place (if x (list '+ place x) (list '1+ place)))
    (list 'cl-callf '+ place (or x 1))))