From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: master a6b5985: Avoid duplicated character classes in rx Date: Tue, 03 Dec 2019 10:26:51 -0500 Message-ID: References: <20191203142243.9552.27513@vcs0.savannah.gnu.org> <20191203142246.0615C20A2B@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="40696"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Mattias =?windows-1252?Q?Engd?= =?windows-1252?Q?eg=E5rd?= , Emacs developers To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 03 16:57:52 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1icAYf-000ANZ-AW for ged-emacs-devel@m.gmane.org; Tue, 03 Dec 2019 16:57:49 +0100 Original-Received: from localhost ([::1]:55416 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icAYb-0001QQ-2s for ged-emacs-devel@m.gmane.org; Tue, 03 Dec 2019 10:57:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39751) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icA4v-00088s-A9 for emacs-devel@gnu.org; Tue, 03 Dec 2019 10:27:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icA4q-0005Xu-Up for emacs-devel@gnu.org; Tue, 03 Dec 2019 10:27:01 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:59422) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1icA4p-0005G6-Lw for emacs-devel@gnu.org; Tue, 03 Dec 2019 10:27:00 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2D09281895; Tue, 3 Dec 2019 10:26:55 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2CB9481E29; Tue, 3 Dec 2019 10:26:53 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1575386813; bh=cRlWtbM9UFOE0j1eeLUyNzAyXP5kW9Ob7nOG4jKC5FU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=CZOnFDh7+3MLYTzANclAZFdEWAWWoaoKEbfVx5xIBQ47kiKoPi1jPssXvuQkSn6w+ 9+auRDXniW4miutw0Q2AehKnRkh76ySAuMNtwaqh0bAmvUeKZzNmqdRRrOLvwP6ley TxGz9e055aZJMXdqMbuhQYAszcpBd2gkzu2BCGjAQp0HGQkfE5yJRROFJRtaihOYLR G6AKbcKAN8bDW6S9cgDNaM+EJXX3rPg2NDHUhApXGVaDJrDowKKwClHhKVQWSxtFbc ym9gjQKp0NhX4UZkxJhGRSk/7whefY4aGxzxeAauSSHyKcSGstiGhZBD/RZ2RoVZdP Fn+w27/lE856g== Original-Received: from pastel (unknown [45.72.228.205]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id D550B120516; Tue, 3 Dec 2019 10:26:52 -0500 (EST) In-Reply-To: (Juanma Barranquero's message of "Tue, 3 Dec 2019 16:08:23 +0100") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 132.204.25.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:243049 Archived-At: >> ((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