all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: "Mattias Engdegård" <mattiase@acm.org>,
	"Emacs developers" <emacs-devel@gnu.org>
Subject: Re: master a6b5985: Avoid duplicated character classes in rx
Date: Tue, 03 Dec 2019 10:26:51 -0500	[thread overview]
Message-ID: <jwvblspa0v2.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <CAAeL0SStbE94P1S6FMt65Bv9Un8pfQOFePVB2T5QdWcy5SoUuA@mail.gmail.com> (Juanma Barranquero's message of "Tue, 3 Dec 2019 16:08:23 +0100")

>>              ((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?

I'd rather fix the code not to rely on the return value.
E.g.

                 ((and (symbolp arg)
                       (let ((class (cdr (assq arg rx--char-classes))))
    -                    (and class (push class classes)))))
    +                    (and class
    +                         (progn (cl-pushnew class classes) t))))


-- Stefan




  reply	other threads:[~2019-12-03 15:26 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191203142243.9552.27513@vcs0.savannah.gnu.org>
     [not found] ` <20191203142246.0615C20A2B@vcs0.savannah.gnu.org>
2019-12-03 15:08   ` master a6b5985: Avoid duplicated character classes in rx Juanma Barranquero
2019-12-03 15:26     ` Stefan Monnier [this message]
2019-12-03 15:33       ` Mattias Engdegård
2019-12-03 16:01         ` Stefan Monnier
2019-12-03 16:06           ` Juanma Barranquero
2019-12-03 17:37             ` Eli Zaretskii
2019-12-03 17:46               ` Juanma Barranquero
2019-12-03 18:34                 ` Stefan Monnier
2019-12-03 18:12               ` Drew Adams
2019-12-03 17:39             ` Stefan Monnier
2019-12-03 17:51               ` Juanma Barranquero
2019-12-03 18:36                 ` Stefan Monnier
2019-12-03 18:43                   ` Juanma Barranquero
2019-12-04  4:36             ` Richard Stallman
2019-12-04  5:38               ` Juanma Barranquero
2019-12-03 19:20           ` Michael Welsh Duggan
2019-12-03 20:21             ` Stefan Monnier
2019-12-04 11:22           ` Mattias Engdegård
2019-12-06 18:49           ` Juanma Barranquero
2019-12-06 19:45             ` Drew Adams
2019-12-06 20:11               ` Juanma Barranquero
2019-12-10  3:27                 ` Adam Porter
2019-12-10  4:13                   ` Stefan Monnier
2019-12-10  4:20                     ` Adam Porter
2019-12-10  6:09                       ` Juanma Barranquero
2019-12-10  6:32                   ` Juanma Barranquero
2019-12-06 19:46             ` Eli Zaretskii
2019-12-07  4:48             ` Richard Stallman
2019-12-07  5:45               ` Juanma Barranquero
2019-12-07 15:18                 ` Drew Adams
2019-12-08  5:13                 ` Richard Stallman
2019-12-03 17:39         ` Drew Adams
2019-12-03 15:36       ` Juanma Barranquero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvblspa0v2.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=lekktu@gmail.com \
    --cc=mattiase@acm.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.