bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31715: cl-incf and cl-decf error out when passed a nil-valued variab


From: Clément Pit-Claudel
Subject: bug#31715: cl-incf and cl-decf error out when passed a nil-valued variable as 'offset'
Date: Mon, 4 Jun 2018 16:06:55 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

Hi all,

The following works:
  (let ((x 1)) (cl-incf x nil))

… but following raises "setq: Wrong type argument: number-or-marker-p, nil":
  (let ((x 1) (y nil)) (cl-incf x y))

… yet the docs say this, which suggests that both should work:
  (cl-incf PLACE &optional X)
  Increment PLACE by X (1 by default).

The issue comes from the expansion of cl-incf:

    (defmacro cl-incf (place &optional x) …
      (if (symbolp place)
          (list 'setq place (if x (list '+ place x) (list '1+ place)))
        (list 'cl-callf '+ place (or x 1))))

Shouldn't that `if x' check be quoted?  Same for the second branch of the if 
(shouldn't the `(or x 1)' part be quoted, too?)

cl-decf has the same issue.  Am I missing something?

Clément.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]