]> git.eshelyaron.com Git - emacs.git/commitdiff
; Improve documentation of incf and decf
authorStefan Kangas <stefankangas@gmail.com>
Wed, 19 Mar 2025 20:24:56 +0000 (21:24 +0100)
committerEshel Yaron <me@eshelyaron.com>
Sun, 23 Mar 2025 18:09:02 +0000 (19:09 +0100)
* doc/lispref/variables.texi (Setting Generalized Variables): Mention
incf and decf.
* lisp/emacs-lisp/gv.el (incf, decf): Add references to Info manual
documentation on generalized variables.

(cherry picked from commit 03053baebee8a89f1b1d470a6173b9f1e80f0b39)

doc/lispref/variables.texi
lisp/emacs-lisp/gv.el

index 75042237ab237ad891e9625af7553e48d3839bb3..209b2b92c5f2f0c1801ba1817683f610ab1fcec5 100644 (file)
@@ -2920,6 +2920,10 @@ the list stored in @var{place}.  It is analogous to @code{(setf
 subforms.  Note that @code{push} and @code{pop} on an @code{nthcdr}
 place can be used to insert or delete at any position in a list.
 
+Similarly, the macros @code{incf} and @code{decf} (@pxref{Arithmetic
+Operations}) can be used to increment or decrement generalized
+variables that are numbers.
+
 The @file{cl-lib} library defines various extensions for generalized
 variables, including additional @code{setf} places.
 @xref{Generalized Variables,,, cl, Common Lisp Extensions}.
index a12fd16664457bbfababa6074cd8e6b042a9ee79..d133dd0e42688079162cd388898291f79d9aeb38 100644 (file)
@@ -317,11 +317,14 @@ The return value is the last VAL in the list.
 
 ;;;###autoload
 (defmacro incf (place &optional delta)
-  "Increment PLACE by DELTA (default to 1).
+  "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
@@ -329,11 +332,14 @@ See also `decf'."
 
 ;;;###autoload
 (defmacro decf (place &optional delta)
-  "Decrement PLACE by DELTA (default to 1).
+  "Decrement generalized variable PLACE by DELTA (default to 1).
 
 The DELTA is first subtracted from PLACE, and then stored in PLACE.
 Return the decremented value of PLACE.
 
+For more information about generalized variables, see Info node
+`(elisp) Generalized Variables'.
+
 See also `incf'."
   (declare (debug (gv-place &optional form)))
   (gv-letplace (getter setter) place