emacs-devel
[Top][All Lists]
Advanced

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

Re: master a6b5985: Avoid duplicated character classes in rx


From: Juanma Barranquero
Subject: Re: master a6b5985: Avoid duplicated character classes in rx
Date: Tue, 3 Dec 2019 16:08:23 +0100

On Tue, Dec 3, 2019 at 3:23 PM Mattias Engdegård <address@hidden> wrote:

>              ((and (symbolp arg)
>                    (let ((class (cdr (assq arg rx--char-classes))))
> -                    (and class (push class classes)))))
> +                    (and class
> +                         (or (memq class classes)
> +                             (push class classes))))))

This (which is a branch of a `cond') relies in the fact that (push ELEMENT LISTNAME)
returns the new LISTNAME.

Which isn't really documented. It's sort-of-documented because push's docstring
says that it is "morally equivalent to (setf place (cons newelt place)", and the
elisp manual says that it is "equivalent to (setq ...)" or that it "does the
equivalent of (setf ...)".

Shouldn't we say it in its docstring?

(BTW, push's args are called ELEMENT and LISTNAME in the manual, NEWELT and PLACE
in the code. Frankly, I think they should be ELEMENT and PLACE in both cases.)


reply via email to

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