From unknown Mon Jun 16 23:57:26 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#75170 <75170@debbugs.gnu.org> To: bug#75170 <75170@debbugs.gnu.org> Subject: Status: add-to-alist: new function Reply-To: bug#75170 <75170@debbugs.gnu.org> Date: Tue, 17 Jun 2025 06:57:26 +0000 retitle 75170 add-to-alist: new function reassign 75170 emacs submitter 75170 Roland Winkler severity 75170 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 29 00:34:08 2024 Received: (at submit) by debbugs.gnu.org; 29 Dec 2024 05:34:08 +0000 Received: from localhost ([127.0.0.1]:53463 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRlwF-0001nD-Oj for submit@debbugs.gnu.org; Sun, 29 Dec 2024 00:34:08 -0500 Received: from lists.gnu.org ([209.51.188.17]:35900) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRlwD-0001n3-FV for submit@debbugs.gnu.org; Sun, 29 Dec 2024 00:34:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRlwC-0003Zn-LR for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 00:34:04 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRlwC-0003Hh-7K for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 00:34:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=t1mkyvGNBr0B1s1A4AmENN7//+icAfreDWlg1cNx7Js=; b=pVjH/oGgC9MBDd 3ci7q7ka+4n9bmJi1p4ydW90d4GOU8vDHN2A98IDIzQEsKCm84e3B0lAMB19dqJ93whf+awNJI3Uv RrHUjTxTaj/QqzPZDxcqpvlvu7DCjY4eD0YzNT59cMxvEKiv9/nflsth/0W9n2jPHIcjGu274bfJQ K8qIwrd1bNXkzJ2gYJtGhlcvoPIq22BKiNwKyfgkCIGhvlrHoddqnZ2i1/E+4QmGXulE087Dghjen DkCU5x0A2uvjnc0OT/kGgzMYavHT+rDg2TOLl/CCGITTpZ8a/Z7RvkR86rswmUkcToY3EHvtoPGRp HcLp8lcox2M/1zbAPw0w==; From: Roland Winkler To: bug-gnu-emacs@gnu.org Subject: Re: add-to-alist: new function Date: Sat, 28 Dec 2024 23:33:56 -0600 Message-ID: <878qrzm4sb.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Mon, 12 Feb 2001, Stephen Gildea wrote: > Here's a handy function I'd like to see added to Emacs 21: add-to-alist. > It is like add-to-list, but it looks only at the cars of the element to > be added and the existing list elements when considering a match. An > additional optional argument to add-to-alist says what to do if the car > matches but the cdr does not. > > I use this function in my .emacs to update values in alists such as > default-frame-alist and auto-mode-alist; I'm sure it has other uses. > My goal in proposing this function is to allow .emacs files to be > shorter and easier to write. The functions add-to-list and add-hook > were important steps in that direction; here is another such step. > > > (defun add-to-alist (alist-var elt-cons &optional no-replace) > "Add to the value of ALIST-VAR an element ELT-CONS if it isn't there yet. > If an element with the same car as the car of ELT-CONS is already present, > replace it with ELT-CONS unless NO-REPLACE is non-nil; if a matching > element is not already present, add ELT-CONS to the front of the alist. > The test for presence of the car of ELT-CONS is done with `equal'." > (let ((existing-element (assoc (car elt-cons) (symbol-value alist-var)))) > (if existing-element > (or no-replace > (rplacd existing-element (cdr elt-cons))) > (set alist-var (cons elt-cons (symbol-value alist-var)))))) > > > The no-replace argument is useful for setting auto-mode-alist when you > don't know whether Emacs supports a particular programming language. > For example, the following suppresses using text-mode for m4 files in > Emacs 19 but doesn't override using m4-mode in Emacs 20. > > (setq default-major-mode 'text-mode) > (add-to-alist 'auto-mode-alist '("\\.m4\\'" . fundamental-mode) t) While I thought about a function add-to-alist I found the above thread from 24 years ago. Stephen's message describes nicely when such a function can be useful. I suggest to add such a function to subr.el. The code below follows the conventions of add-to-list. (defun add-to-alist (alist-var elt-cons &optional no-replace append compare-fn) "Add ELT-CONS to the value of ALIST-VAR if it isn't there yet. If an element with the same car as the car of ELT-CONS is already present in ALIST-VAR, replace it with ELT-CONS unless NO-REPLACE is non-nil. If a matching element is not yet present, add ELT-CONS at the beginning of ALIST-VAR. If APPEND is non-nil, add ELT-CONS at the end of ALIST-VAR. The test for presence of ELT-CONS is done with `equal', or with COMPARE-FN if that's non-nil. ALIST-VAR should not refer to a lexical variable. The return value is the new value of ALIST-VAR." (let ((elt (cond ((or (null compare-fn) (eq compare-fn #'equal)) (assoc (car elt-cons) (symbol-value alist-var))) ((eq compare-fn #'eq) (assq (car elt-cons) (symbol-value alist-var))) (t (let ((alist (symbol-value alist-var)) (key (car elt-cons))) (while (and alist (not (funcall compare-fn key (caar alist)))) (setq alist (cdr alist))) (car alist)))))) (if elt (progn (unless no-replace (setcdr elt (cdr elt-cons))) (symbol-value alist-var)) (set alist-var (if append (append (symbol-value alist-var) (list elt-cons)) (cons elt-cons (symbol-value alist-var))))))) From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 29 01:34:26 2024 Received: (at submit) by debbugs.gnu.org; 29 Dec 2024 06:34:26 +0000 Received: from localhost ([127.0.0.1]:53520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRmsc-0004zN-4R for submit@debbugs.gnu.org; Sun, 29 Dec 2024 01:34:26 -0500 Received: from lists.gnu.org ([209.51.188.17]:50142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRmsZ-0004zE-Ku for submit@debbugs.gnu.org; Sun, 29 Dec 2024 01:34:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRmsY-0004Ld-N0 for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 01:34:23 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRmsY-0007zt-Ex for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 01:34:22 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=n+WTWopX1skhaMAwezbYHD8CgMSYo2Ov79yN2BObDUI=; b=jomJw320dE+0l4YzxAHp suSkPlPljoy0XwDVskzBZ/ce+5pqpe9808OZPYHC6szEeLsmCrqVtht1cG1GEN99OOREraf95Xt9i NX9nIPhreoIeakoLnqdNj4j7aNcYeNFOv5/np+o/h5E87yleYFM61PcjfzZ/1NYGCB/Xn8kw3LxJs nzYShu0GyI99+adMKDD4fxjSkXwn7JfmTl3zwId4EnBmeObbA6eIvZ6+u2UjUb8+OkulWhTb9Rh69 zaNAlBkUaph1HvFDiFkJ/+E7wK3OHlgd5cqJA/pML+RDqPveDv6/z+qI4x2RKj7GItaWHDeEv+C2u floI9ahnlz8REw==; From: Roland Winkler To: bug-gnu-emacs@gnu.org Subject: Re: add-to-alist: new function In-Reply-To: <878qrzm4sb.fsf@gnu.org> (Roland Winkler's message of "Sat, 28 Dec 2024 23:33:56 -0600") References: <878qrzm4sb.fsf@gnu.org> Date: Sun, 29 Dec 2024 00:34:20 -0600 Message-ID: <874j2nm1zn.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Sat, Dec 28 2024, Roland Winkler wrote: > On Mon, 12 Feb 2001, Stephen Gildea wrote: >> Here's a handy function I'd like to see added to Emacs 21: >> add-to-alist. I forgot to say: I could not find any follow-up or discussion of Stephen's proposal https://lists.gnu.org/archive/html/bug-gnu-emacs/2001-02/msg00066.html I know about the very different approaches underlying the function add-to-list compared to the macro pushnew. I followed the design of add-to-list as I am thinking (like Stephen) of similar use cases. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 29 02:33:11 2024 Received: (at 75170) by debbugs.gnu.org; 29 Dec 2024 07:33:11 +0000 Received: from localhost ([127.0.0.1]:53617 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRnnS-00084N-N5 for submit@debbugs.gnu.org; Sun, 29 Dec 2024 02:33:11 -0500 Received: from mail.eshelyaron.com ([107.175.124.16]:55818 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRnnQ-000848-Gq for 75170@debbugs.gnu.org; Sun, 29 Dec 2024 02:33:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1735457588; bh=MJRKQcu3KampE4f/hQoHEtx6jLtAoIWotqV7LJYRZt4=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=PEaBYoayLVsogaq7+ylxDM/Ao0kDIl0uyxbKZlkN5BvlrCdYs4StO2zsYPrdazPUx ksa4Mnn2TXsKblu8FdTTLNUFSGvjiVh3N/QSvIY8QSF9VQHoLXk8mqNkNyIXCZnXIl /BigwDNyW9Pn9KFKr+6fsMxJ0XgDhgKiTy3lz6/kZFOH4XI804V7vG1jxLVZ0Ik6Y6 2lRP8UnPDEZyJ+/B4rJlpnGicrRJReDAWHDspV874t4o6/+PmqhmFVh678zgi4cLyT ao8LNQDMhV4n16sIfQWeFKIa5RFt1xD+G6g70JXDzWQQOUJD5Z8U/bVt4wDsrY4USI qekjUh3PNro3g== From: Eshel Yaron To: Roland Winkler Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <878qrzm4sb.fsf@gnu.org> (Roland Winkler's message of "Sat, 28 Dec 2024 23:33:56 -0600") References: <878qrzm4sb.fsf@gnu.org> X-Hashcash: 1:20:241229:winkler@gnu.org::Kf76vHcV8XLKx52l:1k5s X-Hashcash: 1:20:241229:75170@debbugs.gnu.org::rw+OTBiUW4G9jZkI:2VHG Date: Sun, 29 Dec 2024 08:33:06 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hello, Roland Winkler writes: > On Mon, 12 Feb 2001, Stephen Gildea wrote: [...] > While I thought about a function add-to-alist I found the above thread > from 24 years ago. Stephen's message describes nicely when such a > function can be useful. I suggest to add such a function to subr.el. > > The code below follows the conventions of add-to-list. > > (defun add-to-alist (alist-var elt-cons &optional no-replace append compare-fn) > "Add ELT-CONS to the value of ALIST-VAR if it isn't there yet. > If an element with the same car as the car of ELT-CONS is already present > in ALIST-VAR, replace it with ELT-CONS unless NO-REPLACE is non-nil. > If a matching element is not yet present, add ELT-CONS at the beginning > of ALIST-VAR. If APPEND is non-nil, add ELT-CONS at the end of ALIST-VAR. > The test for presence of ELT-CONS is done with `equal', or with COMPARE-FN > if that's non-nil. > ALIST-VAR should not refer to a lexical variable. > > The return value is the new value of ALIST-VAR." > (let ((elt (cond ((or (null compare-fn) (eq compare-fn #'equal)) > (assoc (car elt-cons) (symbol-value alist-var))) > ((eq compare-fn #'eq) > (assq (car elt-cons) (symbol-value alist-var))) > (t > (let ((alist (symbol-value alist-var)) > (key (car elt-cons))) > (while (and alist > (not (funcall compare-fn key (caar alist)))) > (setq alist (cdr alist))) > (car alist)))))) > (if elt > (progn > (unless no-replace > (setcdr elt (cdr elt-cons))) > (symbol-value alist-var)) > (set alist-var > (if append > (append (symbol-value alist-var) (list elt-cons)) > (cons elt-cons (symbol-value alist-var))))))) FWIW, in my working branch I use alist-set which does something similar, I think: --8<---------------cut here---------------start------------->8--- (defun alist-set (key alist value &optional testfn) "Associate VALUE with KEY in ALIST, comparing keys with TESTFN." (setf (alist-get key alist nil nil testfn) value)) --8<---------------cut here---------------end--------------->8--- Cheers, Eshel From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 29 02:50:14 2024 Received: (at 75170) by debbugs.gnu.org; 29 Dec 2024 07:50:15 +0000 Received: from localhost ([127.0.0.1]:53637 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRo3y-0000T2-GA for submit@debbugs.gnu.org; Sun, 29 Dec 2024 02:50:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:55452) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRo3w-0000Q2-0C for 75170@debbugs.gnu.org; Sun, 29 Dec 2024 02:50:12 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRo3q-0006ih-IA for 75170@debbugs.gnu.org; Sun, 29 Dec 2024 02:50:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=ZZQGGx/Y0r1PegjkG/cNejJ5wVf22mUdBRIYM0gaRBk=; b=CGrE+eaApweK msVoGffc7x9GG+lCMAuR3KyJMtMl1WsLA0rrPeyUcZi4IFOOTwDgZOy2bjPxiJYGUIwPkKu49UhaH X9a6VWxg1kWCj3/jC7EISDsbVlWinss4HsrXaU6kZtcRaylRZhDYdHAtvCJzwxHB6UEUjtUiKlJX4 jFK0IJI7KOIFEjVE76RwHfXGUORCyekdKhvrq3ESyykkre65zJPV0xMuUprl37JRY0DSgcdm4YD/p O19f8ZqLzK4DNHEn3TmNntEwUSp51HjqpbBeXblJJILRwICfWssbznwwOMF9nH0xxg7J85sub1pnB 3pUJDoHUwLtCwnTCgTAXzw==; Date: Sun, 29 Dec 2024 09:50:04 +0200 Message-Id: <86cyhbq66r.fsf@gnu.org> From: Eli Zaretskii To: Roland Winkler In-Reply-To: <878qrzm4sb.fsf@gnu.org> (message from Roland Winkler on Sat, 28 Dec 2024 23:33:56 -0600) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Roland Winkler > Date: Sat, 28 Dec 2024 23:33:56 -0600 > > On Mon, 12 Feb 2001, Stephen Gildea wrote: > > Here's a handy function I'd like to see added to Emacs 21: add-to-alist. > > It is like add-to-list, but it looks only at the cars of the element to > > be added and the existing list elements when considering a match. An > > additional optional argument to add-to-alist says what to do if the car > > matches but the cdr does not. > > > > I use this function in my .emacs to update values in alists such as > > default-frame-alist and auto-mode-alist; I'm sure it has other uses. > > My goal in proposing this function is to allow .emacs files to be > > shorter and easier to write. The functions add-to-list and add-hook > > were important steps in that direction; here is another such step. > > > > > > (defun add-to-alist (alist-var elt-cons &optional no-replace) > > "Add to the value of ALIST-VAR an element ELT-CONS if it isn't there yet. > > If an element with the same car as the car of ELT-CONS is already present, > > replace it with ELT-CONS unless NO-REPLACE is non-nil; if a matching > > element is not already present, add ELT-CONS to the front of the alist. > > The test for presence of the car of ELT-CONS is done with `equal'." > > (let ((existing-element (assoc (car elt-cons) (symbol-value alist-var)))) > > (if existing-element > > (or no-replace > > (rplacd existing-element (cdr elt-cons))) > > (set alist-var (cons elt-cons (symbol-value alist-var)))))) > > > > > > The no-replace argument is useful for setting auto-mode-alist when you > > don't know whether Emacs supports a particular programming language. > > For example, the following suppresses using text-mode for m4 files in > > Emacs 19 but doesn't override using m4-mode in Emacs 20. > > > > (setq default-major-mode 'text-mode) > > (add-to-alist 'auto-mode-alist '("\\.m4\\'" . fundamental-mode) t) > > While I thought about a function add-to-alist I found the above thread > from 24 years ago. Stephen's message describes nicely when such a > function can be useful. I suggest to add such a function to subr.el. > > The code below follows the conventions of add-to-list. > > (defun add-to-alist (alist-var elt-cons &optional no-replace append compare-fn) > "Add ELT-CONS to the value of ALIST-VAR if it isn't there yet. > If an element with the same car as the car of ELT-CONS is already present > in ALIST-VAR, replace it with ELT-CONS unless NO-REPLACE is non-nil. > If a matching element is not yet present, add ELT-CONS at the beginning > of ALIST-VAR. If APPEND is non-nil, add ELT-CONS at the end of ALIST-VAR. > The test for presence of ELT-CONS is done with `equal', or with COMPARE-FN > if that's non-nil. > ALIST-VAR should not refer to a lexical variable. Thanks. What is the advantage of adding this function, given that add-to-list can be used with alists, and given that alist-get can nowadays be used as a generalize variable? From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 29 02:59:09 2024 Received: (at 75170) by debbugs.gnu.org; 29 Dec 2024 07:59:09 +0000 Received: from localhost ([127.0.0.1]:53644 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRoCa-0000nH-Kb for submit@debbugs.gnu.org; Sun, 29 Dec 2024 02:59:08 -0500 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:55083) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRoCY-0000mk-0X for 75170@debbugs.gnu.org; Sun, 29 Dec 2024 02:59:06 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id 7C82340002; Sun, 29 Dec 2024 07:58:36 +0000 (UTC) From: Juri Linkov To: Roland Winkler Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <874j2nm1zn.fsf@gnu.org> (Roland Winkler's message of "Sun, 29 Dec 2024 00:34:20 -0600") Organization: LINKOV.NET References: <878qrzm4sb.fsf@gnu.org> <874j2nm1zn.fsf@gnu.org> Date: Sun, 29 Dec 2024 09:54:02 +0200 Message-ID: <87h66m3ox1.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) >>> Here's a handy function I'd like to see added to Emacs 21: >>> add-to-alist. > > I forgot to say: I could not find any follow-up or discussion of > Stephen's proposal > > https://lists.gnu.org/archive/html/bug-gnu-emacs/2001-02/msg00066.html > > I know about the very different approaches underlying the function > add-to-list compared to the macro pushnew. I followed the design of > add-to-list as I am thinking (like Stephen) of similar use cases. While indeed there were no responses to the original message, other proposed implementations can be found as well, e.g. https://lists.gnu.org/archive/html/bug-gnu-emacs/2002-04/msg00669.html https://lists.gnu.org/archive/html/bug-gnu-emacs/2002-04/msg00671.html Also there are threads discussing 'org--tag-add-to-alist' and 'package--append-to-alist' (renamed from 'package--add-to-alist'). From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 29 09:50:28 2024 Received: (at 75170) by debbugs.gnu.org; 29 Dec 2024 14:50:28 +0000 Received: from localhost ([127.0.0.1]:54329 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRuce-0003kI-0X for submit@debbugs.gnu.org; Sun, 29 Dec 2024 09:50:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57236) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRucb-0003jr-Tp for 75170@debbugs.gnu.org; Sun, 29 Dec 2024 09:50:26 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRucW-00043W-Me for 75170@debbugs.gnu.org; Sun, 29 Dec 2024 09:50:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=LDa1wVBpKOVjTYaVnHqhFtkG5t1mSjTz9ywnxNarvFo=; b=Vd95aIHPNa/5YgcKPr58 QlIRiRUku1AP83qbeUoc9QKuau8rgbgRoSqXlE3y0j3c6/Y8WMHbnXEshNdm9JdMeFVJ4j6VwSMhO dOD7/+pZFPBWx4u6XGJeYuQ1VnYwE+uCcLfyKsv5K7/yOfhpD/ZZlYgZGF0jV0k9UNIRNLaBHwqJV zolSJxgSLEz/iwCak0HpBrfxLAAnrYnrOGuG073dzAPKL2+TindRBjgUUGA1ZqgH4a2OvdQhMhBDs gCsEULMVhVbnzMtcV9d2243BvUhoG1mgfGyxBqHCecTTHlN/LCD5HJr2MCOPsws2fI1q3U7Pj3zHd sHaIl5mMO2j+WA==; From: Roland Winkler To: Eli Zaretskii Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <86cyhbq66r.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 29 Dec 2024 09:50:04 +0200") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> Date: Sun, 29 Dec 2024 08:50:18 -0600 Message-ID: <87zfkelf11.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Sun, Dec 29 2024, Eli Zaretskii wrote: > What is the advantage of adding this function, given that add-to-list > can be used with alists, and given that alist-get can nowadays be used > as a generalize variable? The advantage I see for also having the function add-to-alist is the following: add-to-list checks for the presence of an element in a list. In the case of alists, this means it checks for the presence of associations. You cannot easily modify an existing association with add-to-list. If you have an alist with association (foo . bar) and you call add-to-list with an element (foo . baz), add-to-list will not remove the association (foo . bar), but the alist will then contain both associations. add-to-alist checks for the presence of keys and it makes sure that each key appears only once in an alist. By default, it replaces the value of an existing key. This makes it easy to modify an existing association. Only with the optional arg NO-REPLACE non-nil, it will preserve an existing association. Say, I want in my .emacs file a more complicated association for a key, and I do not get initially what I want. I can call add-to-alist multiple times, till I get what I want. Is there a simple way to accomplish this in other ways (a way that we recommend for users in their init file if they do not want to use customize like me)? Would it make sense to give this functions a different name if more often it may be used to modify existing associations in an alist instead of adding new ones? From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 29 09:54:26 2024 Received: (at 75170) by debbugs.gnu.org; 29 Dec 2024 14:54:26 +0000 Received: from localhost ([127.0.0.1]:54341 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRugU-0003qo-2Q for submit@debbugs.gnu.org; Sun, 29 Dec 2024 09:54:26 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38442) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tRugS-0003qZ-32 for 75170@debbugs.gnu.org; Sun, 29 Dec 2024 09:54:24 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRugL-0004Xm-5s; Sun, 29 Dec 2024 09:54:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=xgO5suy9RsPH5YXpRYbnBamYcyP3IH+aQvLEE4oYZMU=; b=hbqbIx/ErxH9E5ytKKkw v2BxKzPRWriAAHLJJjqIGfcA81uMv/IyYjMLUHwUR8aUkE7WZMMgud4PLirrGlAoc7ClDqGWjv2C0 vWn1os9YOW68T17oQWQB5B4++4UHg00cR9oAhDr6vVuLztckmt8LGL9ObuxVii9NZgF3JnR3lJchg VGGCwaU/860NlWgfClcLvnxFPBEMjVGvO9apio9MuPuGBYJanyc1x6fhSEXEkxvjSObsFfGBvWaaN ka5S6nZX07+cEIyWb54BeReHOyaVvqh6liWcme+fOFHKRcVh8SogYiPkC1TG2lrQ+TIxcSgNHFmvy 6zIEYRsNPb38zQ==; From: Roland Winkler To: Juri Linkov Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87h66m3ox1.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 29 Dec 2024 09:54:02 +0200") References: <878qrzm4sb.fsf@gnu.org> <874j2nm1zn.fsf@gnu.org> <87h66m3ox1.fsf@mail.linkov.net> Date: Sun, 29 Dec 2024 08:54:14 -0600 Message-ID: <87v7v2leuh.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Sun, Dec 29 2024, Juri Linkov wrote: > Also there are threads discussing 'org--tag-add-to-alist' and > 'package--append-to-alist' (renamed from 'package--add-to-alist'). My understanding of these functions is that they serve rather different purposes. They are not intended to be used in user init files. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 01 20:22:59 2025 Received: (at control) by debbugs.gnu.org; 2 Jan 2025 01:22:59 +0000 Received: from localhost ([127.0.0.1]:41088 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tT9vO-0000EA-WE for submit@debbugs.gnu.org; Wed, 01 Jan 2025 20:22:59 -0500 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:58579) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tT9vN-0000Ds-78 for control@debbugs.gnu.org; Wed, 01 Jan 2025 20:22:57 -0500 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-5d414b8af7bso21330145a12.0 for ; Wed, 01 Jan 2025 17:22:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735780976; x=1736385776; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=bmGw02xWkcVY8oK+yI7WvzCwcvB65NsMMUICjFaoh+g=; b=Tf9pq5ABMR2EEUiZjWVi/mHZuUA+RwPiVXNT508MfT75FBEMGh1EclEhphfAlFpqiY uTUxyu0Nwh57DFWuZnJEKDtq2s7pt7RCV4UpadWz91t2Ovz4RxutxxKQc/KnD2MWWGT4 kOvA6gaHFKE9QOmRxBIdRK5iJ/nJHIRS8fJTdUcZjVC8lLJzRCs1z6ls/rYZP2bcVoBE kQKC77a7DP9ucqddCmk7FXYsEiJ366mc6KyfkEKmMJGht8dszVIF4tKqjWt9mpUKTTfT 0Sq/ESD+BcLULY+s8H8xtVpBq84Wfhm5UdpyvKFWY2TbLF3j4zB3vmL89cx3L71Mkt9v I6HA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735780976; x=1736385776; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=bmGw02xWkcVY8oK+yI7WvzCwcvB65NsMMUICjFaoh+g=; b=jEGeu4mM/ZHLtGepYgTTah82vjQ/oM/h8Zz6DnSRhBCXK9gI3KUFVe7o1Gd/c0RFR3 3st6YWn6+31QZuCimocYoqfas/t1aZPn78uPOSpPy0VA3mwt3fXq4eEic61RwUqlSJAI 4mWXee/WWxv+airEhqPYGOGCDeWazvA7k5hbIN01nlCEEpfXVOixnY4wopSikyRiZWbX FavYpVCRg383ohQjyZfDx3Kt8h3KkRlGMzETNLM7ym1GKqGw8hvCpl5pdd5j6UhJ78SN bqZ1v/uhbqM91PaEqnOCmDMoAP2AI2Q0Nff8UUm26lxjfJDS4C1AJ//+9Y4I0tEzCYdq FLFw== X-Gm-Message-State: AOJu0Yxd5hEY2ERzOVTvWRz8+iAlqawOVVlSIf6ObFhJZA7N3C1YLdlO co/sabG9UmcQzU+0qaPU0TA1dTEIzAo7CEQxYqqs7+aO2nO2aZYzc0r4vGgLPYt8slqbuDKJiyj u2eamQNHqJ4PWf9+YJX1cWxeY4WuZN4G9 X-Gm-Gg: ASbGncsJtA688uZU/7KoE5q/FQsJMesTLRjIB6R5r3x/vwM2Uf3ehsBPETZKowioo4t osrQM3VQin0D9vM90LK5ChZ48sFLvHfVPo+j6F2pC X-Google-Smtp-Source: AGHT+IEjRLYLu5E5BGx3ZLTY3oFebuXvylNLeD0okhSp9qjGDg27JU7Zr+uFEX50RYwcpzzGaeX2mc+zwbwV4AWnNns= X-Received: by 2002:a05:6402:321b:b0:5d3:bc56:3b24 with SMTP id 4fb4d7f45d1cf-5d81ddd6558mr44801314a12.4.1735780976025; Wed, 01 Jan 2025 17:22:56 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 1 Jan 2025 19:22:55 -0600 From: Stefan Kangas MIME-Version: 1.0 Date: Wed, 1 Jan 2025 19:22:55 -0600 Message-ID: Subject: control message for bug #75170 To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) severity 75170 wishlist quit From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 05 10:21:10 2025 Received: (at 75170) by debbugs.gnu.org; 5 Jan 2025 15:21:10 +0000 Received: from localhost ([127.0.0.1]:34838 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUSRB-0000y1-IG for submit@debbugs.gnu.org; Sun, 05 Jan 2025 10:21:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44270) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUSRA-0000xp-23 for 75170@debbugs.gnu.org; Sun, 05 Jan 2025 10:21:08 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tUSR4-0002b6-Mn; Sun, 05 Jan 2025 10:21:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=zgB/Xiwfpyx8omjqGO1RwoSFZzfwVBf+H4z931DdQ9w=; b=IPilyqQwVR7X BIZIQtEu0DBmvu5+vMhCwrfieoghQVsy+zTIX8ZL1bHhDro/EMA3m9LNjRLXBKxLED3dbuwWSmqaI tiNDm5SwnzJYwVhIVbrISeaBjtCJtjqXZEjYdituxuKUvP7n3e8dezYFtbn64CPlY1axAapUr5zaV I2kz8l1Jd7Sm9ATEBUzDJZgdiC04nVKDl6HhR6k9HZHUG9ahyl4iLExUkzbw87ImkJ0xZ4+f9ZP0L +JLgxCftgeauiNMGOWFuPp/7wQ1yD3Rvg2LGIgUrMlsZppbg8qNh634XokPsf3XZaiNwg2vzIXHgQ LFnYyrO1DKU0/LEihd8BZw==; Date: Sun, 05 Jan 2025 17:21:00 +0200 Message-Id: <86wmf970df.fsf@gnu.org> From: Eli Zaretskii To: Roland Winkler , Stefan Kangas , Andrea Corallo In-Reply-To: <87zfkelf11.fsf@gnu.org> (message from Roland Winkler on Sun, 29 Dec 2024 08:50:18 -0600) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Roland Winkler > Cc: 75170@debbugs.gnu.org > Date: Sun, 29 Dec 2024 08:50:18 -0600 > > On Sun, Dec 29 2024, Eli Zaretskii wrote: > > What is the advantage of adding this function, given that add-to-list > > can be used with alists, and given that alist-get can nowadays be used > > as a generalize variable? > > The advantage I see for also having the function add-to-alist is the > following: > > add-to-list checks for the presence of an element in a list. In the > case of alists, this means it checks for the presence of associations. > You cannot easily modify an existing association with add-to-list. If > you have an alist with association (foo . bar) and you call add-to-list > with an element (foo . baz), add-to-list will not remove the association > (foo . bar), but the alist will then contain both associations. > > add-to-alist checks for the presence of keys and it makes sure that each > key appears only once in an alist. By default, it replaces the value of > an existing key. This makes it easy to modify an existing association. > Only with the optional arg NO-REPLACE non-nil, it will preserve an > existing association. > > Say, I want in my .emacs file a more complicated association for a key, > and I do not get initially what I want. I can call add-to-alist > multiple times, till I get what I want. > > Is there a simple way to accomplish this in other ways (a way that we > recommend for users in their init file if they do not want to use > customize like me)? > > Would it make sense to give this functions a different name if more > often it may be used to modify existing associations in an alist instead > of adding new ones? Let's hear the other co-maintainers. Stefan and Andrea, WDYT about this? Should we add this function? From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 18 04:33:43 2025 Received: (at 75170) by debbugs.gnu.org; 18 Jan 2025 09:33:43 +0000 Received: from localhost ([127.0.0.1]:40201 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZ5D5-0001dI-2X for submit@debbugs.gnu.org; Sat, 18 Jan 2025 04:33:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:43206) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZ5D2-0001d4-DQ for 75170@debbugs.gnu.org; Sat, 18 Jan 2025 04:33:40 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZ5Cv-000484-7c; Sat, 18 Jan 2025 04:33:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=rK2Dr16jCorUjxGO8r8KZh3pbbhevPdurZUpTO8ZqY8=; b=On3E3NElOkR9 epHjq36SrDqW6ZE+PVNA3Y8k10RkCVThLcpl3wiFQZku2a9r0WHUPhWq+eJzd9I7+JSS8RsRA6RNV VSgcyH91OvtJ6q2dIZ7HCcQbjUH9CK0orHimfy57wFWnARgMak0J92Xa9cyylKN29PcZF8z2IAaxT PosqekRx2S45Nndn+uo5ud6lY36IpT1hWk0qVTfbvwZdHYKmjpkupIj/UrPnVYGUpbQ7+P/XWhLJ8 Pr40HSjhtAUxY4clHi4NEwXL8T0nI3nKUhsR7r3gLqNMVgwxNeJ2EVau3nUQgULtB4C2aq9CjbXvX 0Qq6K3KD5T79EgCEGOxBmg==; Date: Sat, 18 Jan 2025 11:33:28 +0200 Message-Id: <86sepgbh5j.fsf@gnu.org> From: Eli Zaretskii To: stefankangas@gmail.com, acorallo@gnu.org In-Reply-To: <86wmf970df.fsf@gnu.org> (message from Eli Zaretskii on Sun, 05 Jan 2025 17:21:00 +0200) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, winkler@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ping! > Cc: 75170@debbugs.gnu.org > Date: Sun, 05 Jan 2025 17:21:00 +0200 > From: Eli Zaretskii > > > From: Roland Winkler > > Cc: 75170@debbugs.gnu.org > > Date: Sun, 29 Dec 2024 08:50:18 -0600 > > > > On Sun, Dec 29 2024, Eli Zaretskii wrote: > > > What is the advantage of adding this function, given that add-to-list > > > can be used with alists, and given that alist-get can nowadays be used > > > as a generalize variable? > > > > The advantage I see for also having the function add-to-alist is the > > following: > > > > add-to-list checks for the presence of an element in a list. In the > > case of alists, this means it checks for the presence of associations. > > You cannot easily modify an existing association with add-to-list. If > > you have an alist with association (foo . bar) and you call add-to-list > > with an element (foo . baz), add-to-list will not remove the association > > (foo . bar), but the alist will then contain both associations. > > > > add-to-alist checks for the presence of keys and it makes sure that each > > key appears only once in an alist. By default, it replaces the value of > > an existing key. This makes it easy to modify an existing association. > > Only with the optional arg NO-REPLACE non-nil, it will preserve an > > existing association. > > > > Say, I want in my .emacs file a more complicated association for a key, > > and I do not get initially what I want. I can call add-to-alist > > multiple times, till I get what I want. > > > > Is there a simple way to accomplish this in other ways (a way that we > > recommend for users in their init file if they do not want to use > > customize like me)? > > > > Would it make sense to give this functions a different name if more > > often it may be used to modify existing associations in an alist instead > > of adding new ones? > > Let's hear the other co-maintainers. > > Stefan and Andrea, WDYT about this? Should we add this function? > > > > From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 18 21:19:41 2025 Received: (at 75170) by debbugs.gnu.org; 19 Jan 2025 02:19:41 +0000 Received: from localhost ([127.0.0.1]:44332 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZKua-0006oC-U2 for submit@debbugs.gnu.org; Sat, 18 Jan 2025 21:19:41 -0500 Received: from mout.web.de ([212.227.15.3]:48937) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZKuR-0006nj-TH for 75170@debbugs.gnu.org; Sat, 18 Jan 2025 21:19:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1737253165; x=1737857965; i=michael_heerdegen@web.de; bh=kv0vNkviVdRaf3HdDY1yAOGddqcmfTmGqTC14lnKddw=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=mYh/w5trtUMfR5n0E+yqVxogOgGHplSX7kmBQBTuKvn6ljtuQXs1J8IKjJ6beu5V 1mG1atWxatTluSLDkhrySFOQBHB+P6wNK/yUuvQm8G51e1EacyWE6tIsVGcimezh9 iVR5kBvP49euOqQflmcdPwVEmnimXk8wA9+dkgfqdWA2sD3QBFq9P7OqFrZd4Y/+F KO0xCam6my1JHdigxqhsO5W7F8UV1trOF2SCsMKzbUdymiAILLR5UvOsaTFUHLfQ+ psQ3nRTKirr91CjZ0vc2hHhuR7PFprvOfXShONB2bHbC011vF3gjp55wdBTNlZ3i6 tPhGivbPhz+K8CpySQ== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1N1d3k-1tONef1lTk-016HBl; Sun, 19 Jan 2025 03:19:25 +0100 From: Michael Heerdegen To: Roland Winkler Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87zfkelf11.fsf@gnu.org> (Roland Winkler's message of "Sun, 29 Dec 2024 08:50:18 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> Date: Sun, 19 Jan 2025 03:20:42 +0100 Message-ID: <87y0z7r1c5.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:6ndLokPNC8hekMmHxt1CXt+fKvZ1V12l7E2n0TYtjL+CEloBmaJ YRXFPLauFhP3ba0Ggx1Y1OU3zr4Hr03GT6V8yk8yJgzAaSO0T7jS0wKr0nZvwEcgqzSehCW yVODsG1xEO5RYpKB9bAKJnx27Vy3Rb+n6IZT1KviljYk9+7P3tDCclEeWbdAPtxuEn74Flv vAItDLDM3BEl7k5OsPtoQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:rgL1mMHkyLM=;WoRrDLxfWZD3bPlLK/eTqTAC0pL VMht0GSKiNXgknb5dJSyyyapdABR3ykd2eacYqCBwZ3NkKzyzA6NGX4zyyNSX5EAO7MFJ4Isz xW9tP/cCB6j7ANxPlrByJSqiVLbSdazYkt63IzG0og5ahwakDt8vO7WPEVX5LHh3BDFgFD2C0 ZlSwyJeZC3Xm7cGuqLQmQyTiYsZmVep2wZg9VaZwkoSKSrjcigHd7uqIgDG+8p9ZoAToT8dE4 7+uu03Rg7X8FjweK/vcLEVJQp09FIxr1KBvE8Gp6AL6MMM7sxFnHpxEPIy5XHUuHdONKTLlXb 9hXLGb9bSsxGg6V8ee7dgH15miyjSNaLJ2eD8R5yfiNZL90ZITlA2W1fvcGXkPWkbKfoLKy3M 04zzngSs5keuUuZbE2L441VAqqO2e5TA3Y2QAnI9l5pXqO8PWLplYOogP0BDtqWwmOWDhE2l/ /4Ly3iU5DlvlDaZL78tS0VIuwon7JBbrY8okrV7+hK2e1G0oxANblmGVeFDROBwXGSow+bjxG jwaNQXVbanHbxevVsMTb9yarMJm8vn7PIlZm+TzfPTsP6M46i0roDFeaPiG3QwPIzkS9Kww9Q ZR5YW2msWjEBUhJcInRXGBo9ZxYMJ2zj5cGlJFKUqd6wQasVyASQZPqaAiNapF2JK2RvWicdu p1s5zr3mfZ8TYABFdCF7CQIxTH1DT5mcs+EDShYw94vcgC42krOYNHmmyJtXu8QXrr5duJLwi b3KdSIqOUaDbU0sGEwkec53Frl8kAH1L4uvNEI7nYHeNzpLlBo2ns8zP0xXFQM/fuPkpK58UQ bM+0D1WFRadVg+DPH15GtR/8Gg60z5/yYRaxlqIVqGK7/NdUd0yO5iKqgSGNBAViuvEhwUepD +v+nASJOcd+BAZEAFMca9JFNjwaZO29mDss0hiZDZWHWti2g1BXfOfsIjl7RJYrv7hzRc4Y6p ++vCasKHS0Tcz2+H8RiRui2CRECiIsP3sNVJUqacIUXeUUAC9QoyZGKAL/2ctSJpg0b9PRWt6 FMSnjBHV6U5vmwc31n/KBRC7hfORDSx9YCHtOGWgPnaNNZYpz9XD+vvcHfcK7myzjARDJXOFJ U6YoWu7FdajwzxI9fGh9N4c9o4Ykr5mbpSl3E/CN+9+wu9Y3XIhxAGg+VfH/Nipy9gMnkmYRD 1DQZdL8LwOFOQsz0tr83E8uOFqc8i+rM97rfUl6Ikxg== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 75170 Cc: Eli Zaretskii , 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Roland Winkler writes: > Is there a simple way to accomplish this in other ways (a way that we > recommend for users in their init file if they do not want to use > customize like me)? We indeed recommend using (setf (alist-get ...)), IIUC this is _exactly_ what you were looking for. Your patch contains an implementation of the setter of `alist-get', and we would add a duplication. If you did not find this thing, maybe we need to add a hint to some chapter of the manual? Michael. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 01:17:12 2025 Received: (at 75170) by debbugs.gnu.org; 19 Jan 2025 06:17:12 +0000 Received: from localhost ([127.0.0.1]:44573 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZOcR-0001hG-IS for submit@debbugs.gnu.org; Sun, 19 Jan 2025 01:17:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51724) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZOcO-0001gz-MC for 75170@debbugs.gnu.org; Sun, 19 Jan 2025 01:17:09 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZOcI-0006xL-NA; Sun, 19 Jan 2025 01:17:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=YKcSPGRhjCUXB3H5+HmKWygAnk1K6WPu2ZRarXYMWaE=; b=MxXtE/6IPq10+pLkGelN 2xtPRJ6byPq+1d2iXGP2+pD9LDTHYKjTNE9Vl+0EVtY9wapYeEZu2OkoEc3/7nFX89WF7C2WXR3XR YwpUekzaAW0IxHAWFCb8VsNtMTRA0oi7f7bDBXB3tsyoVZnyrhBqXfZSHWksG6nZYzecyuSvjux64 rGcQCJcAzeftrdeCHSHO/A+qj9IyscpuixdrKIWysc0inSn9t3iEPgKHLJjMNbzHLKMHStV1AGu+5 +ZrU6BKxybC45Rb7q21UtbOGyVUZ7Q/3ccdN6wREF1SAzAUZeOGa2Jgf10B1MsfnPYSUtDXEvlofx Rao7m/v4656VBw==; From: Roland Winkler To: Michael Heerdegen Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87y0z7r1c5.fsf@web.de> (Michael Heerdegen's message of "Sun, 19 Jan 2025 03:20:42 +0100") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <87y0z7r1c5.fsf@web.de> Date: Sun, 19 Jan 2025 00:17:01 -0600 Message-ID: <87frlfuy3m.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: Eli Zaretskii , 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Sun, Jan 19 2025, Michael Heerdegen wrote: >> Is there a simple way to accomplish this in other ways (a way that we >> recommend for users in their init file if they do not want to use >> customize like me)? > > We indeed recommend using (setf (alist-get ...)), IIUC this is _exactly_ > what you were looking for. Your patch contains an implementation of the > setter of `alist-get', and we would add a duplication. > > If you did not find this thing, maybe we need to add a hint to some > chapter of the manual? Great! -- It seems, indeed, the code I am looking for does (mostly, see below) exist. But the "We indeed recommend using..." can be improved. It should appear at a spot where not only advanced elisp hackers may have a chance of finding it. But more average users should be able to find it, too (say, as a strategy for modifying alists in the emacs init file). I just noticed: the docstring of alist-get is much more verbose regarding how this function can be combined with setf than the elisp manual. So extending the documentation of alist-get in the elisp manual can already make a big difference! Personally, I always find typical usage examples in the elisp manual most helpful. Actually, I just read the docstring from alist-get a couple of times. And the meaning of the optional arg REMOVE is not clear to me: what is the "new value" of an association if the key is removed from the alist? Also, it seems to me there is a difference between add-to-alist and (setf (alist-get ...)). It was already Stephen Gildea's original proposal from long time ago to give this function an optional arg NO-REPLACE, and his proposal included a nice example for when this can be useful (copied in my first posting). It seems to me that (setf (alist-get ...)) has no equivalent of NO-REPLACE. Personally, I have not run in a situation when I had needed this arg; but I can imagine that it would help others. Roland From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 06:23:25 2025 Received: (at 75170) by debbugs.gnu.org; 19 Jan 2025 11:23:25 +0000 Received: from localhost ([127.0.0.1]:45076 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZTOm-0005xQ-Na for submit@debbugs.gnu.org; Sun, 19 Jan 2025 06:23:25 -0500 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:45336) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tZTOk-0005xC-JH for 75170@debbugs.gnu.org; Sun, 19 Jan 2025 06:23:23 -0500 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5db6890b64eso5924821a12.3 for <75170@debbugs.gnu.org>; Sun, 19 Jan 2025 03:23:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737285796; x=1737890596; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=4K2rUF9h+D2dxhnqX7J2vsr8APj2vis4k3FGxDcos44=; b=jM6psGLayFK19o7RMufB+wbt+1AATMrf8gsk4qYuncMldN/FNbG3HA5XhIjrnm3spG OkcJ/WWI8GWkflPC607iDDoGGn7FcCvLKDB7r7Sy4zc2/ccN+t29YOtywRy9eaTcKoeH PTjNZQea5Q85IiW3Tnev392s8NGjaCn8Omeq23+qlK8H3lqGsG2SRH9/MD2QVIo3BVpa Q14oD5v1U9kxQAIKDjn6PQnuAP2iY8gt073uqR1+zZGJDAJ+AXwobK5ns/2pbrbTFvXe g3FCNWwRrc1kajJjNwJmuU86FtfoQFuQ41k1pOGSgf1MMB8lsbpnK2SDandUcJ7WGiOY XWOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737285796; x=1737890596; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4K2rUF9h+D2dxhnqX7J2vsr8APj2vis4k3FGxDcos44=; b=IdcgrXpXtl4luDtJnoxTMte4kIqWvB7otrU3q4kvQPcN1KedS9gJCwxo4b4UTsa4GD ZtnwQlzySKnx7VLqMNNJuktO1kc70ctxJcDOFnnYXZAgia6XeQ2EN1RzTXxJVwtL1DGv 2hdQ2t0LoghTlSv37PU/UBWGMG9JetK0xs1tbsGzOp6zy+s2wd1ngG67TTPg2ZvWmZnH AfGXihFY8d27lawssB9LwIFdIZS+LdNlMst2Dd6jA6cMEeVUP3sdmsQdo7W8upd0+AuO uaq+29F/jg6Eq8VNW3vA5BPB1uxTCmr40Wqd155r0my/oY5xjAERfREervgynRuiBXFR 51sg== X-Gm-Message-State: AOJu0Yw3Cdu7aSmlWlpbx1QajyuwCXPWZet7MSP+JyKKahlxqi/pj0gq znMAjk6oVqQD6r6juhFWKw6N25/62AypAPiRi3U4wLkc9WoPmWg917fncCTX9/Oz/mLT1SVNI98 CR9XRq6v0I8ejk33LEkL8kqTf7xZKXykI X-Gm-Gg: ASbGncsRCYO5tWPvZvF1zwc0paa5PSgHb43s8QJcLBZDiV8Tbzu5iPHsDbXIFXQYJ7S 2FcKk8nFjfyppsHaoYJ/LNy1tAieuQjL8hXkm4qKOMqjCyiOKl6W6 X-Google-Smtp-Source: AGHT+IHDHEzSZxi9Az7jUV3rm3yihtcn/jl5CgUiJqGFeswO1wxrElmCPlL173RUctCgz9oyeeZJwYkbrwf6x/D085U= X-Received: by 2002:a05:6402:268e:b0:5d3:ce7f:abe4 with SMTP id 4fb4d7f45d1cf-5db7db06dd7mr8269829a12.25.1737285796013; Sun, 19 Jan 2025 03:23:16 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 19 Jan 2025 05:23:15 -0600 From: Stefan Kangas In-Reply-To: <86wmf970df.fsf@gnu.org> References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> MIME-Version: 1.0 Date: Sun, 19 Jan 2025 05:23:15 -0600 X-Gm-Features: AbW1kvbBaW7UV69oxmkNei3-yqCnenFq_Vh3Ou6LflqJ-Pazbyd1Vc-k1zpKFJw Message-ID: Subject: Re: bug#75170: add-to-alist: new function To: Eli Zaretskii , Roland Winkler , Andrea Corallo Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Roland Winkler >> Cc: 75170@debbugs.gnu.org >> Date: Sun, 29 Dec 2024 08:50:18 -0600 >> >> On Sun, Dec 29 2024, Eli Zaretskii wrote: >> > What is the advantage of adding this function, given that add-to-list >> > can be used with alists, and given that alist-get can nowadays be used >> > as a generalize variable? >> >> The advantage I see for also having the function add-to-alist is the >> following: >> >> add-to-list checks for the presence of an element in a list. In the >> case of alists, this means it checks for the presence of associations. >> You cannot easily modify an existing association with add-to-list. If >> you have an alist with association (foo . bar) and you call add-to-list >> with an element (foo . baz), add-to-list will not remove the association >> (foo . bar), but the alist will then contain both associations. >> >> add-to-alist checks for the presence of keys and it makes sure that each >> key appears only once in an alist. By default, it replaces the value of >> an existing key. This makes it easy to modify an existing association. >> Only with the optional arg NO-REPLACE non-nil, it will preserve an >> existing association. >> >> Say, I want in my .emacs file a more complicated association for a key, >> and I do not get initially what I want. I can call add-to-alist >> multiple times, till I get what I want. >> >> Is there a simple way to accomplish this in other ways (a way that we >> recommend for users in their init file if they do not want to use >> customize like me)? >> >> Would it make sense to give this functions a different name if more >> often it may be used to modify existing associations in an alist instead >> of adding new ones? > > Let's hear the other co-maintainers. > > Stefan and Andrea, WDYT about this? Should we add this function? The benefit here is that users could more easily replace associations in alists. Superfluous associations are not the end of the world, as `alist-get' will anyways only get the first one, but users might not know that, and it's less aesthetically pleasing. If Emacs Lisp was just a programming system, then I would be against this addition as redundant. Since a small subset of ELisp is also used as a kind of "customization language", I think it occasionally makes sense to introduce even redundant constructs, provided that it makes said customization easier. I think this might be one such example. On balance, I think we could add it. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 09:34:16 2025 Received: (at 75170) by debbugs.gnu.org; 19 Jan 2025 14:34:16 +0000 Received: from localhost ([127.0.0.1]:45337 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZWNT-0004Q4-Lg for submit@debbugs.gnu.org; Sun, 19 Jan 2025 09:34:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56650) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZWNQ-0004Pl-7Y for 75170@debbugs.gnu.org; Sun, 19 Jan 2025 09:34:13 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZWNK-0005vd-CL; Sun, 19 Jan 2025 09:34:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=AGZebGhbBEItxxHTZBi86N/5i+dWkbhgUEFD9nXPJ2Q=; b=Whn/6SPTP1oSkdHww4IR cz2S6HCUcFg+biaQii1nAVUD4hzmbluvTQeSNE4HL0bgAxO4djIppUa/mWXtwTojCOs+tvTzmH+UY BnrfR59x47TMRqHE1YmyLkd4xw6AVdBYNvvSSr9gI/IqDEUWQ5q1zlb12xT/sToZQsOg7i8IT4pKB 8Jy5kGeZzNc36VSdAS9d0EhpUeeqMmbzE5Mg9ZMVDNU1fdX6xyfJcAu1ElGlmJ1Hyf8xpcZoaPLpV 0X4F3Q0kGJWSR45ZYqSLV/4JOnWsS2JS4w7EhDmGhl2obTMKk0YZLrWicW1hvh59KHQgr1W0yk/j3 XotSRrQoLbB7aw==; From: Roland Winkler To: Michael Heerdegen Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87frlfuy3m.fsf@gnu.org> (Roland Winkler's message of "Sun, 19 Jan 2025 00:17:01 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <87y0z7r1c5.fsf@web.de> <87frlfuy3m.fsf@gnu.org> Date: Sun, 19 Jan 2025 08:34:04 -0600 Message-ID: <87bjw2vpnn.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: Eli Zaretskii , 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Sun, Jan 19 2025, Roland Winkler wrote: > Actually, I just read the docstring from alist-get a couple of times. > And the meaning of the optional arg REMOVE is not clear to me: what is > the "new value" of an association if the key is removed from the alist? I tried to figure out what the optional arg REMOVE is doing in alist-get. While I find the code of add-to-alist not too difficult to grasp at a glance, the optional arg REMOVE is ignored in alist-get. But it is a more complicated call of gv-define-expander in gv.el that seems to define REMOVE. For less advanced users, this may be an extra barrier to put such code into their init file. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 10:07:52 2025 Received: (at 75170) by debbugs.gnu.org; 19 Jan 2025 15:07:52 +0000 Received: from localhost ([127.0.0.1]:47109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZWtz-0006ON-M8 for submit@debbugs.gnu.org; Sun, 19 Jan 2025 10:07:52 -0500 Received: from mout02.posteo.de ([185.67.36.66]:54733) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZWtx-0006O7-5M for 75170@debbugs.gnu.org; Sun, 19 Jan 2025 10:07:49 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 980F1240101 for <75170@debbugs.gnu.org>; Sun, 19 Jan 2025 16:07:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1737299262; bh=wz4gXYwgLe8pGqAO9gVB+e1RCyM2QgDpZ6PvoFujUD4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=I4ssxzMYzPePfCh5VmGHFfx5rgmVr96vTgy6ZvIIgy6B3Qje8HYxmx/Z5aQEkK4qI 0tkd23pCOW3r+OhhkTQPxXKvNrM9l7jndtEvcbHbHsqeWjfDlrBmDM9fwak1pmoFDJ v/Z8Oeu3G+qFkX+ics89WOwYqd7IaxYr/YzLCT5B6ejHnJbJkonnaLU4NLn7p7kXUw kdLSTnnPGpvgcikiXdmYESr09YLSe1+tweupwgaRKKDHnmfINdhEtvmkAyhx4Eo9ak gA8C1lXkG/+Mr1UYNzimlW43DpxC8DGE1IR+BIxrjV9DCpk4kiUPYVmP/s8Wonj6fu FlDeNmquxs3tA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YbcK80qczz6txc; Sun, 19 Jan 2025 16:07:40 +0100 (CET) From: Thierry Volpiatto To: Stefan Kangas Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: (Stefan Kangas's message of "Sun, 19 Jan 2025 05:23:15 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> Date: Sun, 19 Jan 2025 15:14:10 +0000 Message-ID: <87ed0ydef1.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, Eli Zaretskii , Andrea Corallo , Roland Winkler X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Stefan Kangas writes: > Eli Zaretskii writes: > >>> From: Roland Winkler >>> Cc: 75170@debbugs.gnu.org >>> Date: Sun, 29 Dec 2024 08:50:18 -0600 >>> >>> On Sun, Dec 29 2024, Eli Zaretskii wrote: >>> > What is the advantage of adding this function, given that add-to-list >>> > can be used with alists, and given that alist-get can nowadays be used >>> > as a generalize variable? >>> >>> The advantage I see for also having the function add-to-alist is the >>> following: >>> >>> add-to-list checks for the presence of an element in a list. In the >>> case of alists, this means it checks for the presence of associations. >>> You cannot easily modify an existing association with add-to-list. If >>> you have an alist with association (foo . bar) and you call add-to-list >>> with an element (foo . baz), add-to-list will not remove the association >>> (foo . bar), but the alist will then contain both associations. >>> >>> add-to-alist checks for the presence of keys and it makes sure that each >>> key appears only once in an alist. By default, it replaces the value of >>> an existing key. This makes it easy to modify an existing association. >>> Only with the optional arg NO-REPLACE non-nil, it will preserve an >>> existing association. >>> >>> Say, I want in my .emacs file a more complicated association for a key, >>> and I do not get initially what I want. I can call add-to-alist >>> multiple times, till I get what I want. >>> >>> Is there a simple way to accomplish this in other ways (a way that we >>> recommend for users in their init file if they do not want to use >>> customize like me)? >>> >>> Would it make sense to give this functions a different name if more >>> often it may be used to modify existing associations in an alist instead >>> of adding new ones? >> >> Let's hear the other co-maintainers. >> >> Stefan and Andrea, WDYT about this? Should we add this function? > > The benefit here is that users could more easily replace associations in > alists. Superfluous associations are not the end of the world, as > `alist-get' will anyways only get the first one, but users might not > know that, and it's less aesthetically pleasing. > > If Emacs Lisp was just a programming system, then I would be against > this addition as redundant. Since a small subset of ELisp is also used > as a kind of "customization language", I think it occasionally makes > sense to introduce even redundant constructs, provided that it makes > said customization easier. I think this might be one such example. > > On balance, I think we could add it. While you are at it why not implementing a add-to-(a)list function that add/remove an elemnt at INDEX in list? It is what I am providing for my users in Helm. (setq example '((a . 1) (b . 6) (c . 3) (d . 4))) (helm-add-to-list 'example '(b . 2) 1 'replace) =>((a . 1) (b . 2) (c . 3) (d . 4)) -- Thierry From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 14:36:19 2025 Received: (at 75170) by debbugs.gnu.org; 19 Jan 2025 19:36:19 +0000 Received: from localhost ([127.0.0.1]:47496 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZb5m-00054M-SJ for submit@debbugs.gnu.org; Sun, 19 Jan 2025 14:36:19 -0500 Received: from relay8-d.mail.gandi.net ([2001:4b98:dc4:8::228]:50209) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZb5k-000548-NW for 75170@debbugs.gnu.org; Sun, 19 Jan 2025 14:36:17 -0500 Received: by mail.gandi.net (Postfix) with ESMTPSA id 56F901BF204; Sun, 19 Jan 2025 19:36:06 +0000 (UTC) From: Juri Linkov To: Roland Winkler Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87frlfuy3m.fsf@gnu.org> (Roland Winkler's message of "Sun, 19 Jan 2025 00:17:01 -0600") Organization: LINKOV.NET References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <87y0z7r1c5.fsf@web.de> <87frlfuy3m.fsf@gnu.org> Date: Sun, 19 Jan 2025 21:35:00 +0200 Message-ID: <87v7uaa97f.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-GND-Sasl: juri@linkov.net X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 75170 Cc: Michael Heerdegen , Eli Zaretskii , 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > I just noticed: the docstring of alist-get is much more verbose > regarding how this function can be combined with setf than the elisp > manual. So extending the documentation of alist-get in the elisp manual > can already make a big difference! Personally, I always find typical > usage examples in the elisp manual most helpful. One typical usage example: (setf (alist-get 'sentence (alist-get 'c treesit-thing-settings)) '("statement")) that replaces the value of the 'c' -> 'sentence' keys in (setq-local treesit-thing-settings '((c . ((sexp (not "[](),[{}]")) (sentence "\\(?:attributed_statement\\)") (text "\\(?:comment\\|raw_string_literal\\)"))))) > Also, it seems to me there is a difference between add-to-alist and > (setf (alist-get ...)). It was already Stephen Gildea's original > proposal from long time ago to give this function an optional arg > NO-REPLACE, and his proposal included a nice example for when this can > be useful (copied in my first posting). It seems to me that > (setf (alist-get ...)) has no equivalent of NO-REPLACE. Personally, > I have not run in a situation when I had needed this arg; but I can > imagine that it would help others. Isn't NO-REPLACE equivalent to this: (cl-pushnew "statement2" (alist-get 'sentence (alist-get 'c treesit-thing-settings))) that results in ((c (sexp (not "[](),[{}]")) (sentence "statement2" "statement") (text "\\(?:comment\\|raw_string_literal\\)"))) From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 16:18:05 2025 Received: (at 75170) by debbugs.gnu.org; 19 Jan 2025 21:18:05 +0000 Received: from localhost ([127.0.0.1]:47621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZcgG-0004f6-UH for submit@debbugs.gnu.org; Sun, 19 Jan 2025 16:18:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47410) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZcgE-0004eZ-BG for 75170@debbugs.gnu.org; Sun, 19 Jan 2025 16:18:02 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZcg7-0001hy-Vc; Sun, 19 Jan 2025 16:17:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=4Gwu5SietDxNd8UHh6SQ8x4TZSQATiszPWwhS39pI1Q=; b=iVtPnqeg/gYTWgCtogLh x3ylAezhG5/HEL7lc3CcEIosQB2sJf44BF4pj7PtRR04hc0OLsBQO4Ht3z9j9rX/7da0YhiLjvjQx clNviuiu5vEYG9GhKvsf2ezkU791H2wyHmatMT6nsHc6O+RqtM1Cab/vxx6fzljmkmexY3j7Ey4Rm 8Jad9LIs7mzt0D2GMVbo5DaenZRss43EdDKn16pHcyaAleN9wlI7XBtNZejzNMQRsXVBnoKNNyyX3 LL7MytrdL/r3NiQIiOirTF6UhqbZ9lFB22/C1Z9zlza1/VUJzzQN17PXuPRwNkRkgQz9P5JLJEMh8 YObar0tjUhNUYA==; From: Roland Winkler To: Juri Linkov Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87v7uaa97f.fsf@mail.linkov.net> (Juri Linkov's message of "Sun, 19 Jan 2025 21:35:00 +0200") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <87y0z7r1c5.fsf@web.de> <87frlfuy3m.fsf@gnu.org> <87v7uaa97f.fsf@mail.linkov.net> Date: Sun, 19 Jan 2025 15:17:56 -0600 Message-ID: <874j1uv6yj.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: Michael Heerdegen , Eli Zaretskii , 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Sun, Jan 19 2025, Juri Linkov wrote: > Isn't NO-REPLACE equivalent to this: > > (cl-pushnew "statement2" (alist-get 'sentence (alist-get 'c treesit-thing-settings))) > > that results in > > ((c (sexp (not "[](),[{}]")) > (sentence "statement2" "statement") > (text "\\(?:comment\\|raw_string_literal\\)"))) I am not sure how to read the above example. But it seems to me, it is different from what NO-REPLACE does. (Anyway, it is a piece of code that I would not want to suggest to users to put into their init file.) With NO-REPLACE non-nil, add-to-list will add a new association for KEY, if KEY is not yet a key in the alist. But if the alist already contains an association for KEY, this association will not be modified. Stephen's original proposal illustrated how this can be useful in a user's init file in the context of auto-mode-alist: On Mon, 12 Feb 2001, Stephen Gildea wrote: > The no-replace argument is useful for setting auto-mode-alist when you > don't know whether Emacs supports a particular programming language. > For example, the following suppresses using text-mode for m4 files in > Emacs 19 but doesn't override using m4-mode in Emacs 20. > > (setq default-major-mode 'text-mode) > (add-to-alist 'auto-mode-alist '("\\.m4\\'" . fundamental-mode) t) From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 16:21:57 2025 Received: (at 75170) by debbugs.gnu.org; 19 Jan 2025 21:21:57 +0000 Received: from localhost ([127.0.0.1]:47631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZck0-0004r7-WD for submit@debbugs.gnu.org; Sun, 19 Jan 2025 16:21:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46254) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZcjz-0004qs-19 for 75170@debbugs.gnu.org; Sun, 19 Jan 2025 16:21:55 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZcjt-0002FT-C4; Sun, 19 Jan 2025 16:21:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=vJHlXYx5EdUHK2NAQbJc0lpzI4pHnr/XKxqrdM0UcyM=; b=lGbNDtnfM60QqTYUMNUI JTUF3xwJgI4iww6HFH4d+P9Hr3Kq01LiVZJogcKn+8F7hl1npJ5Erhwn1CSPWrJpo6N1O+UYap2gB vTmztSrWFns9sP11aksnxbi2fvdbTJwErH90Sd2XAdBpo6lkYEhcmcYPc5wFDLwPZOozSYyFU5Iwk w/matUTDE43lUgpEsig3RtlnoCa8yiMFSFIWlIauIQgrqCdRFKWjxdtuVAyV/Dl8b0+qn8X1bw5Va f2qO4qWCFcFUC7UTjjuV2jHJEWbrcIQDKbOUz2xih22K30slc4JysFxsX7g9FCNlI6r1YtYEd+JvO 1kS1V1r/9/L4VA==; From: Roland Winkler To: Thierry Volpiatto Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87ed0ydef1.fsf@posteo.net> (Thierry Volpiatto's message of "Sun, 19 Jan 2025 15:14:10 +0000") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <87ed0ydef1.fsf@posteo.net> Date: Sun, 19 Jan 2025 15:21:38 -0600 Message-ID: <87zfjmts7x.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, Eli Zaretskii , Andrea Corallo , Stefan Kangas X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Sun, Jan 19 2025, Thierry Volpiatto wrote: > While you are at it why not implementing a add-to-(a)list function that > add/remove an elemnt at INDEX in list? > It is what I am providing for my users in Helm. > > (setq example '((a . 1) (b . 6) (c . 3) (d . 4))) > > (helm-add-to-list 'example '(b . 2) 1 'replace) > > =>((a . 1) (b . 2) (c . 3) (d . 4)) I am just curious: when can this be useful? Off my head, I cannot think of any alists (alists that users my want to modify in their init file) where order matters. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 19:28:15 2025 Received: (at 75170) by debbugs.gnu.org; 20 Jan 2025 00:28:15 +0000 Received: from localhost ([127.0.0.1]:48262 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZfeJ-0002wN-0q for submit@debbugs.gnu.org; Sun, 19 Jan 2025 19:28:15 -0500 Received: from mout.web.de ([212.227.15.3]:43753) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZfeH-0002w9-CT for 75170@debbugs.gnu.org; Sun, 19 Jan 2025 19:28:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1737332881; x=1737937681; i=michael_heerdegen@web.de; bh=kmrYSiDZSk2asrEjc+0KUmmbJUiGgLFWC1S59aQUQzI=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=GQ7qe19sP9Bq76aubzwrdersv8K7dSNEJjzwCvCrvRO2WfpS72wCBTZGnI/4sCz4 3s6bOIRXsc+UB4TC24Dc/sDiEFnyYowKP3atWQbP/gZeF4EyahRfAI1dxoLyId6vC 6/5IZB/g1LEPzZLh4UNETEKJt+U041qp4zjp7vGdF4Qubjx0/Jnmsisyv6JrMQQvQ bKNbPQCXc2dxTKXgOWIYK0bQoT0bUIk5icQMd11Ngyze5hAHm6tGN4CZvON2izOpV m0nHfv6fbzuaZCDEhqfXPwRS2lPTJyd+zOjwdOxWNLehFIMboPU2H890UkaveDfjd b9OIOhkv9Iiy3qqXTA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1N0qqv-1tL12S0vf3-00tgO8; Mon, 20 Jan 2025 01:28:01 +0100 From: Michael Heerdegen To: Stefan Kangas Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: (Stefan Kangas's message of "Sun, 19 Jan 2025 05:23:15 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> Date: Mon, 20 Jan 2025 01:29:17 +0100 Message-ID: <871pwyiazm.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:ME9TZByIzqjUVl3TylTw50AxSUwTLgGV70j1Ve/gO0nZbN9b84f 9KvK1lCGYIqpBDU7S5WmK7FwkSdto5sL6D5YUAmsoitHkEwkT3qS1wtsl7qQF17HGhxT9P3 vOwbluof2jbgVpC4Gkabz62CKC2T18p4pYbUJZBG4c6lPzKwSTm6F2iGbrjiM25Uiyl/4XU Iynk31ZdWHN01OVumAumg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:UBySQ+RAsOA=;tWP7NeR020Mgtpv9iex1aagN6n4 IJA+u9N+p08cI0Yerdq8wvPOSLV1Vx9RjlbOKAC59BXJS6UBsVwSSHzjgC0M1TQAMVz6Qwbyn O9TmTLzmKLu8ezQCGCQKYdhULj63j0No9w3gRVfazmS+fFqroUL2C0ngH5JA+pwJpCtcTXSbz Mwd1kh9ttG/Jm+gjhrmWOvBnXexWdqq1ZpRV60A3dhvSx2rndorh84gWBQY1IrZ6LP9KgWGS4 VIndiKoZxxmEyB8XPLkMjHn9g3bwUaIA9wx3A9SbWZDl8xKAiGNWGahICP+XeGzn0ufgZFqgq K6qZniGT+bwtNt51X84Xk5JtXZ9AsUa/LgEq9R+68BpmKBH7CG1clCaoS5NJU4gt5kNKiH+mF 6OQ61t/m5VLf9J/E7dnWEErXo2U0f/QJ8VfECwIIlDngDFvtiOcWzHwQCoU1+8CfwusfO0Mc5 MUV1u1YykE4WNjHb86bF0hGuEx3/CiK4PPSip0ud0XMAieGznd8hAcg3675okYGqtckeKV7s0 NgQw6lFIUJjd2it0OhyYb+HtAflX9mWmrkStLa+IabXJCU7w10T4zkuYVNiP8uQElx/3oISH6 IXLjT1aVXXFnzoHfgrDuY3JYqhOi0kjtsgwIejwcbDs8CWkDhOz+6/MsVpjR+odkzK/m0wFA0 /Fa4CthvT+Bho9hwqKutuG+assQcJksJ54LYE3UW414axfm0o8dIhKFcixHk3cYco40FZ93Q4 ZNlMXDJVYcR2Xwju7cw62D6QhRP8+CFwLYMllMoKeMRQIp+mhHuCxOqOwL3ZWN9xlyhvZmaw6 Prwu6c3PGquxZ6RqhqBpuay7c/DhGBfcekhQs4YjcQaZG/DEr5inMm6UbKPab0eIUnFxMqcX3 fFPpHrb+tXk6dL4jdm1hit9KGMkwOA+iy0Y6spVPQvL9nYYuYskJcpXB7z2oqjpDkXX0B2EZI 2pJGrKxITr9MEtO1b1ZcsnakP0L87I6LmMofTX+0srTvXqOdpzNGNsZhxFfCbkYQ61LqE05Ba EwcqXYXnaWqvb5lnBr5dXsxh/GtonVE+D33lFlyNdeb+wbpFlZOB+aWuIJVxPir40DRQ7iaia N0a7QvXF2hge2ofZC6A0zfeGk2vd8pgfTY8b1IGCmYyebgOYqeBDt6ph83DMKPHLvsq5ik31y RudC6mqOJ9LxTPVK7dSGDtClvMfSxgStJixKn84YALw== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, Eli Zaretskii , Andrea Corallo , Roland Winkler X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Stefan Kangas writes: > On balance, I think we could add it. But we should definitely have only one implementation in the end. BTW, this situation is similar to and-let* vs. when-let* where Stefan wants to remove a similar kind of twin. If a new construct doesn't provide some kind of advantage we blow up the language and make it more complex. One has to remember the differences between the twin versions. So, are we sure that adding something like this is making things easier? What is the advantage in this case? That it's easier to understand? I think the examples in the docstring are easy to follow OTOH. If it's the discoverability, then let's improve that. And if it's mainly useful for newbies and initialization files, an idea would be to start a new file init-file-helpers.el or so that aims at beginners, and add such things to it. Michael. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 19:46:19 2025 Received: (at 75170) by debbugs.gnu.org; 20 Jan 2025 00:46:19 +0000 Received: from localhost ([127.0.0.1]:48287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZfvm-0003nQ-Um for submit@debbugs.gnu.org; Sun, 19 Jan 2025 19:46:19 -0500 Received: from mout.web.de ([217.72.192.78]:38875) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZfvk-0003nC-IU for 75170@debbugs.gnu.org; Sun, 19 Jan 2025 19:46:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1737333969; x=1737938769; i=michael_heerdegen@web.de; bh=QTeKMwhx2XWUcESZHZv1OpHt6cd6QFFrikvXA3J6cSU=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=DgfO8+KfTC1BoWhxoMriW4UXCjC95vfDGJc1vAYHwEOqmXOmYlDOMXhAJUVTp1JU 6kUhXPgFSWOG9xr+1tMQlTaSQfwaJ9oO0bX3beunYxg+zim+v7ye06P1/aPAteqxY TBPGlPMIyUy803Nb5Xb/0w7RWbCDX36rpFRKj6DmLEncwvBhJtTTU/CeOiUnyZtJk XoYUWMTgKlxEP4pt7L/BIvd3YJNJlEcVivyDFsHlHddh3V4Z1BtZ/V1sqbh+FZdDt xvRMZnxLwXHlUmuSojL9h9lkajYtQBwV0TolbZ0Fps3//AYw0w9ZG9tz6DCiFDmd3 4jwm8L3/vK421mAR/w== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MElV3-1tkxfm2GbL-008ytY; Mon, 20 Jan 2025 01:46:09 +0100 From: Michael Heerdegen To: Roland Winkler Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <874j1uv6yj.fsf@gnu.org> (Roland Winkler's message of "Sun, 19 Jan 2025 15:17:56 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <87y0z7r1c5.fsf@web.de> <87frlfuy3m.fsf@gnu.org> <87v7uaa97f.fsf@mail.linkov.net> <874j1uv6yj.fsf@gnu.org> Date: Mon, 20 Jan 2025 01:47:26 +0100 Message-ID: <87tt9ugvkx.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:q7OKU/FWmJmxUgsv/kqImYtRL1QKYa7dWj1x5pCI8UALHvkE2W2 ubDyim+HPWcJbOW1nKQys8dAx7U6MFWjlzzrJnMVhhaVgDEnecUs1SYWBK5FbjqUe+rycvV jKi0ox7mO/EroJr6bGbPDiTi8+MQR3OSJQBbc3tsZbyxoyRB+C559jqZYGoU6rtfUnKQ/kb 4eJGFrVy+a+xrHEILHIew== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:bgV8Zush/gk=;QkkW8taVRGCJ2pfFC43zjghn8Fl ITbzWnY+6+1ECtyZVGqhQT7epPdMCNdFtct/43h8PapCo+oS5kLoc3QDDrgmYowJLTFVD0UKg 6F3bimt/IhRM3r5f9p/HXU6c15mQtoEb55KmErhSs8J28vbI1LtcyMQZ0TuSh+NVPRhjvPV2s qz6J3vZfWFLuoUWvxiIJ5QPX3vHWI32ErLnWCP5GlA5rW8YkUs5b07Fa0IRvlfREJ6wTVTIND LqGImJWwlt22Bn0cUqPFf8SkdLnbS3VuJ0d2MxpD4c+BHiLS3IEqahPmD6zwQC/DOY+pH0C50 dJlXXp+EdhGer5fKvSwHRu+tS4SVXV+CeQX1XtFrNbP647pZMHSF4CsbpESz5mMTWfFJGCwA/ tNXq0uZd2yF+EX3MSJWqtVQr9X2bpaAkfCKyDvXjjwjRgL/nU5gGVj79qVx6JXP6U3Fv13Max MZOq6Vdct20FG0EYTP2VYwSZUNmrsWboD6w3HDhWKbU/S3NyYzbae5vw0rso2/4CbawZQteCL eD3LO5mAOzrjWD4uvMjknDVn47f8QOPcyJad+BBWATa2+EhTN6xlTT2jBTVQYFts8UnwETJ/a frd6n8ISXyph6C/tqmcQKD54ubDBNdOGOHUlUh9eSn5cZ69oAN7+MJIvRPavvGUlGBw9/NyqZ 4o8Lk/JLHhYQIesTCnSy9/Hsv6/UAruRUkr53HGaMSnoOlWzouDwABFuKmq4vER8r8jy4Vm1L g1XKBs90kOLBIrEEVwXHn7EK2aDt4DUHJGuaxfVzxfosasIIUsCKA3r9FpllHe7PsUwFmy/K8 GHblS9Y4RU/jXyz9GpvxE/lhu/SMPE2BB0a2ZrAWkfaaLfC7G/o9qI6s7e6KgtcKHwgI+0aUw bFJoUlGlnqPWowWb73mGvDYcKtysbcrS85bj7DC1DM8sR7gQ4isj9QzQ5+682pAy7DVCFS+z0 WkN/qte8S8kzVaf3RVKWlAVpDqZC5ugetESiV8pWWq9qHZ2hAJbzSZ2eVDsAlYRPySX1QkSFb KbrI5AbMRpaHoC4lI4tAfN2xIGCi7G4YQgbWmT0OshndP5K9UHoEitqqfr8OhZ4oflANT7Kft gFO0bwcSlQYBxWYCe78q8GLLf5qPMofeQNyWda9rJLvUju0kS01BLOGuIJMNdCdCz0uz7ohVh PvflPxk8N5uVNaDZt9DYZjcrEjEZla009xTdTg85OsA== Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: 75170 Cc: Eli Zaretskii , 75170@debbugs.gnu.org, Juri Linkov X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) Roland Winkler writes: > > The no-replace argument is useful for setting auto-mode-alist when you > > don't know whether Emacs supports a particular programming language. > > For example, the following suppresses using text-mode for m4 files in > > Emacs 19 but doesn't override using m4-mode in Emacs 20. > > > > (setq default-major-mode 'text-mode) > > (add-to-alist 'auto-mode-alist '("\\.m4\\'" . fundamental-mode) t) You can already do something like this, e.g. (unless (assoc ...) (add-to-list ...)) or (cl-callf or (alist-get ...) VAL) Michael. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 19:52:04 2025 Received: (at 75170) by debbugs.gnu.org; 20 Jan 2025 00:52:04 +0000 Received: from localhost ([127.0.0.1]:48294 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZg1M-00042H-II for submit@debbugs.gnu.org; Sun, 19 Jan 2025 19:52:04 -0500 Received: from mout.web.de ([212.227.17.11]:52169) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZg1K-00041j-Hl for 75170@debbugs.gnu.org; Sun, 19 Jan 2025 19:52:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1737334311; x=1737939111; i=michael_heerdegen@web.de; bh=3YR16T37jlb4zaagSmM3MkzBab8Mx9RE0TmD0EtjHY0=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=UlQ0pEquu3SFd1UoqlbZKq8D4/5jmDj6mhQcH6KmZMH2iB7EGoFuBYZLXCLWkwEN 2g3nMtskr9hl+iQPTT/2sH2u1jsdJJhXBkPfQtktoBbopNx2dvwoaaFZQQOFUcN8q Y3/fg0kl9ALVue48alyErTw6nX46mbhoRr3MQvL9VX9R+rzOxMiVQXAbFfAw1Q29+ 5nUjCW3A2f6ll/Ab4I49568ekhAkyuWgk/b0EsmDrrRhJLqMecrVsSCgIg60yG++8 EntXjnjTOnCdFFYAB49GFyiltS0/pj/sfTbcuBpaPB57TOnhSMp9CNlufeJX1M7jI hpHbWvq/xuL0WrSpAA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb105 [213.165.67.124]) with ESMTPSA (Nemesis) id 1Mm9Va-1t9AxD22m8-00jEFW; Mon, 20 Jan 2025 01:51:51 +0100 From: Michael Heerdegen To: Stefan Kangas Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: (Stefan Kangas's message of "Sun, 19 Jan 2025 05:23:15 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> Date: Mon, 20 Jan 2025 01:53:08 +0100 Message-ID: <87plkigvbf.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:smOyCL/9VrwKCfEERqDuyGAhNEV8qRjdanG4Xmvz4fialNieODs j4FVmMz8ipSgXvQ1+QZhfVKdLCAA+dr0FfSQ7qyW74tvjcax64EokKBPi2WeLwgy7SBAkh3 TULFw9NmUAIHjEUktd3hfguZhAtkrGtZ4kTAlb3YutdNhdPNREgGyVdG89XZpAma0Sy0WY6 bUWXTp0cwnK8837U0haEw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:tlAJaG79hhk=;pzwz+J+jgsiyG3oE+kuJwi54H6U 0U+pigsvF6MYUUJy/YN0MLLGkjBtQFZ+XhByObEcg1AnJl8YGV2Jh+vg5bcggyXjuSulUT2/O y7S2YU13PS1FdpMV+CndvJLZikrWFK0+1LJ1P3B+T17Li2u+BMAco1tiKvHF+OSF7tmD4zrn0 Ih1BdB8ystOMvAEJ2Gjjuog4gfWcbqfp1+heNl+pHtq2jTM/D+DPJlOHkufoB/DVoXWWmpb7p iaj/05KNDaP2o3L0zYcBywsqJbRYb0zkfg6rp/ZfZUJP/gNPQcwxMpPAm9o3c9rkGJC5/VxUS qyS5utZ9fJvFjy0g9IcnlbI4vRBO1YKIYmeA8cjFKogfOJNLUbxi7npdhh/Exy7+4s09akk0t p7npzYdZnmmC+Lt/kyeHpzdJ0Z1ACAYQrR1UNzU8Ixq8NGpQB18Fx7luz0bv1bVoBB1Ei659d I0nG4ey5K8uk4PQxYHqqOfMTvbaOgBx3ZikejtuIRueT9cC+TLGgJjLxtgXNnfbxAYTIH5R+Y D985UBywDBrlUE6TsnRIWxIVQM6QtbSfb6Fr4LTj4xDMAtqpQfKJxrXIjazxWPMMSbRsUZn4c 8gzlHBIePCrRPQd/lQW57injSNv7EVnLHfcuM9Pg2XaQCuTr3nK1LRPITWT1s1Yscm6+6aMsz 1vh4FL/wBt5kqSnjLgtMg413qUsz9jgnCL1IJ3bs0cXA2IZ3DqCS34rkDnJGB4/8ExWKzhMuc kYnq+qwRwBmJwzOKr5ZP98L4R55h5hrY28iGQ7gUrri9v6Zxv03SQn2YE3vJhf0YXjs0M0Y5L k7BA6to+dYdyGqA3CjOt1f7uDSt3Wb3wOsko25bFkcMGbQrhr0B5XbzvQ7QGABf2jhh1ieCCK 2800cA3ccL7oQDwm5nbhJGZmXOWj550aMIyFxin0yScPydEkqF0A5aHhc7sbcp6fTrq2UKXBz 4yyGZmA0VvYnEFq6gIjycFhp+NCzFCW2LmHIeRUdAhYGlbum6B4+aH0kJaRXhA9MXvqJt/CZf MFNNw/NmoKWCbIZZ2kiS5e8GQSA+F+eqvnxLhLF1YOnSONx7NstBOqIqfI1WGj80cVRXhAFBY J1DNNPmAdav7vYeHcKn7plDvSyUy/YSdlWFVvsRftXtQ+O4E16/LZQqyidV1/MJO9WfWYWL7N hFWJN3i10FV/tqOfjTk96LQFzLuF3DAMyyz+08gepYw== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, Eli Zaretskii , Andrea Corallo , Roland Winkler X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Kangas writes: > On balance, I think we could add it. Also, we already have a library map.el that is another generalization of these things. Let's not add a third implementation. Emacs had once a library alist.el IIRC. Dunno if it had been part of Emacs or third party, but it had been quite popular. It had been obsoleted by `alist-get' and map.el. That's not so long ago. Let's avoid going around in circles and think twice about the final feature set we aim at, and how we can get there. Michael. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 20:05:43 2025 Received: (at 75170) by debbugs.gnu.org; 20 Jan 2025 01:05:43 +0000 Received: from localhost ([127.0.0.1]:48319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZgEY-0004fV-Lv for submit@debbugs.gnu.org; Sun, 19 Jan 2025 20:05:42 -0500 Received: from mout.web.de ([212.227.17.11]:52865) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZgET-0004fD-Is for 75170@debbugs.gnu.org; Sun, 19 Jan 2025 20:05:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1737335128; x=1737939928; i=michael_heerdegen@web.de; bh=ticME++cqsC4uLo4wpUupM2kn8mT8iajzXZkT8jRxk0=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=CS6Il/7kKbY1oBLlkn0jWwNBSvoFU1b5MfupCorMuMU3nv9LqiWszyg8b7yjudqn zUUFo/46HV+L9BJh3D8Gd25bi+ZIstRmS38UmnCiU6nnSyzyd89D0VConHM1U02ym nj7TVv//ewi1aa1DgJDCfnltg3v8p7sUMyhVSeHBHGbFRprMx1z9Vsxp1W5v7+j7v RC0ImqPQcrcPYUnLv0uajx507jfvKN6ynxb5y6Wk5NYdJgkGGeiQw3dHABkvtg4SG T1FLx9r331epWVPI9fTHTGZ2XALzjhJb9CPKVEm6/L+OeLOhIjfBG6e9LAN3oJyzD Z7Zn61BIoYfcKQg6Ew== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb106 [213.165.67.124]) with ESMTPSA (Nemesis) id 1MJWsc-1tp9kV3xpQ-00N3Zt; Mon, 20 Jan 2025 02:05:28 +0100 From: Michael Heerdegen To: Roland Winkler Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87frlfuy3m.fsf@gnu.org> (Roland Winkler's message of "Sun, 19 Jan 2025 00:17:01 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <87y0z7r1c5.fsf@web.de> <87frlfuy3m.fsf@gnu.org> Date: Mon, 20 Jan 2025 02:06:44 +0100 Message-ID: <87ikqaguor.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:RTJEBSDZuIzLsIxggjR3p9ZPNL1gaZBcY3qcuURbB9Vqy0SkekN rdtonwCdIDS9bizdXFOpQ82VUnRgEaW3+MX1uqPOy2BjaDXfoH2kIXoBGX/2m4F+u7qgX2q 0VTr4O1uOVxzClvlEQvFKSBPs2k++Amxsmzh2hGJtSJTGM+aNMM3hqx3uPeWRJVdIRJKkAG sXp/DbCEw+vuL1XjqKGZQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:pxkZ7TLtznc=;oyVCtHUp00iorXW0B3dCWXT3Wkw 50FtfsLwJpHAHV7PdJAfsbajp+bZrY6A+aMRDnjKxe+V2WkySQaAKLo6E9916vTLkiq3cSKAW nh8RfowJEGPiZzyEHgqg7WiE65LOsZ444e2pRxz9UfnjSSIxqJDBTdyhzi8ecNGiZ2ifTWXvm NVob0/bWCAtFWvalA7UhrgZtgvy6r+1pnv9Cqe90U6KftZEVA0wpCYNKgvW05DNzZW+Ys+3QI Y10at8YMhhWE3XbfY+rbzeRosUw4ZAp6w3JHvHW38FSUU/abqx3fqfMyhcwFxbzjcVYvQnXx+ o2BELBpAqE8RjMLSMY4NIx+ao89BtotZ6O+dH/UCMl2nKNvsMuEah1DRH6NnnaaCuIV9zDox6 Re5grjMrgeDtHzT9+kP/O/LbYY/wE+1w+MYRaYD4YnebQQ0QEfgcwPYuQfpge+rp1gP5nHKdK kQ3F/hWVd5qevl7fwnmn2usqpHVWQ06naPx4vszwim5QJTGohjrarfxU093fuDOrQYEVKVQ0q BaaFOhoiEvP9huNzUDLgFbljhbj9sxwcNXNaOjuv8zsE75ymms1P5HtvjZIniCrwtNW4egOaZ R/fFTa1yNlVWH3iVSkr2SLAd3XB/79XrcqrcIMfpTGnEYLw8quyvmnFHXdgiSO3UAQGBPcgc9 HhDJXyiNOSyg9P6ccrfroYBo9WFG1bf2my0I8sd0puGQ04xbCz/uVzQNfOlfzm9kGyx8agLZo 1liAzDFNQ4Io1IIwjrRo7DK5OsI0WNX0ZM518NXTO0WeW7MuhlodLolvgXlT4+9XN/ly/sfMY Yx4/MP0sF0qIbidAXZ2D0DVa8h4r0ddP3lziDTxGcrm/FG68hvJDyifPIX2ViMWgDQ+94dqOl tFWcOHSkBcMgy3nwcqm32dO5M5/ElbRQjJ2cnY2dSSUtujtwkCjspY7LqW3jKp2sRW8b8Pyb4 B2y48K6xt7OF5dYS82xOubykQmzJrsvRaf5jggGsaCPLX6D7ekaOCEEPI4Hsz9FnZ4bWUHzjw BfDRCq3uJiYmlSaxwWl1sNw05lD4cHNFOdVC8quvTvp6psbPRgVbPglvgHeMAFoyT6tMwpS/J MW4bcS4nzsSzjE+RQ9z4U1lbK+GxLeTDS2YYkoJXIabtH6RrC6cH1CWH/Hf/NjoCfoBjylKgG 1+u+hFpZlLUoRn81g5E9kOr+GrFTYKGRPmagz2kcIhQ== X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: Eli Zaretskii , 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Roland Winkler writes: > Actually, I just read the docstring from alist-get a couple of times. > And the meaning of the optional arg REMOVE is not clear to me: what is > the "new value" of an association if the key is removed from the > alist? "new value" refers to the second argument of your `setf' call. The association is removed if you set the associated value to the default value (nil most of the time) and if REMOVE had been specified. Michael. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 19 22:41:49 2025 Received: (at 75170) by debbugs.gnu.org; 20 Jan 2025 03:41:50 +0000 Received: from localhost ([127.0.0.1]:48567 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZifd-0003XK-Jt for submit@debbugs.gnu.org; Sun, 19 Jan 2025 22:41:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:37422) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZifa-0003X1-HE for 75170@debbugs.gnu.org; Sun, 19 Jan 2025 22:41:46 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZifS-00033w-7l; Sun, 19 Jan 2025 22:41:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=i9MCehPN79b8mevaUE8ADWpjzHXpREh5+9bMpkVjqWg=; b=Hk3vOrX6S83Icufa9gvR Kq3qKBf2ZOVBJmfW2Tli7nb1VpfVADsHfitXI3d3+0SPCtcDpNQXkHpY54DxigKNH92z+OuiliLYi D0Y5Ed9pK9mUjPYLMUhvJMT7xMCSAIwH4ZNd2aMintafOOhe6sD7T7AoUYO1LrE8qSHZQFXmA9BE6 4mZqsa2QWubSYDouneHtLrjv1w+ApKOcytMs3vnrp0VpDgJ90f4aPfm+fQ9RiTWg9VsR2cHyQ+moA Gve1K6CCw7+NLyfLuXssgXOVb3Qemms1VUqjf5VaIk0tJLbeInC3qHo/KEo+DCWCBWHzosLXoPcOA zvPNGA6TzRA6sA==; From: Roland Winkler To: Michael Heerdegen Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87ikqaguor.fsf@web.de> (Michael Heerdegen's message of "Mon, 20 Jan 2025 02:06:44 +0100") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <87y0z7r1c5.fsf@web.de> <87frlfuy3m.fsf@gnu.org> <87ikqaguor.fsf@web.de> Date: Sun, 19 Jan 2025 21:41:35 -0600 Message-ID: <87sepetamo.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: Eli Zaretskii , 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Mon, Jan 20 2025, Michael Heerdegen wrote: > Roland Winkler writes: > >> Actually, I just read the docstring from alist-get a couple of times. >> And the meaning of the optional arg REMOVE is not clear to me: what is >> the "new value" of an association if the key is removed from the >> alist? > > "new value" refers to the second argument of your `setf' call. The > association is removed if you set the associated value to the default > value (nil most of the time) and if REMOVE had been specified. Why is it not enough to specify the key of the association that is supposed to be removed from an alist? What is the purpose of making the removal of an association also dependent on the values of DEFAULT and the 2nd arg for setf? If there happen to be deep reasons for this, I can't help thinking that they are not becoming clear from the documentation. -- I thought about also adding a similar functionality to add-to-alist. But I could not think of a way that meaningfully aligns with what is accomplished with the other args of add-to-alist. Removing an association from an alist is a different story than adding / modifying an association. For user init files, I would suggest a different function that will do only that and nothing else, instead of adding more arguments to add-to-alist. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 02:26:00 2025 Received: (at 75170) by debbugs.gnu.org; 20 Jan 2025 07:26:00 +0000 Received: from localhost ([127.0.0.1]:48808 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZmAZ-0008Oj-Gx for submit@debbugs.gnu.org; Mon, 20 Jan 2025 02:26:00 -0500 Received: from mout02.posteo.de ([185.67.36.66]:36449) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZmAX-0008OR-6Q for 75170@debbugs.gnu.org; Mon, 20 Jan 2025 02:25:57 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id CD5DB240101 for <75170@debbugs.gnu.org>; Mon, 20 Jan 2025 08:25:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1737357950; bh=nRUGYtztV9E3nksumD4HR8ofFvriUF9Gp+Rtqn4LJ5o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=dxNPg+PIIXrm2Ntm6+UwscjoCvsRBPoAVAPjSQZ9GzpiwpETBGi01d+e4wr+1rjFy KRjchqK98n/c/QY9c8DlO1zts2z/4ZqhoBfDCc6Uit9yHO5orPQ+SphR4Y1c6xuMHE tX4U65PI5IRx2s9qnFf7RDbn34Cey8AkKbA8nBQCskYUAAt5o4u/EfhrhFrNJVSigt 6Aw1i/cLQuXdfpwhbu+UdIoh1ZL6gbx6vOfU/hUaAPx9Am/EUjM2qo+KriJp0s16C6 1cMR5e8uUeMCydOdOf6cOna6jrHfGrEfs4iav2XMZq3NBjcaYkOvp8w3nd4BrMhN5q xlYrhVOTQUtrA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Yc21l1B8Bz6tw1; Mon, 20 Jan 2025 08:25:47 +0100 (CET) From: Thierry Volpiatto To: Roland Winkler Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87zfjmts7x.fsf@gnu.org> (Roland Winkler's message of "Sun, 19 Jan 2025 15:21:38 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <87ed0ydef1.fsf@posteo.net> <87zfjmts7x.fsf@gnu.org> Date: Mon, 20 Jan 2025 07:32:17 +0000 Message-ID: <87ikqaueim.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: Thierry Volpiatto , Eli Zaretskii , Andrea Corallo , Stefan Kangas , 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Roland Winkler writes: > On Sun, Jan 19 2025, Thierry Volpiatto wrote: >> While you are at it why not implementing a add-to-(a)list function that >> add/remove an elemnt at INDEX in list? >> It is what I am providing for my users in Helm. >> >> (setq example '((a . 1) (b . 6) (c . 3) (d . 4))) >> >> (helm-add-to-list 'example '(b . 2) 1 'replace) >> >> =3D>((a . 1) (b . 2) (c . 3) (d . 4)) > > I am just curious: when can this be useful? Off my head, I cannot think > of any alists (alists that users my want to modify in their init file) > where order matters. Here mainly for helm actions, but I guess there is other use cases. It is not very hard to implement, so it is a nice extra feature to have IMH= O. =2D-=20 Thierry --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmeN/AETHHRoaWV2b2xA cG9zdGVvLm5ldAAKCRAOxW0UHRbvkzbxC/482/RGb6+hJAjAABE8Vt4zt8bUBuu8 URjPhpUoLMFyXSTih1ELBcnlEe/VB0/fRxMrYFTTj0H9gaQsEfndahLocVVODD1z u1BdhGgKu47VsQFW0m+PMP8pyagrtbwxOJoyCO8mP7/fnaU/tvGec0AjDWYoTmkC Hw4+EZc0hlPzhJiiY/D+Pj62xF32NGXpW6ZCopuNli7/lwxzHTV29tGwD49QJxVD cNumFK2G5JeJasTNEM0EXQwDNj9SV9wM4pvYpYSRbJeFKM14Eo078vb+bSI/mhR6 Ew73q3gXGXukUY96+g3U/iLCCn8GJwgvsuMyyxLqGP/wIYraq6JIQ6E6eHqNiLcC h4jXdaeQMy1Mqz2L6YXo5k8PLeVbtDH+USG82qRh9JhQVHsNnCamByZZ6VrAS9Oe gE6F0wkd/a5RDunr0FBMtBdsKV3GEMyeRiPx5lcT9SgsQMr7z6O5D6SjEQG3EasO NB6uWEDxWyorjXs8YZBH3iot48dOeyHWr9k= =1YM+ -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 04:59:54 2025 Received: (at 75170) by debbugs.gnu.org; 20 Jan 2025 09:59:54 +0000 Received: from localhost ([127.0.0.1]:49025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZoZV-0007Cr-Pk for submit@debbugs.gnu.org; Mon, 20 Jan 2025 04:59:54 -0500 Received: from mout01.posteo.de ([185.67.36.65]:44015) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZoZF-0007C8-IN for 75170@debbugs.gnu.org; Mon, 20 Jan 2025 04:59:37 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id EC801240027 for <75170@debbugs.gnu.org>; Mon, 20 Jan 2025 10:59:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1737367170; bh=loWiO9Uo5oH1yq7eLfwteFEIHXy6FO5G+t+TQH64XKc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=AivJW+vQKvmqQ1z/L6uz9a21jCuxlT01nSHVHoaLoylcX7zBh0L49bsCYw2trGF6N FQtTJEqnWF3WVRTcVsJcjrRkdvJmgScAg45i7jN2G8Z3R6YpawIz1zqqeT5mwZ6VuH TEaI5r5Abf5YJEiF9NY/ju88BLLr9whcYdIt/zEZ9fe8Cc4mEBWePGKoqFtum7FwiZ 7XE0IA7rnKb5sneKWv9oLgVjsIZHIdMoYpTqe31+GCuHAjeatoFKTdSOxqM8dtX2dH aqlOnRDoAB2MNZlJ5yaS038geqc1BV7yxPFr4f6L4XqgOYmnHXT2YFcAXHdyEX5LIT VT3FZf5t2R1gw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4Yc5R46JLHz6twH; Mon, 20 Jan 2025 10:59:28 +0100 (CET) From: Thierry Volpiatto To: Roland Winkler Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87zfjmts7x.fsf@gnu.org> (Roland Winkler's message of "Sun, 19 Jan 2025 15:21:38 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <87ed0ydef1.fsf@posteo.net> <87zfjmts7x.fsf@gnu.org> Date: Mon, 20 Jan 2025 10:06:00 +0000 Message-ID: <871pwxvlyv.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: -3.3 (---) X-Debbugs-Envelope-To: 75170 Cc: Thierry Volpiatto , Eli Zaretskii , Andrea Corallo , Stefan Kangas , 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.3 (----) --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Roland Winkler writes: > On Sun, Jan 19 2025, Thierry Volpiatto wrote: >> While you are at it why not implementing a add-to-(a)list function that >> add/remove an elemnt at INDEX in list? >> It is what I am providing for my users in Helm. >> >> (setq example '((a . 1) (b . 6) (c . 3) (d . 4))) >> >> (helm-add-to-list 'example '(b . 2) 1 'replace) >> >> =3D>((a . 1) (b . 2) (c . 3) (d . 4)) > > I am just curious: when can this be useful? Also the usage of an index allows things like this (what you asked in first place): (setq A '((foo . bar) (bar . test) (baz . else))) (helm-add-to-list 'A '(foo . baz) (cl-position (assoc 'bar A) A) t) =3D>((foo . bar) (foo . baz) (baz . else)) =2D-=20 Thierry --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQHHBAEBCgAxFiEEI9twfRN7r3nig/xwDsVtFB0W75MFAmeOIAgTHHRoaWV2b2xA cG9zdGVvLm5ldAAKCRAOxW0UHRbvkzIjC/9+fQT/0LPBL2zg1Be3K3Vs4AkGfbuC 659hhq2zg24Se3oL0HqshHFJxZu0C1Ut/iUy77Gfgop0jSZPn45Bt449uX20uajL qgH6NkOpyKwOvWuvM8i8qG9Wh6qbDqWvHKmljsrPLngvNL9UIB6XwRHXrnzsJTWt cRXJ3h0C8ffCbQIshRU/VIvUHHSR1MB5RXNUNhKigRjjfet8Y++weg+OWxSPPEsF sM81+nc+AYg1SQBU/XfXP3w8SKR+tu70FjUMgGR7AzLrH6kISR6Ydg+AcHK6DmJM peH1L3C9Uh+oIIS0AjLK/nSodtyUAprksMLkpgsuAVLAUatLN1ivPtpACdUH9yyT yWgAtE0QdKiFwdQJtJ1shzizqxmWVg2aMe4hFe8Ngv6RQh0rOW2tlV9zFnpVq85a AlC8BPb4gfZMQ6GoDGSf5a/WKDyIJ+W3MPmB1XeDgtqvTgWSXxvy5mK9vqA3S9DF upp36CaN4HDvSLksTCXLA+Znk9fgS7KZ1P8= =J/QD -----END PGP SIGNATURE----- --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 06:27:45 2025 Received: (at 75170) by debbugs.gnu.org; 20 Jan 2025 11:27:45 +0000 Received: from localhost ([127.0.0.1]:49177 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZpwW-0003MB-Q8 for submit@debbugs.gnu.org; Mon, 20 Jan 2025 06:27:45 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:52629) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tZpwT-0003Lp-UW for 75170@debbugs.gnu.org; Mon, 20 Jan 2025 06:27:42 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-436341f575fso47263075e9.1 for <75170@debbugs.gnu.org>; Mon, 20 Jan 2025 03:27:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737372455; x=1737977255; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=BmHxnmneg5utM6GuBZ3KOB3RSq9Y8QWuIUOzXbzibZU=; b=H3CQcfyCN3JJrx/QQ2iVXYcm5eIP01l1iNyE/Aq/cNtOG2arP+lUv2V3alFfY5pUBG GDRLcGsCpAD1tEjSBcJyKzzQlFSmqijQyWSKWR4mVwgecrL1K54jjYY2+9KmxXu/wMcH LkcCaEPApmjqGuioGlM0QEV/E9tjP7t3iP2nF4A9BVlA7abarP9ghcJQKc0rnojaUWLs 0C6ccLBZOU/9943Ks+Pe+H+HqIrzM2nWlQIv/SPHkId48ZmnpxH6uqWAQQbZeIOo9F7F SBAzgXbIvZL4RZubVyw4tOeusk4KETqycWyUN0UWn6fsCKotQTsI6pMzw5qk9TlS9d9t xbew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737372455; x=1737977255; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BmHxnmneg5utM6GuBZ3KOB3RSq9Y8QWuIUOzXbzibZU=; b=U0FZiJDTuDwn2cfuontqEaDcZX1FxcOlH5a5vw3G9jSZ1aUUVgkmAtTFEDFnPWnysP R8EMkhgRLK/Tuml3PxV+xE54jMj6zajEPmr0RxfdacpHe2YbkZUS7LO7BYkIKl0E7QOz kIZHofVydjYUt96pkl+ZlwGQrMGuELW2RQGtVp6OH16tC10c+1ASaYY/jOd7qWLpDuWY 2lfbs0H/u2LCj2VzxRriZ9HpT3tLtrOfHk2iG85YfqWMEtlm5Ws5Z+vKuUyvS0bFyEFg gTcBSaG7lgflK9xAvCe0PF55d5R54xGs2VwCHKvkIJ5ydioga1w2Le9XmShxSiIBNFZ9 6WQg== X-Forwarded-Encrypted: i=1; AJvYcCWeji1OAFp9vbuJPl0WR9DsvxwcHWIucrt/U3kEVr4teG9qlzUn+XHLL+V4MOFRJshR3lCSKQ==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yy4YVnM5DiPxulCQyCvrtxuTRyQZ1Mf6GINVK/QmJkMnOyvOk4M JxZ4ttFrWwWHOq55Cee+8gdu+sP47mkaroI9M9alaqQ8s/tEbs5M X-Gm-Gg: ASbGncvEsgRLzPENHrC385Ow4MHjjPAyOCbyAw4w7tGAvJf+JjeOtX4UbmpKc2N+AON SR+DDCsi5hIfey3vDDjwJBCcxlrrBBpZHeo327fa3UybwjUkpe1PtLY1CjTQCEsUTThH3xOfkoX iuI44f74a7u9jD0cDXh+ELwx2UptTIU0ryC/QleSKtGGfCGzC1GBXzSX7IiltLD8hVH1WSSN4z+ eyarSzgkdlPGpbMQ+eCGTNa6gEVBs1brQYycLQJrS8tImrRQTc2bS6wTQ== X-Google-Smtp-Source: AGHT+IFm5mts5clAN8N+kvnPwleimZSTn144C/2UO35//YhBuhYq1qnDGj6TPH3bkdIO2qtA9w9H1w== X-Received: by 2002:a05:600c:5253:b0:436:916b:aaf4 with SMTP id 5b1f17b1804b1-438913deb86mr134835615e9.10.1737372455134; Mon, 20 Jan 2025 03:27:35 -0800 (PST) Received: from rltb ([2a01:e0a:3f3:fb51:2aee:9648:dbc3:ae30]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438904087cbsm138491645e9.3.2025.01.20.03.27.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2025 03:27:34 -0800 (PST) From: Robert Pluim To: Eli Zaretskii Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <86sepgbh5j.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 18 Jan 2025 11:33:28 +0200") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> Date: Mon, 20 Jan 2025 12:27:34 +0100 Message-ID: <87ed0xd8t5.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, acorallo@gnu.org, stefankangas@gmail.com, winkler@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Sat, 18 Jan 2025 11:33:28 +0200, Eli Zaretskii said: Eli> Ping! >> Cc: 75170@debbugs.gnu.org >> Date: Sun, 05 Jan 2025 17:21:00 +0200 >> From: Eli Zaretskii >>=20 >> > From: Roland Winkler >> > Cc: 75170@debbugs.gnu.org >> > Date: Sun, 29 Dec 2024 08:50:18 -0600 >> >=20 >> > On Sun, Dec 29 2024, Eli Zaretskii wrote: >> > > What is the advantage of adding this function, given that add-to= -list >> > > can be used with alists, and given that alist-get can nowadays b= e used >> > > as a generalize variable? >> >=20 >> > The advantage I see for also having the function add-to-alist is t= he >> > following: >> >=20 >> > add-to-list checks for the presence of an element in a list. In t= he >> > case of alists, this means it checks for the presence of associati= ons. >> > You cannot easily modify an existing association with add-to-list.= If >> > you have an alist with association (foo . bar) and you call add-to= -list >> > with an element (foo . baz), add-to-list will not remove the assoc= iation >> > (foo . bar), but the alist will then contain both associations. >> >=20 >> > add-to-alist checks for the presence of keys and it makes sure tha= t each >> > key appears only once in an alist. By default, it replaces the va= lue of >> > an existing key. This makes it easy to modify an existing associa= tion. >> > Only with the optional arg NO-REPLACE non-nil, it will preserve an >> > existing association. >> >=20 >> > Say, I want in my .emacs file a more complicated association for a= key, >> > and I do not get initially what I want. I can call add-to-alist >> > multiple times, till I get what I want. >> >=20 >> > Is there a simple way to accomplish this in other ways (a way that= we >> > recommend for users in their init file if they do not want to use >> > customize like me)? >> >=20 >> > Would it make sense to give this functions a different name if more >> > often it may be used to modify existing associations in an alist i= nstead >> > of adding new ones? >>=20 >> Let's hear the other co-maintainers. >>=20 >> Stefan and Andrea, WDYT about this? Should we add this function? I=CA=BCm not sure what this would offer over (setf (alist-get key alist) value) which will add a key->value mapping if it doesn=CA=BCt exist, and replace it if it does. I also don=CA=BCt see a real use for retaining the existing mapping: `alist-get' will return the first one anyway. Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 08:41:43 2025 Received: (at 75170) by debbugs.gnu.org; 20 Jan 2025 13:41:43 +0000 Received: from localhost ([127.0.0.1]:49409 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZs2A-0004Xl-OP for submit@debbugs.gnu.org; Mon, 20 Jan 2025 08:41:43 -0500 Received: from mout.web.de ([212.227.15.14]:60001) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZs27-0004XV-TQ for 75170@debbugs.gnu.org; Mon, 20 Jan 2025 08:41:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1737380488; x=1737985288; i=michael_heerdegen@web.de; bh=JCAwx8Pw7A5MaY2cQmhpXSbhGJsUIVfSQdXoB5o9OC0=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=a9gjJtQg4aGGsJtfHaTcl80jdv3/p4gcDwxOsCmDJTWXPD8ZKNqnPAiyn5wLw9qs m23eFqMOVPAJ+ZOrPNKZNPnAQE2i98I774OU1wYKZsoun6rmcfP0C1KxDrBsH9JBx I1UNCOvLIRgkm+fHNhfgty+2SZGMKbmDsP6XsdfG70X6zGVvRZeelt+BicpwUiPhq yBFAHmswnLyd/ryZpd9sohyK1bPVh1rAdsiiFqmBQYvd6Bona8A+x3PFoVrYta2D5 ihpCA2P1zEcR/NI8hB9VeLRqD2n3LVe91dVn81WBLcpfkVoMRnv16PV2mFsGqxRxw nQzlx4IlNRjWMlawzA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1Mtguh-1tEmF53HAt-00vIoL; Mon, 20 Jan 2025 14:41:28 +0100 From: Michael Heerdegen To: Roland Winkler Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87sepetamo.fsf@gnu.org> (Roland Winkler's message of "Sun, 19 Jan 2025 21:41:35 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <87y0z7r1c5.fsf@web.de> <87frlfuy3m.fsf@gnu.org> <87ikqaguor.fsf@web.de> <87sepetamo.fsf@gnu.org> Date: Mon, 20 Jan 2025 14:42:46 +0100 Message-ID: <871pwxha95.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:E0zUyZC6rzAMBKY5DnypG5HU+YLlQuKnsgqINYXkLbAp1I8vu03 Zlgfq6gXNFFgdpKm4S4pnTaTUimSGFDewD7VM4QdyKQh5SgNF89Rm34mC4RXZErWTcz5h/V Z44GRD5UfI3lNGUelqqd2B1LljWJHKC1Po3l3OHFZVN9+DFG4YHaDlgAY4H5bHarQnBtB9B MnhcdHWoW6zHcFAvgm3OQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:vNXAKaIHjIE=;GV6UJvhEql3txETp9ENQCgYrJxZ vQ3uopvg+i5deID917yULcC0BIV+1KNUa7wS2Fe6bsKCz1ONAsE+IBsJ8qU58YPfz6vrUZGR3 M1cTH43A69TCZLKflY+B+qXRfzsqw1C6gRBpA33vZ5Ux9ymb8QvN8EUR4LWNsMwVuIh5J+JIE VCTaw+hhIILbWZF7jJdPqwqI3rLIx67sO9Jdfs/EmdDC5aMtLdlKwcDkGZvmf3M0CU+KHtfgX EJa8owoUAf2w76e3v5VKOhjY7I59AF1Hsja8ZxHBQ3KTK/9wg0v62z+RVoITexHW/hIBhMKfJ /u2ZoJEA6ZzomSKH/M0jNP8K7msjAgvvstdPHwmRnLUa52NQe7QTWyyazflS/WR7svigRgaQh 0MPGwbwwu7nrcoxNBRpmmRKPWd1TlilKFsYyQHAIUyiXEFohUS1Xrjg7eAK7IRJLiKOABVdhP udFMNm6Llud55HtHh71uG7hDiYJuMG8+c5Bjz6e1/uevNPZQI9m66qzaq5KG4htq37W2i6GEQ aPnWwKLb9sOTCcDDNO2iPB9MO6kZzqyyVS0UZe2ecXqvnUlflhLYqSAiX88hF82WdY3oSmgow dHingpA4y1VzO6SQpcCzwhX5e74lobs7rml3XbaduBLHFKJ4FEp/VlFGPSg4ReOZLknT95N1H HBoCJqk5pjzMdQmmxZaqXYIUyVj/oX4D5ps5hMjgw7uhY1G8J7afblIN6KVSf4RKGAlQoCcZd LyXPRpZIVR9ofuTbAixmyqZecGwHTBEQpf0y3HJG4xD4SKd8YAADZaocElNTP7H7STkxmaLMu rMQqtuAe6CJYtyJdiiJPTN6Cmc94KrncxTDl5ePkctREOx20jz9PJPtTpGiTxWqC7uuX3JGig Plfy8+k6re9C97faNDCkC6wrQbHzuLfy96rQv5p9KLv4nn7zszIqzdc+vDbC5IEbexU+4q5pS f21Nv4QZZCzyt2IyHhLcmxVn/rdO3MjlcyQCWF1eylICpF5ghasvYWPxEcqtX6/JqUXywSfvZ tSoc9zK5nO3eOBODhezxm+7rP8PbkudrPLV8tXQ9vBEMOVbuEhJsKDJHcMPmNDPOlpnHdVUpD syV8rGEI6LI87wtS1OgcxLVTL7nBA3kvucDd1RpWnIEtrXvOcr+kEZNa6jXxPq4D9RkFOMUiQ BXPim32D1IpW7YBPDvXhOht5WcYqTOVoTeUJcXLaFiw== X-Spam-Score: -1.7 (-) X-Debbugs-Envelope-To: 75170 Cc: Eli Zaretskii , 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.7 (--) Roland Winkler writes: > Why is it not enough to specify the key of the association that is > supposed to be removed from an alist? What is the purpose of making the > removal of an association also dependent on the values of DEFAULT and the > 2nd arg for setf? Please do not limit your considerations to this special case. DEFAULT and the second arg of setf are different things. The expression you setf to is not necessarily a constant: (setf (alist-get ...) (get-the-element)). About your second question: Please also think about the general case. The promise of (setf PLACE VAL) is that VAL will be stored in PLACE after the operation. The REMOVE arg just means: it is allowed to achieve that by removing an association when appropriate. (alist-get ... DEFAULT ...) will return DEFAULT when an element is not present. If we setf to a different value we can't remove anything from the alist because our promise would not hold and it would not be appropriate. Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 14:09:07 2025 Received: (at 75170) by debbugs.gnu.org; 20 Jan 2025 19:09:07 +0000 Received: from localhost ([127.0.0.1]:52341 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tZx91-00030u-45 for submit@debbugs.gnu.org; Mon, 20 Jan 2025 14:09:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40204) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tZx8w-00030C-Sz for 75170@debbugs.gnu.org; Mon, 20 Jan 2025 14:09:03 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZx8r-0002rG-FI; Mon, 20 Jan 2025 14:08:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=x5Fhl+jqRXdDFagsksJ0C+5UIgbP0sdKMeD9wbBZYKw=; b=PZOzmNvAUAhAqhDQfpH/ PgTtv46XiYjqs/lXlPdvHMQCsA2scfVuRuwULTNJLgowdkTAmAfRx5sVGmJZ5mfxVsXL3j6uz55He BZjMqKR2ef31RFtv6AfqRbFdHk/TCg+dB6G/dIjTVhBSsONmloXYIz9MS5ECVOOFPhCzSvUBShgRk DrT543tylRJznnH/gkjiZ3tul6olqQjae6UNFSyfkatVnUF90vQd4WSqPayLL7J6yrs640BsGmH7K O94SGeWWO6NgqIm9AIWdKzsr08Uqi11gXmL0Gd1Kb8zk2JxIhpqngsnvuYO52M5bWb8ecZqkLvYCm c7X+Yd9z7pDDxA==; From: Roland Winkler To: Michael Heerdegen Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <871pwxha95.fsf@web.de> (Michael Heerdegen's message of "Mon, 20 Jan 2025 14:42:46 +0100") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <87y0z7r1c5.fsf@web.de> <87frlfuy3m.fsf@gnu.org> <87ikqaguor.fsf@web.de> <87sepetamo.fsf@gnu.org> <871pwxha95.fsf@web.de> Date: Mon, 20 Jan 2025 13:08:55 -0600 Message-ID: <87bjw1ti9k.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: Eli Zaretskii , 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Mon, Jan 20 2025, Michael Heerdegen wrote: > Please do not limit your considerations to this special case. DEFAULT > and the second arg of setf are different things. The expression you > setf to is not necessarily a constant: > > (setf (alist-get ...) (get-the-element)). > > > About your second question: Please also think about the general case. > > The promise of (setf PLACE VAL) is that VAL will be stored in PLACE > after the operation. The REMOVE arg just means: it is allowed to > achieve that by removing an association when appropriate. > > (alist-get ... DEFAULT ...) will return DEFAULT > when an element is not present. If we setf to a different value we > can't remove anything from the alist because our promise would not hold > and it would not be appropriate. Sure. - I just do not know real-world examples where this combination of things is an efficient way to go. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 18:28:02 2025 Received: (at 75170) by debbugs.gnu.org; 20 Jan 2025 23:28:03 +0000 Received: from localhost ([127.0.0.1]:52043 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ta1BZ-0000ii-TC for submit@debbugs.gnu.org; Mon, 20 Jan 2025 18:28:02 -0500 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]:49358) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ta1BP-0000hz-Ov for 75170@debbugs.gnu.org; Mon, 20 Jan 2025 18:27:52 -0500 Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-5d982de9547so9809401a12.2 for <75170@debbugs.gnu.org>; Mon, 20 Jan 2025 15:27:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737415665; x=1738020465; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=v+tLl3M2RhVGhLfMBszlWaU0z+aFj9KJKnkfO4X6aMk=; b=hRySmRER594JoeKwIkPcXRj0gJha7AU+JxMHCbd2G0bMaVCiWyvj1uqJXESwwWuYTZ Saky8+wS2O3biHAvTINrgruaCVXPKQ9xmDOnmUc80N3cWjooMSPVXpVgi+57I+Hqn7rN 6bIoCBJM7zq3FKWREYTSl/3vR+RSCI2sEoy3FQHOIZQuU9ngVhw9T17jrC8Uo7wYJbS2 hqzpvIg6nL2NSGboyLzIHPg4urxtBgm7K/sCDTG8fsTC8oE/qdCoCu3rQGfY7eNZjTY2 b4CURPd0yjIdmYIbKt0zA6WntbHgO7JUQiu7a5tbno6fzY7C4Pooiy1P6OcFg6pVgJHW ++Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737415665; x=1738020465; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=v+tLl3M2RhVGhLfMBszlWaU0z+aFj9KJKnkfO4X6aMk=; b=EQUbLl0aW0dZiSKXQXpuv5VLgDSvWRm8xZbwzMu8QRsUwbEg21ot0DwEkXYnrrzQJ/ ERwxaysFgAjcF1YnnRld0ECn0J0lbLsIV8UpqZEv/TCPoHJrawDp5LV8H+bc9UeyKDBi Qe9a0TfN+ytxZqvzs8KDi0TNdkbRGyBeki1TGs5hJOJaDkeoRGZK1AcBGzTmIHF2Cia1 WuuyN3UHDx7XRc49MImhuoi1NcXRCZaAAzuPLPtqqBhvc27TIb6J3B9DrRiLeqda/snO mL5chXvIXBU+ouYo0OIlxCg+AtMohlxHWQcsyDfkTtWNwuNfnIwzVfrQVGDh3Md31hL7 vp7w== X-Forwarded-Encrypted: i=1; AJvYcCWchb2rHnpfWr0WLY2uRs1KXRAmxiaC++4oNOl7cNfbb8q/fqKz0DidwUoko0xaWTYhoTEV7A==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxrVXwPE+2L7JOMSgZ2s0aASQ5aTB6Js5mYhejCvnmELCULc4BA 46+UO+SmF09mBRc+DjdQ7MkRk/yrfH1wPR4g+mZjraJ/nqp3SJapyg5wN26QAqbe7ZrywuGDM6Y 333MgGhuc9ud72m7znYmYrXgQ3rTmH+wSHaM= X-Gm-Gg: ASbGnctGLyF6X7p+qudaoKPems7I0KpVpIYkO/cfrWYQHcWJ9dQTGnjS2jrFvGO1Prs YdEL49UpcQsFIm9J4OeCVeqxvebML6nKJ8Tzt+9hKeA8zLNVHp24= X-Google-Smtp-Source: AGHT+IGhhLdyNih3atGUVr/X/PJANFjA8wtKnG16g8P3Wq+/fsIcXIXBqMAWVdtXuFqA+Llv4wJnOTNQz3475hWznPs= X-Received: by 2002:a05:6402:3496:b0:5cf:bb9e:cca7 with SMTP id 4fb4d7f45d1cf-5db7db29e89mr13710179a12.28.1737405689200; Mon, 20 Jan 2025 12:41:29 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 20 Jan 2025 14:41:28 -0600 From: Stefan Kangas In-Reply-To: <87a5blti3v.fsf@gnu.org> References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> MIME-Version: 1.0 Date: Mon, 20 Jan 2025 14:41:28 -0600 X-Gm-Features: AbW1kvZlnchCGr3Z4rqsfPQ8IK3AAuW2MvaAk6q_N966isueGWBCDfqn-3fZGNM Message-ID: Subject: Re: bug#75170: add-to-alist: new function To: Roland Winkler , Robert Pluim Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, Eli Zaretskii , acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Roland Winkler writes: > On Mon, Jan 20 2025, Robert Pluim wrote: >> I=CA=BCm not sure what this would offer over >> >> (setf (alist-get key alist) value) >> >> which will add a key->value mapping if it doesn=CA=BCt exist, and replac= e >> it if it does. I also don=CA=BCt see a real use for retaining the existi= ng >> mapping: `alist-get' will return the first one anyway. > > By now, this approach has been proposed in this thread a few times. > The question is: this uses the concept of generalized variables. > Is this a concept we recommend to users for their init files? > To the best of my knowledge, previously this has not been the case. > I am tempted to argue that in our recommendations what users should > do in their init files, we should stick to strategies that are as > simple and transparent as possible, and the above does not match > that criterion. A collection of functions we recommend to users for > their init files might be a good thing. add-to-list already serves > that specific purpose, and add-to-alist could be another one. I certainly appreciate the arguments against adding more redundancy to ELisp, but I think the point still stands that Emacs should be easy to customize. Generalized variables don't do that job in my book. Michael Heerdegen pointed out that `map-put!` could though, given: (setq foo '((clown . foot) (thunder . clap))) We get: (map-put! foo 'clown 'hand) Which I compare to: (add-to-alist foo '((clown . hand))) Is that a workable alternative? We lose the symmetry with `add-to-list` of course, but there are fewer parentheses and dots to get wrong, and all we need do is promote it. Which may or may not be easy. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 18:44:31 2025 Received: (at 75170) by debbugs.gnu.org; 20 Jan 2025 23:44:31 +0000 Received: from localhost ([127.0.0.1]:52225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ta1RX-0001f1-69 for submit@debbugs.gnu.org; Mon, 20 Jan 2025 18:44:31 -0500 Received: from mout.web.de ([212.227.15.14]:57567) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ta1RT-0001ek-Ta for 75170@debbugs.gnu.org; Mon, 20 Jan 2025 18:44:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=web.de; s=s29768273; t=1737416656; x=1738021456; i=michael_heerdegen@web.de; bh=CyW0e5LO7vzm0KhuI6fYHGDRfFHiduGD8qPM0yP7BZE=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date: Message-ID:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=CWqmvnujTiraXhSULvdUniNy35qwK1FWs+e8YfudRp9q7nzSTUCzx288lBUBzk/V 59AfysQ2JECGO7W5CeEptD4kj0hyj7Imz15yxGKVeXJZdTarCy4uTec8MVkrhPvF+ mpMrSoIMhlC3Rutx/0iQ1HjNjBSGKL3cA/+blbGku0H8E8YX3aPJsX8yldutXbJm9 D4RmzAk8mggL3Eec5pgWcNDC+18cLSfHGWqfxxq+8romyVsvHE5x+q4HWXI4Vm1cH Bl/3GcFbBYYcrnLXlfbiQ1xrpuKMIR2o/lyBCy2rAyUoqnDuHK/aOPdBAx56Jqoq9 GSpYXA/osIEDrHdtqw== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from drachen.dragon ([92.75.138.197]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1N3Xjb-1tQnYL2n4t-017NeR; Mon, 20 Jan 2025 21:52:06 +0100 From: Michael Heerdegen To: Roland Winkler Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87bjw1ti9k.fsf@gnu.org> (Roland Winkler's message of "Mon, 20 Jan 2025 13:08:55 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <87y0z7r1c5.fsf@web.de> <87frlfuy3m.fsf@gnu.org> <87ikqaguor.fsf@web.de> <87sepetamo.fsf@gnu.org> <871pwxha95.fsf@web.de> <87bjw1ti9k.fsf@gnu.org> Date: Mon, 20 Jan 2025 21:53:21 +0100 Message-ID: <87sepdfbr2.fsf@web.de> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:hd/y/j9sNZUSd04apjhSR41do/HrFEauzp0VzlZlMORjWFB7wsv a5O7oRM5lGkixZIBPC2fgGSoYYf9ME5v8oAJR0QfldweQ/jaoRyHAUo4oZDL/6olqtLXlYY D9FV+EzprqMl63RzrUI7+LSGtYuXVdYPG5xqDtW1r2+zAJ7HXbR9RBtm+QgxneXtfK6tf5R 6h/QnR5E2dwRWNLzgE1eQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:4vA6rjtvifE=;NqvI2Tq78RF/8kw8JTxTGg+6QDZ cpvFNfwsl6QugVG+T/PspOJ2EJDpMEW7Z17R1oRN1sxYM4WZ8OzkRPq6DjkriA5qDMji8tMuH nHA1HQTdIJx0KbEZKFaJhkWWJTcRcW4S4EXFPZyrmAJF/LAkjabGtZxrAG9SdKo3ihHSIjet7 h+ftwDBYoHmp/5+CZo+RLaSbYDaWlI1ltuENEXyG9UQi39S59ssAAlNxAUiu8udtjD8UUDFtj D18N8aDLPcpzrcc6Onpb6ZrqGnYfDuPSKZuI+akjDwNUHUlimdufPhWrTFk6Bqik/vwn2ogU+ atAeKUH26810OjoLu/caeZOaGcYkVhXX9Pyye3kG6bAk5csXLdcG2XayhpG36D+WUXVlysLxg Oud9SCLME0eum35LkOe/g2Kt8/ZXQq8nZ4D7ROYMLQx21kWbv0ao8t3CzO0U7Q/BOxjaftL9r gxxDdjV93O9xqBEcPshobzUTOYyUIoJPjEZMT9w9T8T8tA0PvziDrRJ1BCyMTQyVJIje1WQIs UTta+iN7IvxHumIuwBSOKLQSAuvObO0A7Fqp93gtFnOKQEXeFE8AiJ99d874GRkSSLNoDGNnC R3J2qKxKdCfTecTY2yfmJG4lE/xjkci/srj76QbkZMSscPJ8eIlVgzil2lFoY5jKKoGPlv9UU lVHozbZfMnUXEFTFLVK7X1FzSx5YbitBX64eKCjdk23Dbc+Yu2HVvNOiablj5wby6c2aMNPTp WX55V8ES5sg0nK/NEBmsI52WoumQtvIyKui+1U8Mqvh2hVAnMlsvkT7oHrKxy/ynchczt29LX ewKXnxQyJx4kAfUJVecTp575n1FAE+h4yMEBIc0xhV4FHVc+JfjwfrP24/BEueGKgrUXYgMqG xSD/ayXAGS96lemOr8yIurYaiI5LAMcgBYFA7rLAm2sszWERFDNFwimbbBM3NsynquQXXZm5R KS6NqyrEWgu7y2YDjf4Et+dfbX4F5VYknvCsnabOUMhP4HFdeFAOoZvGou08RbcaRbcEhsF8Z qui+BwPVuLnX9pJ6c9StvXe4IfBbJ/RQAl3qKQw9pC2Z32XPME/NNuAVyS75FYsOUypdpNsay oyUHq+nmERyt9/WjXOBBsRmNH9QYPer1fL045922Kb31GSjXbIN0Akd8xxOIEHsANBtzzHnoL X6S0gDggKD5eSJ2Tp9h9W7Gmxl6Pssp3XyWoyJ/J/KQ== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 75170 Cc: Eli Zaretskii , 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) Roland Winkler writes: > Sure. - I just do not know real-world examples where this combination of > things is an efficient way to go. I don't know what you mean by "efficient", but the Emacs code base has examples of uses. You might want to have a look at them. Michael. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 19:06:22 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 00:06:22 +0000 Received: from localhost ([127.0.0.1]:52311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ta1mf-0002o8-P3 for submit@debbugs.gnu.org; Mon, 20 Jan 2025 19:06:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50358) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ta1md-0002nr-Ou for 75170@debbugs.gnu.org; Mon, 20 Jan 2025 19:06:20 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZyvb-0003CZ-Qt; Mon, 20 Jan 2025 16:03:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=36tjylH/lWsl6NGPEbHKjEnHAI4XUeVXhGtmS2Qi3FQ=; b=IFZh4BwKE0vFPhed+TI3 Pp4qEiYkZKzAv0gfutM2qHbILWTqqeqXFcn1Dd11hKJGynYq69p8vF3wlDwCXRcvUTcA0RApfTXX0 V+EWwerMJdrzsjecaMuZwSrmE585Ktbfo3kugQJGJFj5uou6REm2jdb1ooOpQkcsXVEJadRei8h9X mg2H44GhkhDeS0qmEFVCUcv/auzujyEinB7gtsm3qMLXd1h0KRSidaqNEUr1Ep8ru8ApdRYasBzKG oYTd+K0G03lTqoYkdCUW18bIOtM1zFQfyd3ykTUTEJ16V+2uPJDw7P9I+zN5j0xiCx6JxS68OpiTt addTLl4OyrU6ag==; From: Roland Winkler To: Stefan Kangas Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: (Stefan Kangas's message of "Mon, 20 Jan 2025 14:41:28 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> Date: Mon, 20 Jan 2025 15:03:21 -0600 Message-ID: <87wmepryee.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, Robert Pluim , acorallo@gnu.org, Eli Zaretskii X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Mon, Jan 20 2025, Stefan Kangas wrote: > Michael Heerdegen pointed out that `map-put!` could though, given: > > (setq foo '((clown . foot) (thunder . clap))) > > We get: > > (map-put! foo 'clown 'hand) How does map-put! test for the presence of a key (by default)? This is not documented in the docstring. > Which I compare to: > > (add-to-alist foo '((clown . hand))) I think this should read (add-to-alist 'foo '(clown . hand)) which has fewer parentheses, but foo must be quoted, like with add-to-list. > Is that a workable alternative? We lose the symmetry with `add-to-list` > of course, but there are fewer parentheses and dots to get wrong, and > all we need do is promote it. Which may or may not be easy. From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 19:15:47 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 00:15:47 +0000 Received: from localhost ([127.0.0.1]:52347 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ta1vn-0003IM-68 for submit@debbugs.gnu.org; Mon, 20 Jan 2025 19:15:47 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49836) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ta1vk-0003I7-JS for 75170@debbugs.gnu.org; Mon, 20 Jan 2025 19:15:45 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tZxCV-0003MU-Rq; Mon, 20 Jan 2025 14:12:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=9an+xXN0bn5sOQB6DHdo7WSHvq5nlWYB7PUR0tY/4ZE=; b=fKjSoNwL6DcDu+20AwdB 6iIPri8UM25p6M5ZfaLBW6nsRd/RFaII/jsIar0SjxPS73ZWs/u9TbykOj4cukQxE3yqYKOpLQq9k 5KggU5Ym5YePfhe+hrsh2GuySOETXlJGpLQ/ZLc6Qzv66+OZNcywVt6SRKPBIFXydR91lL4ZAcNeS lFOtEOxDVHObIz4hyDcKiTttad2Pz7jXM7f5pJJTrb9sqFb85ipqt99fOtddpEPfnstmAdPam1YAO lZLptVGQm9tDK7R/C993vAuUvnmU7nTSMDBy2VTmATd4BdX0DVA9nBcJVU/frhoOxaLlr2Hlhb3fC J97MumSPIOALdA==; From: Roland Winkler To: Robert Pluim Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87ed0xd8t5.fsf@gmail.com> (Robert Pluim's message of "Mon, 20 Jan 2025 12:27:34 +0100") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> Date: Mon, 20 Jan 2025 13:12:20 -0600 Message-ID: <87a5blti3v.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, Eli Zaretskii , acorallo@gnu.org, stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Mon, Jan 20 2025, Robert Pluim wrote: > I=CA=BCm not sure what this would offer over > > (setf (alist-get key alist) value) > > which will add a key->value mapping if it doesn=CA=BCt exist, and replace > it if it does. I also don=CA=BCt see a real use for retaining the existing > mapping: `alist-get' will return the first one anyway. By now, this approach has been proposed in this thread a few times. The question is: this uses the concept of generalized variables. Is this a concept we recommend to users for their init files? To the best of my knowledge, previously this has not been the case. I am tempted to argue that in our recommendations what users should do in their init files, we should stick to strategies that are as simple and transparent as possible, and the above does not match that criterion. A collection of functions we recommend to users for their init files might be a good thing. add-to-list already serves that specific purpose, and add-to-alist could be another one. Roland From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 20 19:25:20 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 00:25:20 +0000 Received: from localhost ([127.0.0.1]:52394 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ta251-0003nF-UF for submit@debbugs.gnu.org; Mon, 20 Jan 2025 19:25:20 -0500 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]:46460) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ta250-0003my-Ie for 75170@debbugs.gnu.org; Mon, 20 Jan 2025 19:25:19 -0500 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-53f22fd6832so5285681e87.1 for <75170@debbugs.gnu.org>; Mon, 20 Jan 2025 16:25:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737419112; x=1738023912; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=ZNK2gIxdGEpN7uuzlPBEDX3HVjjnk6U1NxGSBun6pyQ=; b=RKiFddoz4q7rUwmm/fJ+wEi48xVrk9X+8dS/su3ib1uHrgewaOrgmBj1rsRLLO9Sub pnjV+LmlA5LzSAfWIFhz8RJV9jtCFwOh672jPxFFkkSfNm79BF6fdMyROgmgaJ6HwVDa 0DQ/YKYPNEVP+F15JqXCZ2Xq7cKOYvh/IEQBha6dIcnLKU524qQ9xVgL5INURE8taJPQ p/goTvqmjwqhoeHT5WRCEPllgWJY1QnQSSTi9Rzg/mKqzF1Gd6sZ7+5zDr5ctjOnEWSg Y0T1+0mrFkYO89potqwxHpjkrDFEzNYbdL7ygS75t9wmRgkOgyMnx/O/hqj2ATMPaTKO Nr9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737419112; x=1738023912; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZNK2gIxdGEpN7uuzlPBEDX3HVjjnk6U1NxGSBun6pyQ=; b=aCoHPVDrAMYWj79Ef2zr7NpfVg+ZKgeJfQeXycF949ZCDSRzhYKQZW3YoVxPl+W9EO 5rXRPvDGw+ImnNJIfCb5LT6uSHYXYyJII6xB17AQypMEQDIN4R1gS5GjGhFdsbAE9t8d YY9aw+LW0L6bo6DH6YRkDcWx/S1yPREzUhpQn9bZOG9I5R3PyoJbDE/gs8JRXS304z42 q16DUDMs6v+P3BMcYmM79zW9kq3bojVFGIduxFWLEGy4MOucy1hPGvQtr0A2MOSKEeM2 qe6Jb8TgxL2Gxgfu8U2kco/3UyhF8Tgoa5ahyqkraJM1B7VZ5EHyv2S2eRfAaBAnWRTD VQeg== X-Forwarded-Encrypted: i=1; AJvYcCUW2pnkaoaLjUsfElMWX1sFwCFkxkxp/+CYJTb50DCzSs3KOuflDU+0qTbugBvGKbwHbRejiA==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yz/GqYtH++AkWWd8nNFgoyVFaQkNWyCAWdPfbHpDu9ScZyOx07d P+wLdswfNRplCfTq7sNs5xgJkAFGL1ql9+Dzzj+OxphY0Wl41UCvv5u51yae8XAi1khzs1T1fqv 7AeEnH8GepRmZN4PZHEyUCp9DXgrsxEbihvI= X-Gm-Gg: ASbGncvloGo6oNCcAvld47uTyhv1szOPxdDjqD9TKfuueEey09sPZ0wgWVLy+peLMBr WOJccpsa8HXYTK3I9nb049PRcPWrI/5HS2oiYOeQlebT9CwSckq13/A== X-Google-Smtp-Source: AGHT+IHEj4yfz4bKp4w8hSpmy7ZGL/LGuAYpNykcNPwubM90GP6paYEKcDdjd3mIdQXens1iqZuWdqEhi+99h5lOawQ= X-Received: by 2002:a05:6402:2696:b0:5d0:bcdd:ffa7 with SMTP id 4fb4d7f45d1cf-5db7d2e2e0amr12684174a12.3.1737409248608; Mon, 20 Jan 2025 13:40:48 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 20 Jan 2025 15:40:48 -0600 From: Stefan Kangas In-Reply-To: <87wmepryee.fsf@gnu.org> References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> MIME-Version: 1.0 Date: Mon, 20 Jan 2025 15:40:48 -0600 X-Gm-Features: AbW1kvaw2xx7PKPO5a2xQAHohLxiWci1qer0EuOPU0h0QBjyGf5Ocdsy9GwEDuQ Message-ID: Subject: Re: bug#75170: add-to-alist: new function To: Roland Winkler Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, Robert Pluim , acorallo@gnu.org, Eli Zaretskii , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Roland Winkler writes: > On Mon, Jan 20 2025, Stefan Kangas wrote: >> Michael Heerdegen pointed out that `map-put!` could though, given: >> >> (setq foo '((clown . foot) (thunder . clap))) >> >> We get: >> >> (map-put! foo 'clown 'hand) > > How does map-put! test for the presence of a key (by default)? > This is not documented in the docstring. It's not documented, but my testing shows that after the above recipe, foo has this value: ((clown . hand) (thunder . clap)) >> Which I compare to: >> >> (add-to-alist foo '((clown . hand))) > > I think this should read > > (add-to-alist 'foo '(clown . hand)) > > which has fewer parentheses, but foo must be quoted, like with add-to-list. You're right, thanks for correcting that. So less ugly than what I wrote, and close to what an alist looks like anyways. I'm curious to hear more opinions about `map-put!`. I'm also copying in Stefan Monnier, who added that function (or at least named it). >> Is that a workable alternative? We lose the symmetry with `add-to-list` >> of course, but there are fewer parentheses and dots to get wrong, and >> all we need do is promote it. Which may or may not be easy. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 03:22:34 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 08:22:34 +0000 Received: from localhost ([127.0.0.1]:53136 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ta9Wr-0003xt-TD for submit@debbugs.gnu.org; Tue, 21 Jan 2025 03:22:34 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:44205) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ta9Wo-0003xZ-JL for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 03:22:31 -0500 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-385dece873cso2771865f8f.0 for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 00:22:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737447744; x=1738052544; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=KDaRnUL69HpPPUAlhw29Epvmto3nJFPG3g/6NHPzw1w=; b=aX23m5g2PPDILt/QsJNMXzvV20Hy0Sz/S6NdmO0pF3BZ6ghKbevAPmeqZabuhocbsD Zy6gBrBRTc0seBpL64xK3qPRU80+ksJfXaPzQOOxpIB6TApcMxQaj1iIifaKS8g50Oos VV742e41+CP4oIOXtlAzLWoZ9uXAUPwQhlMS5KQuYB0k0wwnkImZKNgAELdabjjQF7pj MJHzyhv8WyedcA/JKwwXdUjSH1Kg4I2irV/gS3C5mq9seGecCNV4atSqA8ATo77mwZ21 Br4iJ+DZtp/MwVXEggGnh1kRquVz8njw/JBA02K+zvKkyIybAeK2b2Ry39Y8+a4cChFh odVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737447744; x=1738052544; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KDaRnUL69HpPPUAlhw29Epvmto3nJFPG3g/6NHPzw1w=; b=X8dvCqZMZ0RviEyfm0fxYxL+NLBFiivfe2YAtM0GcXgbiU7ageDBFex60PB5xIazvp Ke6FmMBWeXPOfjRN/mmpynsahdQKD1iJhWyUvxcodobDWMEMvihvxVBIlThinvNI7gnu 1QJC7OT3FhmbDhockuexzntcsdsjqYrEgqwKjwVnigMV2XXj01hzgVwi2Kus5MGi+cXd w4di9lj225LtNsTYDjGzDnKw9tGgzTM4U9fqY5NmZWgQXDRNsKTpwyv2qVlHKaCVH3O7 epurj//+dUFeM4FnVwVMsn60K8QCXtkP7Sh1jbpswXlKpzBwDKbuzoChGjphvdgtaL+Y Fhgw== X-Forwarded-Encrypted: i=1; AJvYcCVOfAqFain+fMmQjVpvep3/k4qqQNYpG71h8Z0IFGeGnCwRgcIRmDvf7ZjStgnjKGRCYMv2Ig==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxvaP7CiMmMyiHYb69bUoOBgJkdo5YmSMBD3H1tLHV4fZHIlTmx bAoHS0mTnPQu3bX5KLJadCF7HJpp9y8GHsx0K155lyzZbFLGJ/hS X-Gm-Gg: ASbGnctwQqufZhtICKC75pvzRl4a69p/8YhtviwsOPG2CV5QfTxA6rSmwEEGnDHd0QX 2ucZLP92RW0ZtcJI57bH3tqsTLz7YIjPT1cXiIqhpx2D/MLo0UbtkgZsfni+TVWoLVKo/j+nUYG XhJicGStPsYbtmODxsaFnKDS+5ZDRi7VlUQZxv7W6XBNITyr2XyQnrS1q20OYh6rJjqMrNCTc86 2P4ck+7PBs/QrZmYmnXaEeXQgEc0/eoAb5AUpTTsdp5mm3M64q8H3tbAg== X-Google-Smtp-Source: AGHT+IEWbL8xVnQSgh9Lvw1W308SZA+vpSMCgbZbzAS8HciEG66NJrK4YonWDG8rqf6QcE1z+X7RqA== X-Received: by 2002:adf:ab0f:0:b0:38b:d7c3:3768 with SMTP id ffacd0b85a97d-38bf5663661mr9396272f8f.12.1737447744194; Tue, 21 Jan 2025 00:22:24 -0800 (PST) Received: from rltb ([2a01:e0a:3f3:fb51:2aee:9648:dbc3:ae30]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf322ab42sm12395276f8f.44.2025.01.21.00.22.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2025 00:22:23 -0800 (PST) From: Robert Pluim To: Stefan Kangas Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: (Stefan Kangas's message of "Mon, 20 Jan 2025 15:40:48 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> Date: Tue, 21 Jan 2025 09:22:23 +0100 Message-ID: <87ikq8bmps.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, Eli Zaretskii , acorallo@gnu.org, Roland Winkler , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Mon, 20 Jan 2025 15:40:48 -0600, Stefan Kangas said: Stefan> I'm curious to hear more opinions about `map-put!`. I'm also c= opying in Stefan> Stefan Monnier, who added that function (or at least named it). map-put! does not work well with alists that are not 'proper': ELISP> (setq x (list 1 '(2 . 3))) (1 (2 . 3)) ELISP> (map-put! x 2 4) 4 (#o4, #x4, ?\C-d) ELISP> x (1 (2 . 3) 2 4) ELISP> (alist-get 2 x) 3 (#o3, #x3, ?\C-c) ELISP> (setf (alist-get 2 x) 5) 5 (#o5, #x5, ?\C-e) ELISP> x (1 (2 . 5) 2 4) If the intent is to have something that=CA=BCs easy to use and footgun-free for beginners, then I don=CA=BCt think `map-put!' is it. Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 04:06:45 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 09:06:45 +0000 Received: from localhost ([127.0.0.1]:53223 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taADd-0006AR-8D for submit@debbugs.gnu.org; Tue, 21 Jan 2025 04:06:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39762) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taADa-0006A8-5n for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 04:06:42 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taADT-0007Go-Qs; Tue, 21 Jan 2025 04:06:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=iHP9qDMIUCpJVCQ0/Aw+QlsOJy6bO4bshDc6yjXrkzM=; b=M2nsRBd+W/CV 32QKiVfbMoN/OwmAZt0y4lfp+01NRzPLjY2G3Zim+zOw52wBnD17hnby1h9nMvSJwX/rcbP6mJhL4 YiPZzAYgJ+RHe/LzA7gaPlKxSZP40UWAeA6W4/+4AH3/5IgnXYDHUhgDIlakII15y2VCumtUHiuuW 85K8AVP5dzHKlfBn0XQrMU9IEp+/lVZkHC5OIBv09hKItq9zTI+P3A0jNoBlydqBfSE2tCjwhteWS K3p4yLU1klm2Nhs0V63A73XIx16NoZjeRkShZQnPXRJAlHGR0/vQxMSrbnp7Gad8CTWYwliUFkikv b50NwoHv46NXR83mxAN2kw==; Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1taADS-0005yM-Oh; Tue, 21 Jan 2025 04:06:35 -0500 From: "Alfred M. Szmidt" To: Robert Pluim In-Reply-To: <87ikq8bmps.fsf@gmail.com> (message from Robert Pluim on Tue, 21 Jan 2025 09:22:23 +0100) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> Message-Id: Date: Tue, 21 Jan 2025 04:06:34 -0500 X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 75170 Cc: winkler@gnu.org, monnier@gnu.org, 75170@debbugs.gnu.org, stefankangas@gmail.com, eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) Stefan> I'm curious to hear more opinions about `map-put!`. I'm also copying in Stefan> Stefan Monnier, who added that function (or at least named it). map-put! does not work well with alists that are not 'proper': ELISP> (setq x (list 1 '(2 . 3))) (1 (2 . 3)) Why should it work on alists at all? map-put! assumes a map (where is this structure documented? I did not see anything in the Elisp manual), not an alist. Invalid alists will also not work on functions that assume alists. (assoc-delete-all 1 '(1 (2 . 3))) does not delete 1. ELISP> (map-put! x 2 4) 4 (#o4, #x4, ?\C-d) ELISP> x (1 (2 . 3) 2 4) ELISP> (alist-get 2 x) 3 (#o3, #x3, ?\C-c) ELISP> (setf (alist-get 2 x) 5) 5 (#o5, #x5, ?\C-e) ELISP> x (1 (2 . 5) 2 4) If the intent is to have something thatʼs easy to use and footgun-free for beginners, then I donʼt think `map-put!' is it. Robert -- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 04:12:53 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 09:12:53 +0000 Received: from localhost ([127.0.0.1]:53262 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taAJZ-0006Sv-CD for submit@debbugs.gnu.org; Tue, 21 Jan 2025 04:12:53 -0500 Received: from mail-ej1-x62d.google.com ([2a00:1450:4864:20::62d]:43136) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1taAJX-0006Sf-2A for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 04:12:51 -0500 Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-aa679ad4265so1250508866b.0 for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 01:12:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737450765; x=1738055565; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=smmyIUkvcIXe8ExVokuksm2B4+Pn8IAWGC/KRB0HVV8=; b=DiM5Yj0iGsf4M3bNifn4Tz317NcEB1jpPBJIVZbttgaS6vdV8RFpQM4huWHw9Vkz63 yBmZlX4u3uy0NO7TyAPyJDZ9v74ujmELTlCnFUPtDWWEkWONnMbAaBWjYKdgeLC6j7hJ 4hmIghauqi+mPhqbhA6vTdQk8Y++AH7jq/6/qgIjoMdgzqwrsE4MA0RD0a+UnJ7BPtE2 8ErHyHEuKJ4bxLFLk9cf4YM+0++CK+T4A360kD/DoLSes67cqiCo/RwCqbWDKIIoUhrD 19sa873YQRV718SvAq+IMf9UiIUsSSUR0UYxDRO/Eg8RNbDpvj5OfpQD99IdOelewFTZ aPCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737450765; x=1738055565; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=smmyIUkvcIXe8ExVokuksm2B4+Pn8IAWGC/KRB0HVV8=; b=BbRa+dqOoX8EUaBP5cfrVfO4yor93ATDsA9p+1gWqbtNYOAz8T9vQwL6LiUvQa9fNO YXDxwPn+T2dfNjGsfwXFty4fzPI4bFbid9gEAdoyf3skABU4RvYCT/FGA8cOFqa5RClc 5zWTs8MGg7J26tL5Pd44yTI+X+D/vLvgqr6eInu1V55lNOG5FNxB7hc/At9n7CGgnm0T 4AKqaToKeorhd7wUpqqVknKeQyAZDD22g9LoyMgfCKYCkJQsQh3XrE11JWLSg+q+aiVP hSfrPcAtjtnNSrGzuQotPfnuVRHc9Jl6oTzHuiAJUjedozsyydPVRxedaQtPB+YK7qIe Fk0g== X-Gm-Message-State: AOJu0Yy/tcDoJkT9SMPFXnUNbFei5wHo9nLiWw1LwJ0ve2a0f5db1Q19 RZma6rJ42LpEobTGG3vcfuafFg1B0Ezgq76D0s8NiID9u3xe16w3KqDeVE9s0MRLNfrLVTtwDss P9+DmY7/vs1tPGKkQnW8GZr9puOA= X-Gm-Gg: ASbGncteSvpbwzMqpMxYizDliMt0E3UNCxdMsi+Ow95ur3Dc0EstHt2huXogUzAB4EP TXDLz2Fj1B7WXaUsQif5fhLFliWQAwcUp5Rn9X0HJ2T9AfmcuKNooHA== X-Google-Smtp-Source: AGHT+IEw6hsi3hOv2U1SZjNdycto4SjIJBBcleTtr0wSD+TJPzmNI52vQAxfIZbSBvsP/TKJtzEc2ZSJQg61x4PmxOM= X-Received: by 2002:a17:907:3685:b0:ab2:c0b0:3109 with SMTP id a640c23a62f3a-ab36e4069c4mr1748709766b.21.1737450764542; Tue, 21 Jan 2025 01:12:44 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 21 Jan 2025 03:12:44 -0600 From: Stefan Kangas In-Reply-To: References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> MIME-Version: 1.0 Date: Tue, 21 Jan 2025 03:12:43 -0600 X-Gm-Features: AbW1kvbSwkGsHLF84MSejqykf64k9l-3MYiSTah8zT0CQaRTMvPyWfLFfrQkr4A Message-ID: Subject: Re: bug#75170: add-to-alist: new function To: "Alfred M. Szmidt" , Robert Pluim Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: acorallo@gnu.org, eliz@gnu.org, 75170@debbugs.gnu.org, winkler@gnu.org, monnier@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) "Alfred M. Szmidt" writes: > map-put! does not work well with alists that are not 'proper': > > ELISP> (setq x (list 1 '(2 . 3))) > (1 (2 . 3)) > > Why should it work on alists at all? map-put! assumes a map (where is > this structure documented? I did not see anything in the Elisp > manual), not an alist. Invalid alists will also not work on functions > that assume alists. According to M-x describe-package RET map RET: map.el provides generic map-manipulation functions that work on alists, plists, hash-tables, and arrays. All functions are prefixed with "map-". From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 04:35:14 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 09:35:14 +0000 Received: from localhost ([127.0.0.1]:53296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taAfC-0007hW-3J for submit@debbugs.gnu.org; Tue, 21 Jan 2025 04:35:14 -0500 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:61573) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1taAf8-0007bv-Nn for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 04:35:11 -0500 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43675b1155bso61857845e9.2 for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 01:35:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737452104; x=1738056904; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=MiquLzSBs0+Cv/qOJbuHOkPA1k3K+MEnlgKiq/ZL97U=; b=dxzVS/1kwI1dx4+GC/3Sff/ohBj1Y8Ri1scs0zBowKF+EVAzByhKT2sz0xthkVfgsf KQjWcq042KRGCaznT8Q+8YuP+ANsLrWW2RGT7lJzDxFr77Oo3WnyYBD9lBBTPMtNRcDR Q/LyXES4sZ2N3mDoRnhaiBFqdu+Yd6sETG/v78uTD2fLbaaHRYz700qCJ6Y1b4d/6gNn PbnPsGYnxpKeDA+ApaLR12tzEXlAyPxY771i9zlUyPI0mPJQUQAOcORCTmzJWD2UgAkO QsC+s7cZ0K/QVtPb4Ai/nAKsHMHjeNlW9LZ37vVIkGqAtxVU09YCfuZCFG/wAXvkuyE5 GyVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737452104; x=1738056904; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MiquLzSBs0+Cv/qOJbuHOkPA1k3K+MEnlgKiq/ZL97U=; b=lSCHtJkdgX3Cz/+7rkcJKYsF7uC+r650oDoDBSaqOWYv60A3GmRcY1Y2k1sXVZiE0S 3FuzA9ItIBbAsNY0FD2gP3Qhirw+sZUn0WwkTa6zgY+3JB1wXxZXGcQ/rf80suJTn7Na AyJWR4vTBX/uTLIFDKk1ptxaRVYznvMF5IEbBRJK0pkHSXZ+XzZeCRGleDQbIrE2GsnW yUJbbKrqrSxRzl9TfpVkeIW4+sR2djIMZ2vwH9AhtCfhfCgC1LvlTooDE5G/s6ozhB2+ KlrlfHydJ7hYNk4mIMKNu6Qr7g1NFu3sFTUskkFMVtdyudW0b0NuqyN8xirUnKfi4exu Ehag== X-Forwarded-Encrypted: i=1; AJvYcCUXLXsXyKIil4m2niZk7mc0VRN5DMD9oxiiUe75J+epFJYdrLOTTrEw5+fP0NyGU3GP3BXemw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwwYYmQ2UOjJrweUMC8dGA7G32FC6jA2Lxn+cqZNpfW+E7T8Fnj Lufp4r2TQbOQPBlw+ZzfXkzvZfQQK822W9bFIUWBzMWMYfFEPSyt X-Gm-Gg: ASbGncuQn5s2yrmtYQHaNc2sTaih5OA7Uh8/nqv+o9TRk7C5CaBvC2arQcP12bfmlct PkwWD1HB5a6RUyAhWGfxyzR5cqUiOy801eZPF+9dhEeuw3S3aMc9sdKUhdSCcLC0L5TGC/v1e2j 1c/xQU69GhKveBazGfKfPCG0uVlQr/HvSNB+tDIAjf/3kj3dAgNiE3+r2DiTeEQ0vqQ4Wb+Ok1W PcJsBY/WYpHa7qy6uBZH2oB6aWQiJ7RxdDCC2RCTefDstprX9g60YwXZw== X-Google-Smtp-Source: AGHT+IF5GUawzcbdUGMT2Pe3+cZPE0mDBsxwnl/XLZE5LlJTL6E43yhb7Lz+sbRmd+TjkP48MZX5jw== X-Received: by 2002:a05:600c:6c06:b0:436:e8b4:36e7 with SMTP id 5b1f17b1804b1-438913cb191mr144604495e9.8.1737452103743; Tue, 21 Jan 2025 01:35:03 -0800 (PST) Received: from rltb ([2a01:e0a:3f3:fb51:bcac:8c35:35c0:e9dd]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c7527fd1sm234612105e9.31.2025.01.21.01.35.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2025 01:35:03 -0800 (PST) From: Robert Pluim To: Stefan Kangas Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: (Stefan Kangas's message of "Tue, 21 Jan 2025 03:12:43 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> Date: Tue, 21 Jan 2025 10:35:02 +0100 Message-ID: <87ed0wbjcp.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: winkler@gnu.org, monnier@gnu.org, "Alfred M. Szmidt" , 75170@debbugs.gnu.org, eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Tue, 21 Jan 2025 03:12:43 -0600, Stefan Kangas said: Stefan> "Alfred M. Szmidt" writes: >> map-put! does not work well with alists that are not 'proper': >> ELISP> (setq x (list 1 '(2 . 3))) >> (1 (2 . 3)) >> >> Why should it work on alists at all? map-put! assumes a map (where is >> this structure documented? I did not see anything in the Elisp >> manual), not an alist. Invalid alists will also not work on functions >> that assume alists. "invalid alists" is not something that Emacs really cares about: ELISP> (setq y '(1 (2 . 4) 3)) (1 (2 . 4) 3) ELISP> (assoc 2 y) (2 . 4) ELISP> (setf (alist-get 2 y) 66) 66 (#o102, #x42, ?B) ELISP> (assoc 2 y) (2 . 66) ELISP> y (1 (2 . 66) 3) Stefan> According to M-x describe-package RET map RET: Stefan> map.el provides generic map-manipulation functions that work on Stefan> alists, plists, hash-tables, and arrays. All functions are Stefan> prefixed with "map-". Yes. Except that map.el expects alists to be 'proper'. Robert -- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 05:33:58 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 10:33:58 +0000 Received: from localhost ([127.0.0.1]:53371 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taBa2-0002K8-Do for submit@debbugs.gnu.org; Tue, 21 Jan 2025 05:33:58 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48742) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taBZz-0002Jk-RQ for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 05:33:56 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taBZt-00026T-FU; Tue, 21 Jan 2025 05:33:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=T2ekE8t8ld/DrfDDxUPrdVVPL1/FU+8frSEpd3hN7DU=; b=LH8JFCeMu32j HpEAcJQTWRhcOXPQQNe0bxltvWZRclt27/Jm2EIlWQFwKWlcpEmbuosd8X7DUJAbzcE1Px1uo1QJp tBbHYDUwwU0NXBkWm/xig3HPlvNbqogFNjYDYhOBrgf09L5WuFmL/l2LO9Bp+4U/uMfWTNibxjXzZ AMmiKkHKvdcGnzgCpOMGo5Ci5PdvxD+pm95hDyNw2R7KtweOMA85eRfXj605hogT03zglFbAZAi+b yhQqFu5Vto9F73YEQaFppDPVQ+wAhGxbu2czuJ3bEadHfOOIy05BDqohcKJ8d0oUY8jSIQOsWxb9b KKp5GdFrOvfkpcFJNqUfdA==; Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1taBZs-0008Al-4V; Tue, 21 Jan 2025 05:33:48 -0500 From: "Alfred M. Szmidt" To: Stefan Kangas In-Reply-To: (message from Stefan Kangas on Tue, 21 Jan 2025 03:12:43 -0600) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> Message-Id: Date: Tue, 21 Jan 2025 05:33:48 -0500 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: rpluim@gmail.com, winkler@gnu.org, monnier@gnu.org, 75170@debbugs.gnu.org, eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) "Alfred M. Szmidt" writes: > map-put! does not work well with alists that are not 'proper': > > ELISP> (setq x (list 1 '(2 . 3))) > (1 (2 . 3)) > > Why should it work on alists at all? map-put! assumes a map (where is > this structure documented? I did not see anything in the Elisp > manual), not an alist. Invalid alists will also not work on functions > that assume alists. According to M-x describe-package RET map RET: map.el provides generic map-manipulation functions that work on alists, plists, hash-tables, and arrays. All functions are prefixed with "map-". That seems like it cannot possibly work (or very complicated). How do you differetnate between a plist and alist? Order in an alist is important, but not in a plist. Their syntax is exactly the same, how can a insertion function work correctly for that? The above sounds like it is also overloading the concept of sequencess? From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 05:34:08 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 10:34:08 +0000 Received: from localhost ([127.0.0.1]:53374 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taBaB-0002Kq-Qw for submit@debbugs.gnu.org; Tue, 21 Jan 2025 05:34:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48746) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taBa0-0002Jl-AM for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 05:33:56 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taBZu-00026g-Pn; Tue, 21 Jan 2025 05:33:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=byVCMDhMbqgigN0jP4KabSdjSWZ5unAKvoT+DLJcx7o=; b=kd7FF5slYMsI 2oeSJl0JQXy7tL+86jZVYDdTASSkD3UZwYKZNS4GctCAsErgEJkeTEnskJj1r2VPMHA/2ZwvzldC8 7ozsP8SXDMQ3f6mvCW060E7rLfg5UxXu6EVUrK6dE2nuVj+qAIZ3rnLXPXMPKTsi1ksTAtc6ddPoF afDP89s43u3JdODPSvQCFxSFYB7nHwinuWZQIa3b9UA7YYRYp1JGQzNnxlQZW0n1sxV5uycmcyD99 vQcSAzfjt6XAkvlnZTWor20uoZe+DMP624P3L9pzUi5LPhGfv5eIzk8xHdrAar11jAC+RMlJI85/B DP49vzWhJUa4cXs5W0dmtg==; Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1taBZu-0008P6-1z; Tue, 21 Jan 2025 05:33:50 -0500 From: "Alfred M. Szmidt" To: Robert Pluim In-Reply-To: <87ed0wbjcp.fsf@gmail.com> (message from Robert Pluim on Tue, 21 Jan 2025 10:35:02 +0100) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <87ed0wbjcp.fsf@gmail.com> Message-Id: Date: Tue, 21 Jan 2025 05:33:50 -0500 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: winkler@gnu.org, monnier@gnu.org, 75170@debbugs.gnu.org, stefankangas@gmail.com, eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >>>>> On Tue, 21 Jan 2025 03:12:43 -0600, Stefan Kangas said: Stefan> "Alfred M. Szmidt" writes: >> map-put! does not work well with alists that are not 'proper': >> ELISP> (setq x (list 1 '(2 . 3))) >> (1 (2 . 3)) >> >> Why should it work on alists at all? map-put! assumes a map (where is >> this structure documented? I did not see anything in the Elisp >> manual), not an alist. Invalid alists will also not work on functions >> that assume alists. "invalid alists" is not something that Emacs really cares about: Right, so why should map-foo care about such lists? You're saying it "expects" them to be alists, but if it gets another list that is not an alist .. it fails. That is the same behaviour as rest of Emacs, no? ELISP> (setq y '(1 (2 . 4) 3)) (1 (2 . 4) 3) ELISP> (assoc 2 y) (2 . 4) ELISP> (setf (alist-get 2 y) 66) 66 (#o102, #x42, ?B) ELISP> (assoc 2 y) (2 . 66) ELISP> y (1 (2 . 66) 3) Stefan> According to M-x describe-package RET map RET: Stefan> map.el provides generic map-manipulation functions that work on Stefan> alists, plists, hash-tables, and arrays. All functions are Stefan> prefixed with "map-". Yes. Except that map.el expects alists to be 'proper'. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 05:53:59 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 10:53:59 +0000 Received: from localhost ([127.0.0.1]:53402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taBtO-0003LH-NL for submit@debbugs.gnu.org; Tue, 21 Jan 2025 05:53:59 -0500 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:55448) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1taBtM-0003L1-5l for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 05:53:57 -0500 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-436a03197b2so37891065e9.2 for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 02:53:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737456830; x=1738061630; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Wer3lYuaAp3OQEITXrLQIhS/FVDIWy6dlV/AFaXbo0U=; b=amNbAxQi1ec+0wp2/p1C3rSpgZ+quTU3ZtEaQ/PmvmuoLPRPKVCe8enqepW2zcOePS ep5XWJMt0H02caNIX8zPyohO5Jm5Fit9ky1Lmtag7qhpcaGJ8OCuNoaZfOczzdheDBIK m0ux2Gtk/hNnWTZX0ZdGcZUzLX4zncLFwac4ihSmIIi7qrAOeKs/V7GIxLcpNjybEUus 19nSlTkC9Ca7++pkNDKVdAHuJCuQCJVP9v/3bKDhrGoe9+VRybDc9JGvcJ2Wu35vB/6f CSPYdendWP4S1jYlwSOJRuGrZeN7AONySWLO+HzDqXZGQ6ksQ2ZdL83cYPZXeRJyVUuQ 3ZvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737456830; x=1738061630; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Wer3lYuaAp3OQEITXrLQIhS/FVDIWy6dlV/AFaXbo0U=; b=RfhDdhVQ7h39HpMizah7ApF85yWemGAaNI//W3CEPcgp+NRPGeV7/x3iAx8EhvI/EC J+tXHETIGms7LLazQ6CLdCza/ubvOISpMfAKDpLriieRS+Ps8nhUZyNop/FiurMUdGvd nH0or1A4AGBSlR4b/GMaSKY0FlG1/rGJYtFGe9jcMUcjmlo07WnTEv+/eK6qmpXagpTO 4XmBQvLKRypUD+x80YgI6R5hPBQizfz9XE3IcjnZl4uomSPGzxqzjNH7wSqam4CdFerM j1RQcrhvR0SZGeFNQICQQvcWmwzXcGzHch9uUZ34vgdNmer31SGWU9A0N7teSPeRC6RU Z79g== X-Forwarded-Encrypted: i=1; AJvYcCX3JCMzCSRavFtGgWkre3mogHpB08P33SJbyeBa0bsc6BXZ/HWKXqumpvvhFP7h/7dd/3an0g==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyUHP88p0GALx1b5/5fdoeRIzh+Qaj+oeDRarYbK3+6HzlKAS2b Q60mwm/uNgepHSBxCI+4oepaeOwJyzsPcJr/kzdF3v4a3U02ZVtU X-Gm-Gg: ASbGnct5DIOo9qApNJvX555wBKuPEcFFhTRrFEW1ug8UqESvj7bnJo9VDSXmUTNFHXC K+wL7tq3rnEyxQQX5ZHqPVR645Uz9vCjwO0bCzLPSjJbzh1h146xVg07FAuuoB/MBNHJirby9Nt am6LJCqB7sl+U6BjDWE4gXknl7978l/Nw03UPb8YBewK7wKl0xDqn1ybiCeiSbqdrYl+2JP/y1z JDSt8MoOvKDn638tTjVwRh6QwpqmS7eJZHdDMySk/KIb4VdDBF/XsIfkA== X-Google-Smtp-Source: AGHT+IFzQMinVY9fVYAYAUJP6z6g0dg02jP1zq/HpRIpzPhhJCs6YbvpzCB4SFfGJZHTWFA4N8DdTw== X-Received: by 2002:a5d:64c2:0:b0:38b:da6a:8a02 with SMTP id ffacd0b85a97d-38bf59effcdmr14519836f8f.47.1737456829754; Tue, 21 Jan 2025 02:53:49 -0800 (PST) Received: from rltb ([2a01:e0a:3f3:fb51:bcac:8c35:35c0:e9dd]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf322b51bsm13206514f8f.60.2025.01.21.02.53.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2025 02:53:49 -0800 (PST) From: Robert Pluim To: "Alfred M. Szmidt" Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: (Alfred M. Szmidt's message of "Tue, 21 Jan 2025 05:33:50 -0500") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <87ed0wbjcp.fsf@gmail.com> Date: Tue, 21 Jan 2025 11:53:48 +0100 Message-ID: <878qr4bfpf.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: winkler@gnu.org, monnier@gnu.org, 75170@debbugs.gnu.org, stefankangas@gmail.com, eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Tue, 21 Jan 2025 05:33:50 -0500, "Alfred M. Szmidt" = said: Alfred> Right, so why should map-foo care about such lists? You're say= ing it Alfred> "expects" them to be alists, but if it gets another list that i= s not Alfred> an alist .. it fails. That is the same behaviour as rest of Em= acs, Alfred> no? Except that alist-get, assoc, etc don=CA=BCt fail (or at least: the resulting structure is more coherent than what map-put! produces). Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 05:57:33 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 10:57:33 +0000 Received: from localhost ([127.0.0.1]:53411 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taBwq-0003Xw-Lq for submit@debbugs.gnu.org; Tue, 21 Jan 2025 05:57:32 -0500 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]:44261) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1taBwn-0003Xc-3W for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 05:57:30 -0500 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-436345cc17bso39074685e9.0 for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 02:57:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737457043; x=1738061843; darn=debbugs.gnu.org; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=RVg+X68OdG0rY2wRXCbIvnb8nRrRRhUarRkKB5JLRBk=; b=NkqVjz3g+/+I9Odc6fc3xCjQPrNC+3gkkvNxKaLW0InjeA81lpidxjmsksNEVlilsu 4whtZokWkPQtbyrrmM2hE1P8HmUfdnW39YbBwUvjVhke5g9JBpVaJ093/eorTdGcdPRO RmTLfrT1V9PNEsWmokuWH0p28RoQ9nLhhjw92n+ArYSLdZ6fqJ8LvRmGcbYLacb0349A SJe7ov5u9w1Clm2jqknMEoCbU2SFy60j26xwsWcXKP6kva1hn+2AUi32kWwByfK/Sb7B fhuCViQ8mi/PQ3Pd2Z3A9cQDLxDPK7kpYg/yhm4fTUkg1mum+rfi1tx91pc+yHHhkX29 DodA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737457043; x=1738061843; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RVg+X68OdG0rY2wRXCbIvnb8nRrRRhUarRkKB5JLRBk=; b=qJE3uPiokPTAdmdCDE8xEPKI3bL09Iz2D6JEy/aTcPuZbWEcYaQDYekEdw71ysBVGy c0K8wWvywwHNCVXxCFuaRPXKx8Gn3obYcubAcrm208LRpwilVsetYUjImyCmd9rxxeJ4 6lMaPHsu1NAj5yzaqIuxSLu9Y8PjtWXBy9C7i+jtMtaKrsoaNG1ON7Lq8HQbL9IniUEV VnQYa0iTsosN27FrwNdj/74dmQNVfhur6pZ/f5sJsP6K8qWqQInQ0edT2Yo8mqb9mi7P BoCW2+RS5iVqDtxh2KW9Av946UD+678SjdWNc+Bngx9EeShlP1kMPqvr48AKtmCHzD3G LnbA== X-Forwarded-Encrypted: i=1; AJvYcCUH4B2VCJ6qhdIOGAJG7wwQ9isYcfjPTwgU28V8x9F1HeeIpzuxTLfwVdrIEF0ndEtR1kFTRw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwFIs7pnf4I29lCId9HcqxrnpaHdNnBxryqWvaap0Qf8txDXH/f ZHifN0Hd1eJFZ1ydhW8imXCebK7WfyHYsdWkpLzXIVvVp1Gpw01cHNN+fw== X-Gm-Gg: ASbGnct34b3TE0UCYqgJa7ZXWcim4TnKqvpOnWs9OGbfcFxc/nGlIIfYJVo1GATgWlm BB6ijzkgKwP2kMigXL4ehoo6nAUf4KwWPbc1VaE6IOAFcdL3EFWmAceZNivtk31ylvBbXO7Kssa vEotKaj6xQinnmvve6ZjfaoVyJla5v+5fExe4+F9cjeFw1ec3JTOOhPtwo3Prevh5VPdHd9NNfr yT3xaMo6eeWYBaeY2vAOpzzCZYWgzmRECzk88KPSXPesoO4c7OnPAKAZw== X-Google-Smtp-Source: AGHT+IGbzzFa5FLSBkXwOZz5Pi1Y8q4HhMf4gIXJ7JxMNcn6sjveAyOFznJfRPACEIk11Em92mcH+Q== X-Received: by 2002:a05:600c:1c93:b0:434:fbda:1f36 with SMTP id 5b1f17b1804b1-438914299bdmr149062785e9.20.1737457042637; Tue, 21 Jan 2025 02:57:22 -0800 (PST) Received: from rltb ([2a01:e0a:3f3:fb51:bcac:8c35:35c0:e9dd]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-437c74c4751sm231855085e9.19.2025.01.21.02.57.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Jan 2025 02:57:22 -0800 (PST) From: Robert Pluim To: "Alfred M. Szmidt" Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: (Alfred M. Szmidt's message of "Tue, 21 Jan 2025 05:33:48 -0500") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> Date: Tue, 21 Jan 2025 11:57:21 +0100 Message-ID: <874j1sbfji.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: winkler@gnu.org, monnier@gnu.org, 75170@debbugs.gnu.org, Stefan Kangas , eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Tue, 21 Jan 2025 05:33:48 -0500, "Alfred M. Szmidt" said: Alfred> "Alfred M. Szmidt" writes: >> map-put! does not work well with alists that are not 'proper': >> ELISP> (setq x (list 1 '(2 . 3))) >> (1 (2 . 3)) >> >> Why should it work on alists at all? map-put! assumes a map (where is >> this structure documented? I did not see anything in the Elisp >> manual), not an alist. Invalid alists will also not work on functions >> that assume alists. Alfred> According to M-x describe-package RET map RET: Alfred> map.el provides generic map-manipulation functions that work on Alfred> alists, plists, hash-tables, and arrays. All functions are Alfred> prefixed with "map-". Alfred> That seems like it cannot possibly work (or very complicated). How do Alfred> you differetnate between a plist and alist? Order in an alist is Alfred> important, but not in a plist. Their syntax is exactly the same, how Alfred> can a insertion function work correctly for that? map.el assumes that a list that starts with an atom is a plist, and any other list is an alist. alist-get and assoc obviously disagree. Robert -- From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 06:35:14 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 11:35:14 +0000 Received: from localhost ([127.0.0.1]:53472 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taCXK-0005Yl-CZ for submit@debbugs.gnu.org; Tue, 21 Jan 2025 06:35:14 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60900) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taCXF-0005T0-Sb for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 06:35:10 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taCX8-0002Nq-8g; Tue, 21 Jan 2025 06:35:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=mLYEqWa2N4TgnY6N7EWSANPrY35/8/wkWvEXiqoTVuM=; b=ZNs60TVBp0cp vB9cD4MUd5B1ffoKroUe7SMmM8h2A0Umwh9uTYJZ31QYCHtkUMFbyfQH3YDnMorw4ESf/KwCnfzBe cViCeWv/FxW2sijFgwov3LEQc2Z64VGsi+nSkBsDyMzXF1LW1CbsdD5WQGOB8ws0JiGrM7pMoKEyX v+RP0QFQEoaF7pCEVkzIG157vDOX6F9geGFn8eYve64vAwvuBlHailTWPGbNrxcST5zkf6FnFy2YF z9YcL5acFTaUxnovNJATm7j5a3Z18gMQ9MGtgOfH8zcOnB9oAiyIKE69v+7AeDOx5tRH8qdaGR4Rx 419bczAv1nFUgFI9uwcBpg==; Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1taCX1-0000wI-Vt; Tue, 21 Jan 2025 06:34:56 -0500 From: "Alfred M. Szmidt" To: Robert Pluim In-Reply-To: <878qr4bfpf.fsf@gmail.com> (message from Robert Pluim on Tue, 21 Jan 2025 11:53:48 +0100) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <87ed0wbjcp.fsf@gmail.com> <878qr4bfpf.fsf@gmail.com> Message-Id: Date: Tue, 21 Jan 2025 06:34:55 -0500 X-Spam-Score: -2.1 (--) X-Debbugs-Envelope-To: 75170 Cc: winkler@gnu.org, monnier@gnu.org, 75170@debbugs.gnu.org, stefankangas@gmail.com, eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.1 (---) >>>>> On Tue, 21 Jan 2025 05:33:50 -0500, "Alfred M. Szmidt" said: Alfred> Right, so why should map-foo care about such lists? You're saying it Alfred> "expects" them to be alists, but if it gets another list that is not Alfred> an alist .. it fails. That is the same behaviour as rest of Emacs, Alfred> no? Except that alist-get, assoc, etc donʼt fail (or at least: the resulting structure is more coherent than what map-put! produces). I don't follow, your example with map-put! did not fail just strange result, which is no different if you use alist/plist specific functions on thigns that are not plists or alists. map-put! cannot know if the thing it is stuff things into is a plist, alist, list ... which is why this type of function can never really be well behaved. The alist/plist functions are specially named for that reason. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 08:09:39 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 13:09:39 +0000 Received: from localhost ([127.0.0.1]:53666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taE0g-0006YA-SX for submit@debbugs.gnu.org; Tue, 21 Jan 2025 08:09:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56438) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taE0d-0006Xp-LR for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 08:09:36 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taE0X-0008O6-An; Tue, 21 Jan 2025 08:09:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=Y8tVdeHunppF/IuhM6q4qNDs9724i0wT8VCKkBML48c=; b=Z9hfSQ50nwqT Ep8p+HBr1WYEAV3UeEHuPTnBSlZwZVI0Fl2+h1TOvBls/w3flh1TxuU1LDWE72YZ+zGOio0qm9kjp YBO2uaWKaR8XD3UG17WzHkT9ZDp0aCXqC4qkvOhSEBVZNbZk9fJ2B33bP/byknKDHdBXHL6v2Zg7D ckTeEq3UYLGBcK2rxwNtj/iK6USXlHKGPSe0m3ynF1bW6X6hqism4pnT3UqHpwgtASpwyXcLKPr8t dLmkX6x1Dj2PQ//zlQiEjmdCJVOiiYh4FlMdGZbXn3uO0+ejx/14gvsao33DmWDeSA7YNNhLPwyN+ 4chQ6ay2/LyZyp8ABs0etw==; Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1taE0R-0001ki-UX; Tue, 21 Jan 2025 08:09:27 -0500 From: "Alfred M. Szmidt" To: Robert Pluim In-Reply-To: <874j1sbfji.fsf@gmail.com> (message from Robert Pluim on Tue, 21 Jan 2025 11:57:21 +0100) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <874j1sbfji.fsf@gmail.com> Message-Id: Date: Tue, 21 Jan 2025 08:09:23 -0500 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: winkler@gnu.org, monnier@gnu.org, 75170@debbugs.gnu.org, stefankangas@gmail.com, eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >>>>> On Tue, 21 Jan 2025 05:33:48 -0500, "Alfred M. Szmidt" said: Alfred> "Alfred M. Szmidt" writes: >> map-put! does not work well with alists that are not 'proper': >> ELISP> (setq x (list 1 '(2 . 3))) >> (1 (2 . 3)) >> >> Why should it work on alists at all? map-put! assumes a map (where is >> this structure documented? I did not see anything in the Elisp >> manual), not an alist. Invalid alists will also not work on functions >> that assume alists. Alfred> According to M-x describe-package RET map RET: Alfred> map.el provides generic map-manipulation functions that work on Alfred> alists, plists, hash-tables, and arrays. All functions are Alfred> prefixed with "map-". Alfred> That seems like it cannot possibly work (or very complicated). How do Alfred> you differetnate between a plist and alist? Order in an alist is Alfred> important, but not in a plist. Their syntax is exactly the same, how Alfred> can a insertion function work correctly for that? map.el assumes that a list that starts with an atom is a plist, and any other list is an alist. alist-get and assoc obviously disagree. That is just wrong. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 08:09:39 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 13:09:39 +0000 Received: from localhost ([127.0.0.1]:53668 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taE0h-0006YC-8h for submit@debbugs.gnu.org; Tue, 21 Jan 2025 08:09:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:56452) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taE0d-0006Xq-PC for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 08:09:36 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taE0Y-0008OA-Fa; Tue, 21 Jan 2025 08:09:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=4w+9cYV8K4jo/odcgaiZTaBbGHVuwI7YZcSLsLgZSTg=; b=sNpL7yjCWdlT UUtylSuakJ5BEZ9KtX0LTIRCazRZjEySR47DqteAdw4UlMwSiOP4tuYpcYGvRIkM4HvTFlgKwUyPz 9LnrUIvchMYLDuISdtLOCYFFFA8xQCc3RAxvnE2BHHJGC5FaQ97XORGejE/Hyslz2nXzXVdb4KyvW zfnyCryaUbcbMorXtsLzwwJe7vDi65YzWMJYO6g2DRt/gZiY6QJT/CwBrwiiFD93VU5Ia4PI+7O8m zOQYIi7+uWVsoj+490WRMKFtz6y8QJHe2gexYnv1+74pMDBpM3sfZMd5In93Rx7Zq4NUIF1tHuTQO GFbJIaXzIq15GMuyOMaAdA==; Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1taE0X-0001nU-Fr; Tue, 21 Jan 2025 08:09:29 -0500 From: "Alfred M. Szmidt" To: Robert Pluim In-Reply-To: <874j1sbfji.fsf@gmail.com> (message from Robert Pluim on Tue, 21 Jan 2025 11:57:21 +0100) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <874j1sbfji.fsf@gmail.com> Message-Id: Date: Tue, 21 Jan 2025 08:09:29 -0500 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: winkler@gnu.org, monnier@gnu.org, 75170@debbugs.gnu.org, stefankangas@gmail.com, eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) >>>>> On Tue, 21 Jan 2025 05:33:48 -0500, "Alfred M. Szmidt" said: Alfred> "Alfred M. Szmidt" writes: >> map-put! does not work well with alists that are not 'proper': >> ELISP> (setq x (list 1 '(2 . 3))) >> (1 (2 . 3)) >> >> Why should it work on alists at all? map-put! assumes a map (where is >> this structure documented? I did not see anything in the Elisp >> manual), not an alist. Invalid alists will also not work on functions >> that assume alists. Alfred> According to M-x describe-package RET map RET: Alfred> map.el provides generic map-manipulation functions that work on Alfred> alists, plists, hash-tables, and arrays. All functions are Alfred> prefixed with "map-". Alfred> That seems like it cannot possibly work (or very complicated). How do Alfred> you differetnate between a plist and alist? Order in an alist is Alfred> important, but not in a plist. Their syntax is exactly the same, how Alfred> can a insertion function work correctly for that? map.el assumes that a list that starts with an atom is a plist, and any other list is an alist. That is just wrong. alist-get and assoc obviously disagree. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 13:48:11 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 18:48:11 +0000 Received: from localhost ([127.0.0.1]:56544 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taJIF-0006Lf-S0 for submit@debbugs.gnu.org; Tue, 21 Jan 2025 13:48:11 -0500 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:61493) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1taJHU-0006KF-Cn for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 13:47:20 -0500 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5d3f28a4fccso9360458a12.2 for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 10:47:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737485234; x=1738090034; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=AX5k/uMOARN0BsO5VkdVSNmb+sdkCWKQuz5D3uftRTo=; b=drjp1ZFbPBN7YukxwskPoSICdfp6lCEz+fZ/LBhynNkISVKDQE9D4rQC6KGRh4pkpc Pwv2rYb0d7U6PaNobotnj3lxbRsOcv7L34AZFkm3/s5cEP0PSFmG5LisK7VEXSCRYl9f 7O39eTeWYN/iKv1WeuXnxmhcnoDB2KJR/Pv6+LXtHW7fxlW/xNewbjOkz4chZE+Uo5IK 1gTYUrOwAIN+6t4OSyu2S8khDh16Vrn7ZqA1EOFrmNQCKzfLnOHL/2GkVK1zJEibFQIX yZYRSdKIXX6lG91QhdIbjKmTzqqg+rdQcWnXUuFcbUj4aKwSowsMroQCBy1E3+laIWFP lUJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737485234; x=1738090034; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=AX5k/uMOARN0BsO5VkdVSNmb+sdkCWKQuz5D3uftRTo=; b=j7j6GS0B7anwVHb4Kg8il4HF9Cd7Lye9LSUZz+y7BhYohcHzNYTOadMfcXE/SF+Iui Er2dsNLNl/ZLPz9r/ZpW+feGsZ0nm9URcK2Ho9JS7gHpaoBduvyCrzpSvmHqrQOKgNyl Ir4qGHQE1kAce7SceDdAo8HKQTYSKz2fg0t7Qsi8+DjK5ZlMBtjvMT3ELELbSaDLfryf y8wm/EZLkhKbqgCt25wMheJ2fAMnINKYw1yBYceoQAX4ArVZ46ob3Qxesd99c1mjGgim C8GKzAEO34Bic1fB+z8bJZtMltSW5WdM9ZzgSUrOIcOpzjK5UmLTifsS5DGRIezUUVLN +jtg== X-Forwarded-Encrypted: i=1; AJvYcCVsoVmjaNpFEvU1i+mffmQFN2wmtjVEvPbjcVW5vqsKS4Ay8dMKRnjPIdDV6wpMu3e0R0jHcw==@debbugs.gnu.org X-Gm-Message-State: AOJu0Yy3cEVN5EwGjL1I6HbkHMh0NC1m/5K0Vnv/9BoIKilICh9ZdO2p MzcthypVrJloRwJ4wq0TRQ/U4Mn3GXjbKbBTNzHTyyrurrzxSFlV1WBOxcOLt+eUu/L1mDgTQ5A wm0pT6fTlDTx4NDs6EOW1vc0lvAU= X-Gm-Gg: ASbGnctKxz5wPtREw2gM4qArAur+DEQLyIH1o5XtP8DMiXWaXCSwQYHpnTLD6pk3E13 yPxiYN3uAKNEyYdzqzF15YHOt4Mu4umgvzDNdIp0jT1YIl/OBD2jP X-Google-Smtp-Source: AGHT+IHCRfo0/PfkTo1NFmw0WFBhKlK3OCXgc6wyjy7iQwYXu46U2zMrltjMNHGy1175j9g+EpcXgaTbuuqe8JNlfyg= X-Received: by 2002:a05:6402:270d:b0:5cf:e9d6:cc8a with SMTP id 4fb4d7f45d1cf-5db7db148e2mr14939358a12.20.1737485234130; Tue, 21 Jan 2025 10:47:14 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 21 Jan 2025 10:47:13 -0800 From: Stefan Kangas In-Reply-To: <87ikq8bmps.fsf@gmail.com> References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> MIME-Version: 1.0 Date: Tue, 21 Jan 2025 10:47:13 -0800 X-Gm-Features: AbW1kvZv0gPdoVX0wATHwIPsciOiab9HtNjHYg5z0U3NQtxMA4EVLC5Zy5twLvw Message-ID: Subject: Re: bug#75170: add-to-alist: new function To: Robert Pluim Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, Eli Zaretskii , acorallo@gnu.org, Roland Winkler , Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Robert Pluim writes: >>>>>> On Mon, 20 Jan 2025 15:40:48 -0600, Stefan Kangas said: > > Stefan> I'm curious to hear more opinions about `map-put!`. I'm also= copying in > Stefan> Stefan Monnier, who added that function (or at least named it= ). > > map-put! does not work well with alists that are not 'proper': > > ELISP> (setq x (list 1 '(2 . 3))) > (1 (2 . 3)) > > ELISP> (map-put! x 2 4) > 4 > (#o4, #x4, ?\C-d) > ELISP> x > (1 (2 . 3) 2 4) > > ELISP> (alist-get 2 x) > 3 > (#o3, #x3, ?\C-c) > ELISP> (setf (alist-get 2 x) 5) > 5 > (#o5, #x5, ?\C-e) > ELISP> x > (1 (2 . 5) 2 4) > > If the intent is to have something that=CA=BCs easy to use and footgun-fr= ee > for beginners, then I don=CA=BCt think `map-put!' is it. Thanks, I think this and the subsequent discussion shows that you're right about that. So `map-put!` is not a good alternative to `add-to-alist`. I don't think generalized variables are either, not for something intended for end-users and not developers (as `add-to-list` is). What are we left with? Maybe we should just add `add-to-alist`. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 13:50:27 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 18:50:27 +0000 Received: from localhost ([127.0.0.1]:56551 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taJKU-0006V5-Ue for submit@debbugs.gnu.org; Tue, 21 Jan 2025 13:50:27 -0500 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]:49455) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1taJKR-0006Uo-OB for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 13:50:24 -0500 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-5da135d3162so10181767a12.3 for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 10:50:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737485416; x=1738090216; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=ihiLsJUjKlBllCICf+gmp8MECI6V6QU1u7jOTKy4Ngo=; b=CizSAXeaM7tpM5xjHDEJEJe0us56MC17gsvjD5o2UmwTVxpxiw9mObMoIQWR6n1pHE 7OgYOAayPqKN8thmLlB5uHFMNEKWRj82VCl7+FsNFmr/0BhpWc+oGgU7AWjDTTztx0jV cp5grW9gs8UBk+uTnNRIcpn8Jb+eb5dKWy0+3m/z/lxgl94xXhIi3W9yngv7eUTlmVaJ 5G2VWf4OXee6DcSHbvHfPoWj094gBHfiWX+CMR4bPHL5qXmE7u4MW7oMH3i4027ztbl2 AyGagLKlIZJHvOUxZXEoiYvWyVDQO+mN7REuJrl6iXH1C9LEg+RJxyo08yzv56JHWIRR VNOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737485416; x=1738090216; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ihiLsJUjKlBllCICf+gmp8MECI6V6QU1u7jOTKy4Ngo=; b=Bxb5/dATxvlxJieZa7uidQ2i0qIFLeaWjNpl5JqRcQT+nk7NRyuoTZP3mTHN5CENht 72QA+zwhvVwjixTIK879XiWCQfFfkYhPvDRXmybIT1x4bIRW0Z1YJqqMAKmEz5vep0ro NVKEZoHZNDMUEiO1FXOTn6X1EqEXQfkTxfMZNCzsGSfWssEGPNB5RJwOC0YakTTfFKpa ymRsB/qy8Nl2pQJxZZha+XVQ91cPb0e9zp2E83khdqDwkK5PUOjd3b0NnPiES8MoPFDL OFai/jteAFH5KFUhNtJo/gM/L1TDb7KVBzX/qLlr+VjjcNCmTdYWVfkES5byp7drSK1/ 5pdw== X-Gm-Message-State: AOJu0Ywzb2NRRzX1q+bpcLzCTlefeJliODbBQr82RXEyedQtx+PkszLd Ue02ehmXseLz5pjvWpvTNN940XPvxw0ldmupmMwZM/SFAzaMTRy/dJVNz3iJNK1kF7/NEy0ZmFs mUqQNQ6JN9QnDuOa3ZkeubFiKulI= X-Gm-Gg: ASbGncs0q4OAYqfCbkmePcINuESyywyiLRilYNWeotWfnYi6HnQDvUKDR+8uPCjzLMr QiYDtL0fJRnnfKpxzc8W2arnsVdd6aIWMK3DhTDziObySumw4AQp4 X-Google-Smtp-Source: AGHT+IF7TNVDcfn7D/gpvy3dpMnF1As0nyQzd0CaXf9nahPvoz0UbxDz3YNVjGTOi//gOKrvgClVwxQliPo+eWep3EE= X-Received: by 2002:a05:6402:35c2:b0:5d0:c098:69 with SMTP id 4fb4d7f45d1cf-5db7d300552mr17293951a12.16.1737485416357; Tue, 21 Jan 2025 10:50:16 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 21 Jan 2025 12:50:16 -0600 From: Stefan Kangas In-Reply-To: <874j1sbfji.fsf@gmail.com> References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <874j1sbfji.fsf@gmail.com> MIME-Version: 1.0 Date: Tue, 21 Jan 2025 12:50:16 -0600 X-Gm-Features: AbW1kvZX7x1xaUQLED5jRZ0du5GVFdXg6sfVQwtgo0yRQPrSFdbPG-M66Mp0X0o Message-ID: Subject: Re: bug#75170: add-to-alist: new function To: Robert Pluim , "Alfred M. Szmidt" Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: acorallo@gnu.org, eliz@gnu.org, 75170@debbugs.gnu.org, winkler@gnu.org, monnier@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Robert Pluim writes: > map.el assumes that a list that starts with an atom is a plist, and > any other list is an alist. alist-get and assoc obviously disagree. This is a tangent, but I'd be curious to know how much use map.el is getting. It doesn't seem to be too popular in emacs.git at least. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 14:28:05 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 19:28:05 +0000 Received: from localhost ([127.0.0.1]:56651 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taJuv-0000Ro-G0 for submit@debbugs.gnu.org; Tue, 21 Jan 2025 14:28:05 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52204) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taJuo-0000Ql-33 for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 14:28:01 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taJoF-0001x4-3j; Tue, 21 Jan 2025 14:21:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=gculPriZbtYp5wqhG4D8dyviG/RWVbRGjyJkTaVeeZI=; b=Z+STt3S4A9kt+bwPX4IF FUlw1moVjdCdvdVUQL9UlR9UbnIayA7TjEuflXLFQFAdSE3/4wLXScVasZpimxgQKMRPTW7fOJjYS nNlKe/iPI36EiB7271evhMYqSNqx5h4APKR+C0TKWA+7AUaxFK4AAcjwLbpDrdAp4wIpnwPq/qYpx SjS8qXK6vN2+8s0Iay6OHX4sHTBksf0r5A81EiGo0ELFGLVVhNRBvL5rnWBDimBd9jOvTohsTEOHg KvQCkN2v6NcAwan84JqxQRbONy5QZFeV4aMNvF+UOmb8h1cAlh4RIhJOZGBlP9gjo5cOnwy7a75pw o8spmriZw0rc/A==; From: Roland Winkler To: Eli Zaretskii Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <868qr43rnl.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 21 Jan 2025 21:15:10 +0200") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <868qr43rnl.fsf@gnu.org> Date: Tue, 21 Jan 2025 13:21:01 -0600 Message-ID: <87msfk0y8y.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, rpluim@gmail.com, acorallo@gnu.org, Stefan Kangas , monnier@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Tue, Jan 21 2025, Eli Zaretskii wrote: > Can someone tell me again why add-to-list doesn't fit the bill of > being a tool easy for end-users? I've been using it in my init files > to customize stuff like default-frame-alist since about forever. The following was my answer from end of last year: On Sun, Dec 29 2024, Roland Winkler wrote: > The advantage I see for also having the function add-to-alist is the > following: > > add-to-list checks for the presence of an element in a list. In the > case of alists, this means it checks for the presence of associations. > You cannot easily modify an existing association with add-to-list. If > you have an alist with association (foo . bar) and you call add-to-list > with an element (foo . baz), add-to-list will not remove the association > (foo . bar), but the alist will then contain both associations. > > add-to-alist checks for the presence of keys and it makes sure that each > key appears only once in an alist. By default, it replaces the value of > an existing key. This makes it easy to modify an existing association. > Only with the optional arg NO-REPLACE non-nil, it will preserve an > existing association. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 14:28:18 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 19:28:18 +0000 Received: from localhost ([127.0.0.1]:56653 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taJv7-0000SB-4x for submit@debbugs.gnu.org; Tue, 21 Jan 2025 14:28:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:52204) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taJus-0000Ql-2Q for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 14:28:02 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taJiV-00010W-Du; Tue, 21 Jan 2025 14:15:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=FecqrtE9mnWp6DPStALwM6V4VV8KFLMGgUxdj79YQ5E=; b=P2SwHHxstujc g4FkVHEpJz/Ar2K74N85bxG6JRtRfEqmcxrhEVnrEYIps/UfdeMJToAOerzv1haR4JuOovJA2P9nh lRDkgcUy2EI3ZNzSmuzwiXLA6HBXRx9Iu4oDJaBHi/bHHA6mSp6G1Brnp2J8FxjkETBkiJEBKgHGN o1VDfvYP/StZ9UxGEXs4Qc2JljCuU3cCsfQpghc5yQXJj2g9aixcFVi/guqcgsS3s8C8VZiHn7MS1 kIYM4veTcx98LkMxuxFRYlGCinovH42fb/CykRWQcbtlFR7Nb1dtDt+wKw2oZizrRbL71/oncqW+r +9UYqXIC9/yG3dWJMICJGA==; Date: Tue, 21 Jan 2025 21:15:10 +0200 Message-Id: <868qr43rnl.fsf@gnu.org> From: Eli Zaretskii To: Stefan Kangas In-Reply-To: (message from Stefan Kangas on Tue, 21 Jan 2025 10:47:13 -0800) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, rpluim@gmail.com, acorallo@gnu.org, winkler@gnu.org, monnier@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Kangas > Date: Tue, 21 Jan 2025 10:47:13 -0800 > Cc: Roland Winkler , Eli Zaretskii , acorallo@gnu.org, > 75170@debbugs.gnu.org, Stefan Monnier > > So `map-put!` is not a good alternative to `add-to-alist`. I don't > think generalized variables are either, not for something intended for > end-users and not developers (as `add-to-list` is). > > What are we left with? Maybe we should just add `add-to-alist`. Can someone tell me again why add-to-list doesn't fit the bill of being a tool easy for end-users? I've been using it in my init files to customize stuff like default-frame-alist since about forever. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 14:35:20 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 19:35:20 +0000 Received: from localhost ([127.0.0.1]:56677 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taK1v-0000xF-TS for submit@debbugs.gnu.org; Tue, 21 Jan 2025 14:35:20 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53064) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taK1s-0000ww-Tx for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 14:35:17 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taK1m-0004Fc-QB; Tue, 21 Jan 2025 14:35:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=EuuDdiKqLWEIUz/8Bt10HM2tvzOmpY+eiPrFLLoA2nU=; b=Wzzr67gapkSI FH4bMruGYBr/QrPLWCYwo+J+h3eswQsTePNGpNa7PYvIzU7UAcmyFmUHQ/90aGWvJUH0FLUmSmWzG h+Ey0DMgfGOsfAqtiRBt9FrbEGPY6/+amsE3vVJ55aDRtK3OceFp/NaUNW88VeUcQltBIkKpFTjNN dIIBHjgG5rBlUkGX62gd7jaRE4LL1WxKNqJGyE49V184MaJB9+Z+xnFY/xfYpw2xI0gVczxBuVIeV 2i5x6L7T1KRl9jXmKzJl201nFRAFO5bS0nTk0Q8JabqWI3PUDLD5mh4LZjlL8CAuiDpcvmLVBmEYz NPqHsGxHFVN0BxqcjyQtBg==; Date: Tue, 21 Jan 2025 21:35:05 +0200 Message-Id: <864j1s3qqe.fsf@gnu.org> From: Eli Zaretskii To: Roland Winkler In-Reply-To: <87msfk0y8y.fsf@gnu.org> (message from Roland Winkler on Tue, 21 Jan 2025 13:21:01 -0600) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <868qr43rnl.fsf@gnu.org> <87msfk0y8y.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, rpluim@gmail.com, acorallo@gnu.org, stefankangas@gmail.com, monnier@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Roland Winkler > Cc: Stefan Kangas , rpluim@gmail.com, > acorallo@gnu.org, 75170@debbugs.gnu.org, monnier@gnu.org > Date: Tue, 21 Jan 2025 13:21:01 -0600 > > On Tue, Jan 21 2025, Eli Zaretskii wrote: > > Can someone tell me again why add-to-list doesn't fit the bill of > > being a tool easy for end-users? I've been using it in my init files > > to customize stuff like default-frame-alist since about forever. > > The following was my answer from end of last year: > > On Sun, Dec 29 2024, Roland Winkler wrote: > > The advantage I see for also having the function add-to-alist is the > > following: > > > > add-to-list checks for the presence of an element in a list. In the > > case of alists, this means it checks for the presence of associations. > > You cannot easily modify an existing association with add-to-list. If > > you have an alist with association (foo . bar) and you call add-to-list > > with an element (foo . baz), add-to-list will not remove the association > > (foo . bar), but the alist will then contain both associations. > > > > add-to-alist checks for the presence of keys and it makes sure that each > > key appears only once in an alist. By default, it replaces the value of > > an existing key. This makes it easy to modify an existing association. > > Only with the optional arg NO-REPLACE non-nil, it will preserve an > > existing association. I know all this, but why do we think end-users who aren't comfortable with alist-get and setf will need to "check for the presence of keys and make sure that each key appears only once in an alist"? Since by default add-to-list prepends the new association, those which come after it don't matter, right? So if we want to cater to people for whom Lisp is not a first language, why do we think they need anything beyond add-to-list? Does the fact that I still use add-to-list, so many years after I started using Emacs, tell something? From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 14:41:27 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 19:41:27 +0000 Received: from localhost ([127.0.0.1]:56698 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taK7r-0001E1-At for submit@debbugs.gnu.org; Tue, 21 Jan 2025 14:41:27 -0500 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:59828) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1taK7n-0001Dm-NH for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 14:41:24 -0500 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5db689a87cbso12019525a12.3 for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 11:41:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737488477; x=1738093277; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=WzgUbKMZnyoFaP7jYaKExjIcQhQZTLWPJ9x3Vxxf7ME=; b=HA2bxobRyIwZ9eS2JczRfeDf52ZZVdEiX2SjhUpUuA9zdwdvzdfnlFKeJnTr0Ot6P7 yQIowpU9TF2EhQZnl+CQf7gxf3keksS0i283Hr32UMSuAWt1NxPR8OU2dlLJvoSWGKXG te1BWxLuTiw8FSXT8ueBQfO2wXS8M6LVui6XaxnKSMCDbKxjxPM84nPDWXmwU3BU1GVw 2Yy8oY5OKYCdMw6uMP3Orc/zTVRUtMtMdaBEQzJGV/bXy0Uq41EWAMn32aVc5VVcpEfu j9lGl9czhzc4+1VQWs3lizsy+WrQhpE4Up/OnWDh9OFDLkN6hXZMEb/8Dem14wioMnpJ f+Tw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737488477; x=1738093277; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WzgUbKMZnyoFaP7jYaKExjIcQhQZTLWPJ9x3Vxxf7ME=; b=YhIOX9lfmb1fSL6SEG9qCVMRV0ntGmfgNAziQ9o2Q1L17eS7YN3x0hSZxduBRH6jjI +iovS4UoTDUfA2+hbZzSWK8WN2OpkLIERlEwoQ2GijftikDVxyhQiCyGPPbARPz77vwE r7sSV9DV/n1rWwJ0iIIusLoINzoLhm0RI2AlXFOSo1bkpGvzAkRMae8+8jZMuklboS93 14FypdB3obmxXPPakeqrPZsdfFVTfvP12eWJp6cmTXybkb5RkaDv5Nba4PzRTBEgxSCw a2v/nl4T8eLKV+3e8j8Gph1/d1kdHMWxWF/VcK+S22hWXGBigJwOID5QyEMxSsApl96P oMSg== X-Forwarded-Encrypted: i=1; AJvYcCUFVQLfelX2imLWGfmROFpUBTueMi/qdr8ZsR48mekWQj1GTAiHrUUgWCiCId/A+cvkTf75Jw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxgBpYwZtNYOSzrIT/2zlsYif65s/JA7+A1q60zaV7N+f0QTWkp 4PKf6BEwrjcW3fVdlr7/Y7+A05asEyL8mzCrRCkGAwQ5NCH6rFqCd1sh7cs2Jw9wPhlsNqvmJG6 CQhSxkH3FsslcRontFBVEWSgwaM0= X-Gm-Gg: ASbGncsC6ebtPWv/6MbUDRHYxWHMw9uBsO3EyriA53Yp7zzd07DgdM9vDAB9Qg7BJac a+PfCDqLVMqThSLYM7+W0BaJVPuCZeJBB6TumzC0C2NMl8UH3sH/g X-Google-Smtp-Source: AGHT+IHHsas1N93/KuK6qTxKjBso29BfC9bGlj+qweqQ7u4sVWqMx3namq7LQyLcnzy9GWV0AOstTdXZXQ2WJ/SPvzU= X-Received: by 2002:a05:6402:2347:b0:5d0:e2c8:dc8d with SMTP id 4fb4d7f45d1cf-5db7d3392d6mr17374118a12.20.1737488477427; Tue, 21 Jan 2025 11:41:17 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 21 Jan 2025 13:41:17 -0600 From: Stefan Kangas In-Reply-To: <87msfk0y8y.fsf@gnu.org> References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <868qr43rnl.fsf@gnu.org> <87msfk0y8y.fsf@gnu.org> MIME-Version: 1.0 Date: Tue, 21 Jan 2025 13:41:17 -0600 X-Gm-Features: AbW1kvY8ZdB1b0yxF40WlisfWOg4jL7xP-6GGVRMbEQS4zOsVJIRdz7LULeYpOg Message-ID: Subject: Re: bug#75170: add-to-alist: new function To: Roland Winkler , Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, rpluim@gmail.com, acorallo@gnu.org, monnier@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Roland Winkler writes: > On Tue, Jan 21 2025, Eli Zaretskii wrote: >> Can someone tell me again why add-to-list doesn't fit the bill of >> being a tool easy for end-users? I've been using it in my init files >> to customize stuff like default-frame-alist since about forever. > > The following was my answer from end of last year: > > On Sun, Dec 29 2024, Roland Winkler wrote: >> The advantage I see for also having the function add-to-alist is the >> following: >> >> add-to-list checks for the presence of an element in a list. In the >> case of alists, this means it checks for the presence of associations. >> You cannot easily modify an existing association with add-to-list. If >> you have an alist with association (foo . bar) and you call add-to-list >> with an element (foo . baz), add-to-list will not remove the association >> (foo . bar), but the alist will then contain both associations. >> >> add-to-alist checks for the presence of keys and it makes sure that each >> key appears only once in an alist. By default, it replaces the value of >> an existing key. This makes it easy to modify an existing association. >> Only with the optional arg NO-REPLACE non-nil, it will preserve an >> existing association. I believe that the "contains both associations" part is what will risk confusing some users. It's not a given that they know that the first one is the one that will be used. It could just as easily have been the last one, for example. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 15:30:34 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 20:30:34 +0000 Received: from localhost ([127.0.0.1]:56816 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taKtG-0003s2-Qh for submit@debbugs.gnu.org; Tue, 21 Jan 2025 15:30:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58308) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taKtD-0003rk-U8 for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 15:30:24 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taKt6-00035f-IW; Tue, 21 Jan 2025 15:30:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Y8aUl4q5F/5ztJQ6hCScGuOw2FtRJgmVE23nD6IV5XE=; b=g/Xe0HOcszpa Ak/33zsWixzldwhZU8nAJyd+wb1gldoY/bn1ALN4bORc2N8JnnGw9QNdi3JS7c/smZliDpwax9otK 79+R262bF6jtTXAkCM6rmxA3/K0PVvekc3CLqXCP0jnLN7/kz9slKzJN+25JsWrZ7LJ9ShkKm0DhM 9KGYHzic6cF1ML7M918ooqgHwi7nIGSBFd6jDpTToYi9jFtb3v9W65qkccaTInW791pjq5OcgaW/X lTWmB6VnVDENOcIigiEL1wyHZpeTMCYx9UppwHvXcahZ11hY/VA2pOot+ow+p5mi8CZjt/UWEYjqi zZhlkP7XZ0X4ptPZkESSpQ==; Date: Tue, 21 Jan 2025 22:30:12 +0200 Message-Id: <8634hb52qz.fsf@gnu.org> From: Eli Zaretskii To: Stefan Kangas In-Reply-To: (message from Stefan Kangas on Tue, 21 Jan 2025 13:41:17 -0600) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <868qr43rnl.fsf@gnu.org> <87msfk0y8y.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, rpluim@gmail.com, acorallo@gnu.org, winkler@gnu.org, monnier@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) > From: Stefan Kangas > Date: Tue, 21 Jan 2025 13:41:17 -0600 > Cc: rpluim@gmail.com, acorallo@gnu.org, 75170@debbugs.gnu.org, monnier@gnu.org > > >> add-to-list checks for the presence of an element in a list. In the > >> case of alists, this means it checks for the presence of associations. > >> You cannot easily modify an existing association with add-to-list. If > >> you have an alist with association (foo . bar) and you call add-to-list > >> with an element (foo . baz), add-to-list will not remove the association > >> (foo . bar), but the alist will then contain both associations. > >> > >> add-to-alist checks for the presence of keys and it makes sure that each > >> key appears only once in an alist. By default, it replaces the value of > >> an existing key. This makes it easy to modify an existing association. > >> Only with the optional arg NO-REPLACE non-nil, it will preserve an > >> existing association. > > I believe that the "contains both associations" part is what will risk > confusing some users. It's not a given that they know that the first > one is the one that will be used. It could just as easily have been the > last one, for example. And yet add-to-list is exactly what we tell users to use, see the node (emacs) Frame Parameters. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 15:34:19 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 20:34:19 +0000 Received: from localhost ([127.0.0.1]:56821 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taKwx-0003zT-Mi for submit@debbugs.gnu.org; Tue, 21 Jan 2025 15:34:18 -0500 Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c]:58473) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1taKwv-0003z7-9G for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 15:34:13 -0500 Received: by mail-ed1-x52c.google.com with SMTP id 4fb4d7f45d1cf-5d414b8af7bso12732371a12.0 for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 12:34:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737491644; x=1738096444; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=euM3YuP9ZTr6MWWKK8WmltwPmepB4d4IxjKPx+VAn9Y=; b=EGK9/tafwWdmhnvjrOQRyh3TLepUpdL1g3FhExrYkxwAgq8l6h431OAD3eJmBETNhH 5UQuQt8zzN/w5FZz3hMlmZFzkBoc5WMUefyJ0nDyHQtCwaFBVBSkHcJOXk0NCjWpl3H0 6r9AdGP+WezyopWEXNGRWTvCjBOp2/8AV2TlS6loH8tbvILuR62nY0jTE6sqKkcGQv/X G72j1e4vRqd6oMaWJzEnryrZSz1AVZDNCgVPlEPpv5vc9LsN6K0YK3bfQG6ltBWzjwt2 yv5R+ka75L8/B8M4aefo3tjMjhy3JXPcbWt6Adq2GPUjIwstvl2B+2/umii5WaKXK9In x9mQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737491644; x=1738096444; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=euM3YuP9ZTr6MWWKK8WmltwPmepB4d4IxjKPx+VAn9Y=; b=RyXFrOqRa9xO3mG8y7LOVlLSXGcs11nNFyagEpT12jQEYj+vPtTCIrMHDfri3STe+N Spk4fjxrMa2Gbb0oQ0g7yKy5LewbLV2Ir9e9+4nMS4ZdW93D+yE5SRQe52+7+Mn+yEQS Zhez8AoR577Jw3FlfVmDbSSMEngDb5pP+1AoT68JZKIHwvn9NFgos3jXJaMVyw2J2AR9 vcpn2CgsYNJZt5vcARkGCnI+j32eNdm2rpdTRaJSygC7/mPzHhA8bfTa+YQWexCwEWmq RRcfBxKI+HNSSOLIcJMHZa9g65j4betOGpwoLLlWd76yTwMpT8y1O9bXIf+OPSJcI/C0 rJtA== X-Forwarded-Encrypted: i=1; AJvYcCU79REBxnQPntZSNJFrb2gFxCEyAgO90Gij/yGdSewzkgKn0uxxo4fvF7t7Cmb+HDOjFLgJuw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzKdPoFxWmcddOD0tGS6v9+9zw+vky+dOdyBzhlJ8cvBfJ6Fn32 BklcSxVywDUEI76tQHiV3eRktRny1oxP6fxFHU63K7r0c8rG57T2vZaovKj4DukKiCB4XlGRa1H ciA29fcbqtQ2M2nYNSvyHx9aXiSM= X-Gm-Gg: ASbGncvr5BrQuK/IAj+RXZjlDd3wpmUIjye7uhCnvKVTNL8tXlnW44gagK7iMOVHysD pHWouO0NefH8Zx2TQQTQ7b+4i45m55RM2aDdPRsMw0oGf9mOWKuVsbQ== X-Google-Smtp-Source: AGHT+IEJuOys/2sCc6L0cJ1VTUjB8DD/Eii6bntkfZ07DGMSQZUoeGXdmLtKT1ylFknXZ2lbx83ZytRKgNuNyxNTThE= X-Received: by 2002:a05:6402:2347:b0:5d0:e2c8:dc8d with SMTP id 4fb4d7f45d1cf-5db7d3392d6mr17517566a12.20.1737491643948; Tue, 21 Jan 2025 12:34:03 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 21 Jan 2025 14:34:02 -0600 From: Stefan Kangas In-Reply-To: <8634hb52qz.fsf@gnu.org> References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <868qr43rnl.fsf@gnu.org> <87msfk0y8y.fsf@gnu.org> <8634hb52qz.fsf@gnu.org> MIME-Version: 1.0 Date: Tue, 21 Jan 2025 14:34:02 -0600 X-Gm-Features: AbW1kvYgUhcJFLM3ZRIm6z02yV4LC23jp1E6pnBpUix4jRZr-kmSCLiYfAV13ic Message-ID: Subject: Re: bug#75170: add-to-alist: new function To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, rpluim@gmail.com, acorallo@gnu.org, winkler@gnu.org, monnier@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> From: Stefan Kangas >> Date: Tue, 21 Jan 2025 13:41:17 -0600 >> Cc: rpluim@gmail.com, acorallo@gnu.org, 75170@debbugs.gnu.org, monnier@gnu.org >> >> I believe that the "contains both associations" part is what will risk >> confusing some users. It's not a given that they know that the first >> one is the one that will be used. It could just as easily have been the >> last one, for example. > > And yet add-to-list is exactly what we tell users to use, see the node > (emacs) Frame Parameters. I'm personally on the fence about this addition. I see good arguments both for and against. Given your doubts, maybe we should close this as a wontfix. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 15:35:01 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 20:35:02 +0000 Received: from localhost ([127.0.0.1]:56824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taKxh-00040s-Ev for submit@debbugs.gnu.org; Tue, 21 Jan 2025 15:35:01 -0500 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]:47237) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1taKxa-00040S-UF for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 15:34:59 -0500 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-5d647d5df90so10251758a12.2 for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 12:34:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737491689; x=1738096489; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=e2HaHancnNZaTi+yC8UgXvkj4tHc027TStkBwxvUMxc=; b=jAf8zz8hAPiFTAH/Ri8i5VrpLf3g4zJewPMD9Ja6ISIKAKCAb5lozjAX4wwh+Yfadl ZDqF5O7riO2+LYOPPbdgc4aif6TSqS9KYRNw4N1wHt1v2DAIqwJAziHdq/JnMtw2Elt/ 9wwuZuWFEsIulaVxQ0uDJrf/NbmGzV7+yYd+4VnXl3pEE4m2+Z1BFTuXs9wtGt1Rg32w BDE0Pp/KZnPd49Q+PJu03cS3QQz0VvsNXrdQBiy3LTr67W1Z5W6Me0ogUSrd8zCKUX6g 0/jFgzSQ5NQL2OS2U/JNnFawEaCdKIXdj3FlMFBK7yqCbbDVMkTPmqUPA1VZ1IRRQgox qn0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737491689; x=1738096489; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=e2HaHancnNZaTi+yC8UgXvkj4tHc027TStkBwxvUMxc=; b=C5JI5U3QMAbrNIgrQxXc5d4qttouHWOY45rP49Sij3ZwdIvTLOd9nCI6TbVmK9N9wH kYWlAfPRF9JkYLTLLb2zRLlYpPs7PB8TGsZKFGzErBKP3WCLIJuSGEG6X7jEwGwY7GzC d9gLLlxD1V3tlnpJ26eTvrBzK+uEfWOqi4iXl9LAaV6ODrwQdK78ODluBQkXlR1AywiK rj5q9fnMb8nBvLsywpXgLzX7tzqKcKqp1ZvywYXiCfW4kV20fudwrBUrHT+UwGFGhF+y RJ14B/DZJTJ3+7p+gb6TGIQBWcZziGsTio4dgEF82j3o4Ef7JN1KM5kYfxR3b8hbiIo6 v9pg== X-Forwarded-Encrypted: i=1; AJvYcCUvbxiaYlb0RPuh29p5jBz0Bh3C4g9iLknSa8G+W2PUw0fWIWPegUhyRHlutqV1YgWa3iz1yg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YzZ1/5NlM7bZxxUhvcQiR2MxBMuKfqkH7D7hEAw7sKkZ8pnrpBM wXHmSLrhFPQtJ5zRBhdFH+q4t99g9Y9N2pZTgjlzbjkOvLvQIdweTBYGsjzduFexnMobykrjbah H18ba/CNI9XQCbFqyqCGvdU4DFvT4l/kaIY8= X-Gm-Gg: ASbGncuFz7FBx/jyOYJsEUY6b/wIBgjhxaSTskiJoPx+KZuwtRxtATw0XFzFPRwpmul NjuD7tzFd95yFECEC2P/cHrkZfDQm3/dxsDr5SUnuBWHTbgB+hTk9qw== X-Google-Smtp-Source: AGHT+IHUTjIZIWuS+ajDVDPF5SWVnbPZB8/iShiluToDrGvNzSu5aMmh178V7hN91lFLJ8TzvknqWTrNBMhB/LCQ8fA= X-Received: by 2002:a05:6402:2110:b0:5d3:ba42:ea03 with SMTP id 4fb4d7f45d1cf-5db7d2f8135mr13315911a12.8.1737491688679; Tue, 21 Jan 2025 12:34:48 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 21 Jan 2025 14:34:48 -0600 From: Stefan Kangas In-Reply-To: References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <868qr43rnl.fsf@gnu.org> <87msfk0y8y.fsf@gnu.org> <8634hb52qz.fsf@gnu.org> MIME-Version: 1.0 Date: Tue, 21 Jan 2025 14:34:48 -0600 X-Gm-Features: AbW1kvYOsW8w0MSrzhUyrMQI1LVjQbqVI7Vnu8E-JX1YcSZw3tpSpBf0OLor55U Message-ID: Subject: Re: bug#75170: add-to-alist: new function To: Eli Zaretskii Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, rpluim@gmail.com, acorallo@gnu.org, winkler@gnu.org, monnier@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Stefan Kangas writes: > Eli Zaretskii writes: > >>> From: Stefan Kangas >>> Date: Tue, 21 Jan 2025 13:41:17 -0600 >>> Cc: rpluim@gmail.com, acorallo@gnu.org, 75170@debbugs.gnu.org, monnier@gnu.org >>> >>> I believe that the "contains both associations" part is what will risk >>> confusing some users. It's not a given that they know that the first >>> one is the one that will be used. It could just as easily have been the >>> last one, for example. >> >> And yet add-to-list is exactly what we tell users to use, see the node >> (emacs) Frame Parameters. > > I'm personally on the fence about this addition. I see good arguments > both for and against. > > Given your doubts, maybe we should close this as a wontfix. I sent that too soon. It should have read: Given your doubts, and the controversy around this, maybe we should close this as a wontfix. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 15:57:42 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 20:57:42 +0000 Received: from localhost ([127.0.0.1]:56888 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taLJY-0005Ai-JO for submit@debbugs.gnu.org; Tue, 21 Jan 2025 15:57:41 -0500 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]:36726) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taLJV-0005AQ-MW for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 15:57:34 -0500 Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50LJJr2j020586; Tue, 21 Jan 2025 20:57:32 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=OVrzPzdqt/F8RSD3lwWIaCwelYl3NR/cbpRTscxUGb8=; b= ZfXgkoaErHF13Ed5rIRX3G1pZqVkCpy7YHcfjNzgf+eew4XbQfI7fA031JmoE136 Q7mIND8DZDHLRbU4s4VwznXTEY8NDMD6ZM6RCiZbwkS88yw/wcI3EyjPXwD+FgyR wuz4gStYjxAEyBz1f6s/u0ZcbXFoOe9GecdGjfxrhH31gkqGzfHczGvHWA4kN6JS 5Nky8jlzBNu47+5zLx17G93epuUcCVyWnz8jXOlAqROB+jwYpsi+SONx4/BDD0wt 5vpUIVvMId5Lof0zYjLrEIROmvUzRbGHTdqs8E9zFIZUSoPY9b0cQl8F7GHV92uN zx9yzwJuq3SRaqBNYT2u1A== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4485nseab4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jan 2025 20:57:31 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 50LKjI8a038962; Tue, 21 Jan 2025 20:57:31 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2173.outbound.protection.outlook.com [104.47.57.173]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 4491a0hftx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jan 2025 20:57:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=P7azZI84QzUSbPtX4czbnq4b6rJcm3nerOQBnm5t/twJWjIY2OWuxm+9eK3kWFsWn4J+OpwWdtHytkmIk9+6p2odMLDoAXGw1CpJKRPoMGtAdGfbm4TmbBYUPdmCNV/qESJSXStMs61ONvbyqEfFQfW0vd1a6+288hK61R0Cm3VCJR4taveij5JMJLfoLdmn2kX1Tz9TDzGsgq9ra1FaWLjEZxXebnxSCsRyvUh+yNB3MA0HlwB4gMrr2FXlB0sqi9YIF4gtfuZGNmkGvXxoSDDjLsYifwNsxvTP31Rzu21ad7hSvc8xcX/2igf5zcWxQxdCq9dKNhUxypZU32f3TQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=OVrzPzdqt/F8RSD3lwWIaCwelYl3NR/cbpRTscxUGb8=; b=jOGewNF+mE8AI9Ig++VF3Atacrtak3q7vtugrU0ZIsytITKl8pI3xwJdVnzVcSGL/O1GR/Qh2yM5sQZuWctuTvvjxeGLq+oFzrkO6pEoJ+NN5/K+htt0dYbD4Gy1wzjNp/fHYBHakaviQYj6BOwS5htps8CiCL48cgc4qQSIeqqpmRJ+l7gy/27eZqTNNoXkGid0MPKEb5CztFQIA+RFLNx5QrycqQZ8R4IErSQrtsBJcgqiRe7zBiFyW6CqeBhAxevdlrCrniq+4/xwpNwl6X57ZBb4rFRWU6y3Gb4LXTvI1lLW/tiQpMDziCWILRFF5WAoavxMSx5JnFiSs1C9yw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OVrzPzdqt/F8RSD3lwWIaCwelYl3NR/cbpRTscxUGb8=; b=ml2InfOsLZJ/9fcwbILyU69Hi8qUqd3YwpnTSBUunKZNXDTzKkCbfFehKlg4iJjbrfti6BVSZ+Cvo3YnPXDG+KVr8Mi+lTjyAMUNDdso5qTqL339FJKG+l8CFSSJTYnFuGvBDwtkozAXzCgpkN/CIwVFk/r/srjTa2W8oZUsUY8= Received: from DS7PR10MB5232.namprd10.prod.outlook.com (2603:10b6:5:3aa::24) by SJ2PR10MB7620.namprd10.prod.outlook.com (2603:10b6:a03:53f::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.16; Tue, 21 Jan 2025 20:57:28 +0000 Received: from DS7PR10MB5232.namprd10.prod.outlook.com ([fe80::8303:658f:14f8:2324]) by DS7PR10MB5232.namprd10.prod.outlook.com ([fe80::8303:658f:14f8:2324%4]) with mapi id 15.20.8377.009; Tue, 21 Jan 2025 20:57:28 +0000 From: Drew Adams To: Roland Winkler , Eli Zaretskii Subject: RE: [External] : bug#75170: add-to-alist: new function Thread-Topic: [External] : bug#75170: add-to-alist: new function Thread-Index: AQHbbDrBEETsl0stMkC4D+LyPhZ+Z7Mhs/Lw Date: Tue, 21 Jan 2025 20:57:28 +0000 Message-ID: References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <868qr43rnl.fsf@gnu.org> <87msfk0y8y.fsf@gnu.org> In-Reply-To: <87msfk0y8y.fsf@gnu.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DS7PR10MB5232:EE_|SJ2PR10MB7620:EE_ x-ms-office365-filtering-correlation-id: 30289b9d-68c0-4226-fcc5-08dd3a5e3753 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|376014|366016|1800799024|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?FJHZ8mZrxpTA21DjEgT5y/NomKhQHhSF9hftj6wZrIr3VSA2NrWaKY0VPndC?= =?us-ascii?Q?ENDCm1/xYNtI1vHBpTgydHblARxZYh1P2Pk0t4HlkKqGQVBx7xjEFSiAESsW?= =?us-ascii?Q?lGoES5UWxllPzCuj5XMOatwlRkhOvmvBX6cLJdpt9pHKSY+iI5KQDLywJPoK?= =?us-ascii?Q?Y4Dd2snT36TPG2E8UEyKJlv54S8ZhyX5rJkECa6PbeC33YDnzuTZZze0G4cF?= =?us-ascii?Q?BfMBD0xCD/cmtDvZO8t9J1AF+nGCyh7ISz7Oz3bz5ifh2TbmZASGuXLrUgi9?= =?us-ascii?Q?WqWg7Mwj9feXKv6L0ho//2neE6xMSLhnjXzhR+1ldOJoFEVrwrKL1HXn2p3O?= =?us-ascii?Q?kgRARAS8jMj7JIXeJw6oEqJY6Qix6ycGNYzo9/joOaFJsknp68F65ImJD47U?= =?us-ascii?Q?IIBZRrEsPIL1FC27J9/x+t+5DN2sq/tgngPMN3hvG44P8aGCZijbvlnnB+cQ?= =?us-ascii?Q?2sZRkzK26H46dbV0wotE4MatZ6djyc+jDw6F1VUdyYw1xdnvPT7l6b0NtMSZ?= =?us-ascii?Q?J/ckirrN1IquMU8uI+XXjQraLA2ajixdDU8DcdqNJM6InIe67Ls9amaaPosl?= =?us-ascii?Q?rcBJx5JhaNYQNJkRrkiITnyoXF5jERqwcUDtWteJbB06IsFZ12FUuhUbPqo/?= =?us-ascii?Q?6JMgRfoQP8g3rUHuhG4tfCJ3B2MJ7stzi7NYbHQmQQtHMHRfrJgYlx5NL4ZN?= =?us-ascii?Q?8Jnp/CLfveBWkJuA+DORBRMlcOQv0G+Lh53bcZ8/7k+9snyc5wkpcjTHBMpG?= =?us-ascii?Q?XE/wV8mIrH5R//WTT6GxZLOIUivnYwr8mx/vTylSBg+Vp5ezpdZbNVoB75UG?= =?us-ascii?Q?ewGgngSkprIVOEAiBB7NRp01QH0xxoEm942C4n1YoQxSqTL0KtltLbhtGD7a?= =?us-ascii?Q?Q32tPdMj2NAOBA9pbFHFd7yrYUZT6qBTTVfB4/ibfdkf+BXXcgEzNuCgitc6?= =?us-ascii?Q?3Qyr6wNAu+hMMSBccsNmUmnkzMzfW2DWTxuBywcItRwOflTf4auUgBF5TZWf?= =?us-ascii?Q?3wozNST2f4unLIQ4oh4XwrxEAiBWv23xNBYkmQaGVWSEwNXwtyFs/CImfFPD?= =?us-ascii?Q?/Rnal/r1uZvGQLamMlkQ8I6+5hr3jyBgEpUTMzCiRz0NnRcG7FPo+5fVLqQQ?= =?us-ascii?Q?VpWHKPI3MIxS12r9I69yCRRQX7RiG2DhbkJa2woTGEmidsh+2AdtJOVXG8pU?= =?us-ascii?Q?VNc7QPvZ36aNIyso4q5ykm1zKL4RRS9F0B2t/bSQ7CPN4AElCBFMi4WVJV9e?= =?us-ascii?Q?dHLhUDbZ2ndvLJPveuouNEJTa+ApnpQT9GB2eARR8j62LxPZWyzU5w0diJ5P?= =?us-ascii?Q?HZe3ZJvBpGj7WwuepyxPnQtVdnnXRSK3qNz8RljB5AzsUln8VjfuMbKek7ek?= =?us-ascii?Q?eZfZkJvTA2/VbMHN57ni3M/U2vzG3f9kOVLXFDj7le8dtgSKOQu60yuNpQQH?= =?us-ascii?Q?zHaUJnm0bkE=3D?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS7PR10MB5232.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(366016)(1800799024)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?2kz+msO4J4DcVH3RlIZmoAQg+tHwK/QbPyFLFrMi4dy/1I6DW2XYdd9rgvgo?= =?us-ascii?Q?yde5a5bLeJF3Xd5nhtyhsVCJD5JD9JgNErhOgEutbLGu+li+IsW6YVIjq3xT?= =?us-ascii?Q?lQijeMbEt3S5O5yRezGgY6Z/5Ap2kWUuwt4pPcVwMqzrzq+dzQN4st7LgXRK?= =?us-ascii?Q?0hzaR3H66MGh+pYWDJbj3AY6JdBlY+cF/mWUGTtRNFN+1pNfwpSkoQF8sZOd?= =?us-ascii?Q?a/vQDGy7kT4gFdiOO+b+gaO4XpTE1eCGKOoO9SaJpOZb9B4xsVebC8woicTr?= =?us-ascii?Q?2DrFXVtxAmChiS+J6r5wjspUMOchkRSX4u5GRVqCfKpQahsUo6ewGOYz11mg?= =?us-ascii?Q?un/wT+7ENIjjWE8wOMtsy/dJAyGJKlqixgRtiBnaflVFv8Xq1UQamEAGoC+U?= =?us-ascii?Q?aIDjBw6/46i6XQUK5VEGwgm7ovIEvmozePbf1fVkUWKJ0I9J4jVpF9YQKlpQ?= =?us-ascii?Q?gdmBP+GrAn6raBKaNLS01MCcKsD9NgXILWWG0pMmNJBCmNGCtbKeMsMue21V?= =?us-ascii?Q?9Js7OQoDES+eraIj7hH6X8RQQuUVZeUa8uVWn2nh7Q1Iv7VmUMvIIPPQsDkv?= =?us-ascii?Q?8DjS7l179g5KD1XtCOfVlCHMWK/BKMkFNexLmxjf+QTj4qyLLP0Aza/6QxTI?= =?us-ascii?Q?Q+9gTnf7AsuLQ54adkg2slSrKNNg0jzXQ3BfaOqcEDq/yRhxbDvB0LWRVKkZ?= =?us-ascii?Q?T4HQE7kKwKTIyUh5X904XeVjmCWNuzwLtqRVVHcH35jg05zcausUq9VXB57G?= =?us-ascii?Q?E3BOfy4J3jLyPIPqp+FqVVv+F7pPrEu2AZNY4a1PqF4ACjDXTWRJI1sniIM/?= =?us-ascii?Q?KxVp7SmV0XyBzBBmU+Lony+JvhzHWKXUqgx7jEGJKpX2XqOsWl++ll5HpZQC?= =?us-ascii?Q?CaEhHAlOTYkxDRNZlbCAyFHKKTJwHPF+TDH8StgB4QgfhVtiQ7Lh60estaHe?= =?us-ascii?Q?8thoLVEABJWPSJLA6dH+/tWe94cnz3CIypylQzpzBoCH9tt6k1kxzMAMSJdc?= =?us-ascii?Q?2u8H4fH/EASkcL/jNpnZDOXkXzoeTT7EjQjHC3SgCPrUFEXXCd+e50kECSKs?= =?us-ascii?Q?SdfxwJ5/m4KPmmP8y3lV/J9b8RB2BXvev4at2tehQUuzrvYww4rP0YWaGsCT?= =?us-ascii?Q?0D+IySDRxEtEE8iQCZw5RpKSKg+wj5sCJwnTUxsWegS2j7p36WDa4QQynEQu?= =?us-ascii?Q?vPs1BsN4SVjO+2/SjVOTC6Y0osqRMBNNsEyaXF0tMWXVsTTdm+3dg4L3ynf5?= =?us-ascii?Q?uxlD8C4bmSNNiTAdAaoZIKGC2f4szmfnf0HT4FxigFacDZ8sbhOXfDchPR7R?= =?us-ascii?Q?5Z2g7unecJBGbT3J+kXbaapYGgpUHOmwmv1NaofuQUewLKEam6y2ufHiQ00m?= =?us-ascii?Q?cPDJcbVOAHX92pba23eC7HD1uHvlrJvedX4eUrj6oKM5+5Uf6pq0zzh1I8+Q?= =?us-ascii?Q?tPSSKyygZH+0At8lRCrvdapk2+Ho3S5CLD0oD4w9Jj/dZmhsHigxtPkCnzZm?= =?us-ascii?Q?a+aGr/En1rhkoXfDfAaf3xWVpEP7BE9DzBNS9kVhTQosDpwyfIqrhTshv3H7?= =?us-ascii?Q?sFIb2fRTGjk4U9+0JrixwBRUAN5Qxz9oFQqBH8fh?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: wwkxK5yQMXcpyGoGRfPnx8JlARJvnN4NRA9zROjydCKYF7vLvZehr6JTvCT2dE3ADc6W4gdt4OkHSdc3iHUhe5YGhroKFzSOpc0SFbKpIYnjlYcBNwlOb2uFe1PqR5fNB+G1fXvPtU4l2faU2SqW6IGblvq4VbBXvPG8WVvnSXSPgDlaWfZIoOPLl6FRgrjUkj4Ug3Q2e7zHUsw0PVS3ieZLQACPjVSgbD4wHzVviOG7ndBPU5JTy3YhacF/Zi+8CAEp8VDTiGJJdJbuRsKJANh0XlivbRX/46H5DfuWNbuXNI5ud0SufArYYfEE0J8FidSLRCYbsdiMd7Pwz/NtMx3r5CPGGEcMho0DKWgbbVrc0Z5k11S/eIPq1tS0uKTWJIFpx4D9Fbz62gV3oaPYTxxnfsW45w7k97cjqkMMwaRYZN2bjJFN1Nq/HVvJcftBjTPxf7y/2KHPxTPN7NerlqMdWlJCR1Uqq+77rI/FE3IN/emgkpBi0FZ94eYMrRh3ZTQVFKkmP7umIhzx3HqPonjPptjZ7hsjGgfsrkFekDQCf381c1pDJhSzIXvjR3Z9XqZZXFR9aXFbT1950E7OAXdKaNFTkx0PMCQGRuYrP28= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5232.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30289b9d-68c0-4226-fcc5-08dd3a5e3753 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2025 20:57:28.5674 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: oUXffHvP5TWxFtcEvTbsx/xgLPbEOMopsMTEcGeyPptnr69ewH7dtR1bbuioMopcEUi3jPIj2C+CdsFUQlKWAQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR10MB7620 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_08,2025-01-21_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxlogscore=609 suspectscore=0 phishscore=0 bulkscore=0 mlxscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501210166 X-Proofpoint-GUID: vtI1Y3xn_V4CxZ3zN9GTNkMvz9Rm9jHl X-Proofpoint-ORIG-GUID: vtI1Y3xn_V4CxZ3zN9GTNkMvz9Rm9jHl X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 75170 Cc: "acorallo@gnu.org" , "rpluim@gmail.com" , "75170@debbugs.gnu.org" <75170@debbugs.gnu.org>, Stefan Kangas , "monnier@gnu.org" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > > add-to-alist checks for the presence of keys and it makes sure that eac= h > > key appears only once in an alist. FWIW - That's not an alist. At least it doesn't fit with a common use of alists. It fits with hash tables and similar constructs. One of the benefits of alists is the ability to have multiple entries with the same key, with the first, for most purposes, shadowing the rest. Another use case is multiple entries with keys that are identical for some equality tests but not for others. "All animals are equal, but some are more equal than others." ___ (Not saying other things you've written are mistaken, or that it's not a good idea to think about an `add-to-alist' function. Just saying that entries with equal keys are not something to be automatically removed from alists, in general.) From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 16:11:53 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 21:11:53 +0000 Received: from localhost ([127.0.0.1]:57331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taLXN-0006LX-5h for submit@debbugs.gnu.org; Tue, 21 Jan 2025 16:11:53 -0500 Received: from tigger.sg.gildea.net ([99.65.78.170]:58510 helo=tigger3.gildea.net) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taLX9-0006Kr-VF for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 16:11:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gildea.com; i=@gildea.com; q=dns/txt; s=2023b; t=1737493893; h=from : to : subject : mime-version : content-type : content-id : date : message-id : from; bh=WhK64MefNHnXFVjq/vMLNf1UNkrDeSxp92KoJN3Najo=; b=gLJFuwPwBiJ8puKBLr18LUdbuqRw+Qy5uPlkuXGoKu6ogxlK0BicIwSA1liOu3zWSTOoY bDPECMOUi9gQlMN0QeI82aQeMA+x1zAJrFMqSyegU2ZGaxPP+WA+Df04XDn0mpZSOCm2CaM sZT6ZQkLZ8hhaMaOAJH0HjgFRHwXaREUffKcFVfhjflC7cSH5p/BxDeReybDL4H7ENptle9 B0zpKzpTHwOQolJmTPVttc7AAn6KlI7PVYD2eC9uGjpD36ds1EbyBsYawTfKvjcKQyc7jk4 OoWCq8vIwlvIQcEoK4Bn4sWi92g82ogKOV5MV1zKYti+qSxhlzWEtQuIeHXA== Received: from pental.sg.gildea.net (pental.wg.gildea.net [192.168.113.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "pental-mail", Issuer "gildea.net Mail Root CA" (verified OK)) by tigger3.gildea.net (Postfix) with ESMTPS id 48C303EA54C for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 13:11:33 -0800 (PST) Received: from pental.sg.gildea.net (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by pental.sg.gildea.net (Postfix) with ESMTPS id 2A06B2CD55B for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 13:11:33 -0800 (PST) From: Stephen Gildea To: 75170@debbugs.gnu.org Subject: Re: add-to-alist: new function X-Mailer: MH-E 8.6+git; nmh 1.8+dev; Emacs 31.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1307509.1737493893.1@pental.sg.gildea.net> Date: Tue, 21 Jan 2025 13:11:33 -0800 Message-ID: <1307511.1737493893@pental.sg.gildea.net> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Yes, all these years later, I still use my add-to-alist. It would be great to get this moved into Emacs proper and out of my init file. That this issue keeps popping up says to me that other people also would like this functionality to be easily available. What I like about it is how easy it is to read at the call site. And, as has been discussed here, none of the proposed replacements has the option to do nothing if the key is already present (the NO-REPLACE argument). I use this option in most of the calls in my init file, and I think it is the compelling value-add over add-to-list. What I don't like about the 'setf' construct is the unintuitive textual order of the arguments: key, alist, value. I do like that 'map-put!' puts the arguments in the order I expect. If we need to be able to remove an element from an alist easily, I would want a separate function remove-from-alist. I personally have not needed such a function. I have updated the implementation since my old posting. Here's my current: (defun add-to-alist (alist-var elt-cons &optional no-replace) "Add to the value of ALIST-VAR an element ELT-CONS if it isn't there yet. If an element with the same car as the car of ELT-CONS is already present, it is removed unless NO-REPLACE is non-nil, in which case ALIST-VAR is not changed. The test for presence of the car of ELT-CONS is done with `equal'." (let ((existing-element (assoc (car elt-cons) (symbol-value alist-var)))) (if (or (not existing-element) (not no-replace)) (setf (alist-get (car elt-cons) (symbol-value alist-var)) (cdr elt-cons))))) From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 17:53:35 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 22:53:35 +0000 Received: from localhost ([127.0.0.1]:57732 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taN7n-0003ny-2i for submit@debbugs.gnu.org; Tue, 21 Jan 2025 17:53:35 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:21926) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taN7g-0003nd-Tc for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 17:53:33 -0500 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50LJK2VO012633; Tue, 21 Jan 2025 22:53:27 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=crPYqxzyi1HrAaIYdCtJ1Hvx1JP0W7H9M/0ydmZqqh4=; b= YD2Glu4ltD05QM6czmpdxmT2dSuwAym7KaG+Ro+m2aJZcvUPaFVkv9pZEoHf6mtg UAhZBE+4eEqLP8oHDp0c/YyRJ5fip3fg7UWrjjnyyZ2QHxjioAUppj2TgAtwW7Mk dHrDTXTve7imBrF0rrj+gUuky+u+wV4EOdIWihOil8qDXt13iFS5g8huKlMhdYf7 7RTSH6TQcFqM8BDHD2Xkp8ReHrc4UjTUV9qFFBa0CfUl7QTooEMXgWn7OdI4oXtd deFYM6D9MQs9EqpLR8gGNmHwiOebPoeQ/+ZqdXFkUpi9kRdQN2TWo8Zju3U9LjQf sOOsURQSAfqQ6Nb3EBB3Hw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 4485qappg0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jan 2025 22:53:27 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 50LKvqic018656; Tue, 21 Jan 2025 22:53:25 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2045.outbound.protection.outlook.com [104.47.70.45]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 4491c2x1f6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 21 Jan 2025 22:53:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kibuf32jkt1068EllSaz/v3coRcJPDC46iCzhThMa9/rTJ3ceb8kig2/0lHKyj6CQeOzXkkCTBFH3ldIT9301CR1KvDC33MvvclDx6Db8O3SUL1Jfk5DlCpFppoqCsI8IdKs+36JCzo5fVFLuuKBD5WL/NiAqkiehHN5R923DPnmHLC/OFd6DmAiTG7bHrETkqGTONo58mTkXABmmE33qOcvhnbcSYgKdxBj6N6SIKbfClQlaDf5D+8rS78aW024ak1JAYegfVvZZuS2quSnssMoemu/GPD8pyybNxPQCtF/IQ9INBIhjGkcFex0804mDMG68TO6+lepLRebaDAe4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=crPYqxzyi1HrAaIYdCtJ1Hvx1JP0W7H9M/0ydmZqqh4=; b=MsV5YRlR59g6x1hRF4xPvPNU/FXTJFSazQ7PHAqHGz6X/bH8o+Ds8Jt7yU0eR3DSBS4zS7fuVl4nGCWtWiF3sYWCQCDBWFsFNV8/YoyNUDR5qmvU6qRF9SkJZdSoA8mKaCIV6wSGAtA2IDMU41aqbssBwxDwM2CaVQWXbBGIyiyAuOFsv3MzM5/XrwLJcsrF70H3KeMFEFBRVNIWXEc4y5rFBDPzkiiKN8zLrrOiYdK4pYN1WWtgWgyFH/FNeZL0jdGfJGmx26QrizCiG60tyvn4Sv7r9pxQEVLVXUonw4f1wtK3sl98vQJon9QH53cvYeqjGc0p56FyfYigfeCErQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=crPYqxzyi1HrAaIYdCtJ1Hvx1JP0W7H9M/0ydmZqqh4=; b=aaQsc+5b2uQ9CWMhyyKdRpNDBUctB2CB74dbRlLfHaY6Me0SGbyEzALQHvvVgqMF/R6EeCb+/4bm1r1ljAsCtpotxrQ/tZicjzSAAIboaI8sXBCzzxRVVQU3LdZsXJa8MSQmfDYZ43qZcrpdwV+WJ27fuwpWJrnBYr5i2Dm6KZ0= Received: from DS7PR10MB5232.namprd10.prod.outlook.com (2603:10b6:5:3aa::24) by PH0PR10MB7080.namprd10.prod.outlook.com (2603:10b6:510:28c::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.21; Tue, 21 Jan 2025 22:53:12 +0000 Received: from DS7PR10MB5232.namprd10.prod.outlook.com ([fe80::8303:658f:14f8:2324]) by DS7PR10MB5232.namprd10.prod.outlook.com ([fe80::8303:658f:14f8:2324%4]) with mapi id 15.20.8377.009; Tue, 21 Jan 2025 22:53:12 +0000 From: Drew Adams To: Stephen Gildea , "75170@debbugs.gnu.org" <75170@debbugs.gnu.org> Subject: RE: [External] : bug#75170: add-to-alist: new function Thread-Topic: [External] : bug#75170: add-to-alist: new function Thread-Index: AQHbbEk1heaijxvZnUqDxQilAxXLhLMh1EZw Date: Tue, 21 Jan 2025 22:53:11 +0000 Message-ID: References: <878qrzm4sb.fsf@gnu.org> <1307511.1737493893@pental.sg.gildea.net> In-Reply-To: <1307511.1737493893@pental.sg.gildea.net> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: DS7PR10MB5232:EE_|PH0PR10MB7080:EE_ x-ms-office365-filtering-correlation-id: 3132fcfd-b2bd-42da-e39e-08dd3a6e61e8 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?us-ascii?Q?x59Lhxp0YFxCZoRiCNjcxWEpzxiCbo1J3AO49iRlFkbn3u89X0THl6gZDhOv?= =?us-ascii?Q?fClPyWvIoVh/pxeahu83oMPAWA8qeFI2vLH3EHTHX4koKTznhqODw5DUtRtd?= =?us-ascii?Q?DUyUQIlCwdSMO7Bmnmg0kYjaUqIY41xEf49FZ+V88AwdYf8hkXA1pla6nV0U?= =?us-ascii?Q?aclVJdEnJmUm76KHAuZclri8XonXDLW53lCdhhdXOXa29Qtfg7+Hk6zut2mW?= =?us-ascii?Q?PbOEmEjADXSGPXzaluO3MYLUmxqNrt+G0w+wfMT2xXl3P8yeDeIZgysuz6u4?= =?us-ascii?Q?q5AFX3MIDdI5yl8VSkecVpYmXOZaF6RPbT9ObGttoJecAexWaCsQ6EvWhAYC?= =?us-ascii?Q?WtAw7V4mUOxF/R5OVEVXbFXht7f30XKd5tT20gtIx/y12yVQuCasdvaqZwPr?= =?us-ascii?Q?2HcU9QPONJCRm9kk5WzsIwS1d+2bw6Vh0c+dI5qVyE7D3Mv94crVOKqlIXDi?= =?us-ascii?Q?L5BIr9kV2n8oPR0MhRFETPULu2ZK6zceRmpaHwKf/apCZPqaHdxMVpLgnTW5?= =?us-ascii?Q?QioegsmnlbSkgCFCVGD4LpxXn3nhVjzEWkVTwdpeyV5a7KBGRR/yCnkkvQmC?= =?us-ascii?Q?rPEVbxQ/CmRUIMvL+XWii8o4LL5znB4IKdVefg4gNKXHCYBM+WCcPLGT6yGy?= =?us-ascii?Q?GmrI4EKBnxGCKKFZu1WBj7kLmRu9Xlfl04qbNZ39X5oAe8LWSF5U9wth0JZd?= =?us-ascii?Q?Cwbu9LBpJv96MLbrSuF6a8nKl+4VksISjh5OdSR3x9C4MrHNi5i5Z7+9oshX?= =?us-ascii?Q?fXTSR+14FlHEO6Bxu29qVNbQ7uOVPpPb93IuIPN2mlMhMoJD1h7xMNbYS6fp?= =?us-ascii?Q?JTSzZUDxCkLNTmZQmdix+CTnolrriUWxN/zBMAVKvVSP9hRv5To2IIofN4ll?= =?us-ascii?Q?VNxIKCXgaWLVlcA/0qDBGGsKWR/mF8QVu2T2i3Z8zVEGBUDIbqzhWW00eKoa?= =?us-ascii?Q?yNpj5e9cuYQNtBH+ivpJvWxKmoBZo3+iKQRceGNnc6TNFTbj2LV9l6/jz0OA?= =?us-ascii?Q?oYGyNMZCKh0/PX2eegp9BkOmRwuypYpt9dtjnGg2FLyzK5SyVo4jP2hKqHki?= =?us-ascii?Q?wanaBzB4xzvSDgpVVPCHZWcRGqhz1bMY4Ck7LdFZ2xU66Kc+AQ8trNfM0DEA?= =?us-ascii?Q?0EXB02pPuGEaeCwuaP5qfD87wdkVPm3iaxEuYNkmCOYmUKouMswml/QZmW1Q?= =?us-ascii?Q?as7prhckIBzujfOPRCjHa0Jw+7WYs8uwCmwSNrp/hCC3dS622gZSZi4XAB93?= =?us-ascii?Q?dDeap5yGe2cF6jB6iezsZc8WZ4I28NrxCOZ3GNPXTyP+ZM3wJd7Gx4dL7ezL?= =?us-ascii?Q?UHjxl+LSJg9utjUmgEMzgJKCx6LdeuET1L6Jf0kh08AKi1GCucgkM5nzSl13?= =?us-ascii?Q?eSPWXYkIa/NQ/XtI9VTxOfciWrX0nTwSnlpK4OR4uAv/UHiSRWZp6+/V0FtS?= =?us-ascii?Q?GoC/VFvF1/P2UR2WOxUlRF4qd0nrVafI?= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS7PR10MB5232.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016)(38070700018); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?tIyPa3K1b6uH1WuVql4oqMN2ncyS4B/aYPlX8wrGWvweT7z9WoyTKUIJI8YW?= =?us-ascii?Q?QF5kDniq4F3u+uk6iWEGbS5Sabdjw5QQDeysJ8He5WEKBkEIpqg2ByXkta7+?= =?us-ascii?Q?8usg7JOf91j+38WXOtf2IYmYusKx6hvz7C262ugh7vMthJpwL7Pz/6gGOySI?= =?us-ascii?Q?MbnlQqkkTo2qwUKD6/9118yxAxzE6GAdsCqmJmxbAMWcj3LyTJ+gVJj9NxLk?= =?us-ascii?Q?N2Nao2ji1qYpNW0gswoaMLEQoXViSdtAnmfqhlDUzKAT5CxCaH6IbeyW7aOa?= =?us-ascii?Q?dniEQY5OqF38Fg36gzWbaicZVS+AsGhvPXAvyJ7qqbb9xzksnmtLzHw5kbPx?= =?us-ascii?Q?o2AntydyIJvKFc6qAwgYGBIEA2SochG5Ni4POApmEqfMhCN6LZVqG8SK+P6t?= =?us-ascii?Q?2Xc+FfwA96dDVGTqD8/PexkKrSSeNPGxJOjEnctR4E4GqoZXWy2SNv879O2M?= =?us-ascii?Q?t1qdZd3pB8ZRE1BSHglTQpEuhCp7agX7G/PZDBYzKxMzCmUSpV7jwUnwOBVa?= =?us-ascii?Q?0wmHEoPYjUO4sFG8ydP147HXDgTAnKjvt7fhrq+vMGgUinOBBApfIWqJ7Tn0?= =?us-ascii?Q?e2BtATqj4Mq2ZSweP6i58PMsbAbA3iSWskprWYGbCsyjvWFTZtL4TZ2tLf7f?= =?us-ascii?Q?oTR99KdFqDjxI4D8I7Pd2sjZ7ipCljf3/uJc7nsXEwpO4SD0AJpQZUHoBNa6?= =?us-ascii?Q?YOlQGpWkXrLcdYkQkVMzEz3Nw1vWOAL4Il0/UOjrZmgScsLWOFfl62DoTOd5?= =?us-ascii?Q?7Ib9Sn/nuDa1hDH4Sd3kHh3utxOjRXSII3fCfCfUGsl4RTB7RwZQXJiDVtqA?= =?us-ascii?Q?c0SHzs50GqxjSITNWmCLZ3PzIS8K8q3p3L385x/yb6Z5VDEUSrfBupP+WpP2?= =?us-ascii?Q?gKyCOhW8adeE0iCljx0atEGqGh7Dzd44q8SUl6mlsVW+QQDAKZ6Qgjk1Ejbu?= =?us-ascii?Q?iJPMw8fWiL7EDSauW8ctmoWEmI+2NCYOimRayRm4JiU8npEsuU/bUSwJ5QeE?= =?us-ascii?Q?gqH/VuB0d+TDTRivzJYhLvLjTA4zViZ4TMff2Vmw88r4C5yU7OagNWWHG5nC?= =?us-ascii?Q?Q1ub0dQXAlocyHalazHYzKgU/IJ8sXGCzvWJITXDkFI8lHMH5ZRR1ScCT5is?= =?us-ascii?Q?BZIg4KgIjnnbyS9XOYDXT4mPF42yeMVi1gVgIZwfmQZwQPQ2zGja0x3Pkxr7?= =?us-ascii?Q?YQtom7DK8IYHd+0UkOg0UKwMkIGiBnDRFeKIoXpMMpx1zfxPlRAiyc/ZoTLc?= =?us-ascii?Q?+dC0ZZXn68b4+koNwRTfCSdmgOTOi/x1QSIJLw5bJ4aq45qS6Iy7k4q0b20j?= =?us-ascii?Q?FKEI+2/6hiiVRke/tLBSslNIF5E+KeiZDhqi0U1rNtlNhVqsMP5xz0q/gMj3?= =?us-ascii?Q?zH8t+eCYJmI4ViL8V3XtTddehCV1S24AqEJJ/nfobdrMnRBEuOTA27/Z4jFj?= =?us-ascii?Q?oXCaYnAj8JVzHO+w8wZuB9TWPg5Rc2cun8yd5M8lYHta0LhP5Hh6E8S+8ETK?= =?us-ascii?Q?IPbCsUp9OWhnpoTqx23C5Gbp0OEtRGo94lbxpTwnt7UkuEJ/Udu8QBi6auw9?= =?us-ascii?Q?WQa2rFOEV+4uijEL5Gob7N6522JQpZt2kf/zNPPS?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: XGDvtwawel3vU1h5/V+p5reiwgBDP6KCJlQr9iK/ng4lScfPnfZfnsL+Nmbj9OFM52sTs0K0moIiyF2WT60GPMKQhPlhMGhccToEX0qi5PGd4PeFNmBYyQF2Hgl7k9HWpj1JGhzVtkSLdq31XV5lpCeTXBSyQ0CTV9ID9az+V8yWOQagI17VyFeaQrbrmUhsNsOhS21BizNwYx5GDMzuS6hOSTMIUZdJ94ieqvISqlR6WNJC437X2SC2NmfPr3uzT/jXfCIIyVOVFVIXABBwMcVv7yycY8rRf7LM8jHdXL5abTS/YmJANTCWzPdUrtRTtxoUNM1CGblU1RBgiRmBDdHjEIn3LWEFH+wyeIbI/eRFp2+V9wT5YNZsXcPDxPQkhvFjCUJKdGPoLkG1O2yBrAj78ZuqppjwebWsH1EyYbTfnSNq3vc3rL04X5fDfNOvfmTe290RqvslPGd2q6UJueHdQdAol1Mv0IXxcGlmFgcU2Pwq9eHtUs/gE5eslsyF7MhT7VghHclklUGK4AlrJEMDf0p+aVF6Taz9pmoedCYy6zlZ8tnCiofojSacOY8y2Ji3E+r9xdEZYsNj/2HnhYx0dXU3MTiwft0QBv8fP8g= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DS7PR10MB5232.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3132fcfd-b2bd-42da-e39e-08dd3a6e61e8 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Jan 2025 22:53:11.9678 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: +kuaiKy58TIRytPqCnVxyReYRJVwN0W0a15qLRE2GxcyN5NbQLxoEGQUbdo1nEc0QTtJ6Lpf2jt/et9RXg5ePQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR10MB7080 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_09,2025-01-21_03,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 spamscore=0 phishscore=0 adultscore=0 bulkscore=0 mlxscore=0 mlxlogscore=812 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501210182 X-Proofpoint-GUID: JiwepFpgIIWntofoZhAIPEljAuzMaPAb X-Proofpoint-ORIG-GUID: JiwepFpgIIWntofoZhAIPEljAuzMaPAb X-Spam-Score: -0.8 (/) X-Debbugs-Envelope-To: 75170 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.8 (-) > The test for presence of the car of ELT-CONS is done > with `equal'." > (assoc (car elt-cons) (symbol-value alist-var)) Seems like you should consider adding an optional TESTFN arg for the equality predicate. There's a reason Lisp has had both `assq' and `assoc' since forever. And there's a reason that `assoc' itself later began to accept such an optional arg. From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 18:08:24 2025 Received: (at 75170) by debbugs.gnu.org; 21 Jan 2025 23:08:24 +0000 Received: from localhost ([127.0.0.1]:57778 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taNM6-0004jR-Ux for submit@debbugs.gnu.org; Tue, 21 Jan 2025 18:08:23 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:36375) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taNM3-0004il-BP for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 18:08:20 -0500 Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 6D9F1100305; Tue, 21 Jan 2025 18:08:12 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1737500891; bh=qusSVEzx0q1UM0apH7cue8Lt5qpD/U+bji+YUzDKZWo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=oNuCkatap9jSuJjCnp1vMO9YJoJ2kIF5G9DPPCJXzNNSav2AyGLdCrcizw7JbZKH6 s2U5H6XUFGMEQHRYmU3qZjEwSfoccqEQ359m8K/LhyuEDeZ9E/CeOKKyDW32p2NywW MCozvF+km/JFU7kGcVw3I+vwvp+gcG3ajT29FekOg/B2nN1pOZvRBty+8arNMxmHxn 3esgKC3w3whnFaUj/hI4ol4pLDtk1llOWNJrvvQH1pGSCXyAUNZo6H99hrQvQQN+ij 2DDifmX5nNY8QS2OiIYD9HwEMdqY5Bn0GmLBokL0R1JTw6bUWYmHzMgnD6dgstbkw5 SiD3Z9rbS1eUw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id A114C10011E; Tue, 21 Jan 2025 18:08:11 -0500 (EST) Received: from asado (dyn.144-85-147-102.dsl.vtx.ch [144.85.147.102]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 92C1D12012E; Tue, 21 Jan 2025 18:08:10 -0500 (EST) From: Stefan Monnier To: Roland Winkler Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <878qrzm4sb.fsf@gnu.org> (Roland Winkler's message of "Sat, 28 Dec 2024 23:33:56 -0600") Message-ID: References: <878qrzm4sb.fsf@gnu.org> Date: Tue, 21 Jan 2025 18:08:07 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-SPAM-INFO: Spam detection results: 0 ALL_TRUSTED -1 Passed through trusted hosts only via SMTP AWL 0.137 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain X-SPAM-LEVEL: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) I don't have much to add to this discussion except: - I personally dislike `add-to-list` because I think that conflating symbols with variables is a bad practice (e.g. because it is incompatible with lexical scoping). - Yet, it works OK for configuration, which always involves global/dynamic variables anyway, and where `push` is not great and `cl-pushnew` often requires `:test #'equal`. - I think we should try and provide better support (in general) for unloading packages, and this means improving support for undoing top-level operations. We currently support `defalias` and friends fairly well, `defvar` and friends tolerably, but we fail miserably for most other things. So maybe something like an `add-to-alist` dedicated to top-level operations, which records the change somewhere (e.g. `load-history`) so we can undo it when unloading, would be an improvement. Of course it would make a lot of sense to do it together with similar operations to add an element to a list, to add a property to a symbol, to add an advice, to add a function on a hook, ... so it's probably worth thinking of a more general way to provide those operations than doing it one at a time. - Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jan 21 22:57:31 2025 Received: (at 75170) by debbugs.gnu.org; 22 Jan 2025 03:57:31 +0000 Received: from localhost ([127.0.0.1]:58913 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taRrq-0004SF-TA for submit@debbugs.gnu.org; Tue, 21 Jan 2025 22:57:30 -0500 Received: from tigger.sg.gildea.net ([99.65.78.170]:43954 helo=tigger3.gildea.net) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taRrn-0004Rt-Su for 75170@debbugs.gnu.org; Tue, 21 Jan 2025 22:57:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gildea.com; i=@gildea.com; q=dns/txt; s=2023b; t=1737518237; h=from : to : subject : mime-version : content-type : content-id : date : message-id : from; bh=nUe1HaeASlhJghGBdLJ6F9COgzuFt0JBxbn4GekPfQc=; b=WyqlWuIr89fV1nwkYSMjsh8P4HHyVoZ7uDne3fTZlimVPRAud9OqmQCk94EnPihBxCMsx r3OlotcIwto12g/0WREDgl/FHVqkDRmZ6QFL47StrW2P2lXKsfQ+TdgFKr1SrIBUK5be2v4 ioPEosjUNcHdgaovzi4nsCZ5cEIyFNNp+yYQRcF+cvfbTHMAzIHvVyFQ3VqTOUzwjLIVOYA JFr4nOqtdxXDqiMSxuVrhvmY4JGOZ2C/yjPWMpe8OQziAa3WHrsX/X1fr6IUgupfXFlBg+q GztI8IypssUJYSOpa2MM8JL4JSa7RBHPCgx3wDNmAJIs3FKYKt7jNRdVunHg== Received: from pental.sg.gildea.net (pental.wg.gildea.net [192.168.113.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "pental-mail", Issuer "gildea.net Mail Root CA" (verified OK)) by tigger3.gildea.net (Postfix) with ESMTPS id 070913E12D5 for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 19:57:17 -0800 (PST) Received: from pental.sg.gildea.net (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by pental.sg.gildea.net (Postfix) with ESMTPS id C38142CD56C for <75170@debbugs.gnu.org>; Tue, 21 Jan 2025 19:57:16 -0800 (PST) From: Stephen Gildea To: 75170@debbugs.gnu.org Subject: Re: add-to-alist: new function X-Mailer: MH-E 8.6+git; nmh 1.8+dev; Emacs 31.0.50 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1328286.1737518236.1@pental.sg.gildea.net> Date: Tue, 21 Jan 2025 19:57:16 -0800 Message-ID: <1328289.1737518236@pental.sg.gildea.net> X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Looking at Stefan Monnier's set of things to modify and remember for unloading, I made a list of things to extend and the syntax for doing so: list (add-to-list OBJECT ELEMENT) alist (add-to-alist OBJECT (KEY . VALUE)) plist (put OBJECT KEY VALUE) hooks (add-hook OBJECT FUNCTION) function (define-advice OBJECT ...) Seeing these all together, I have the following observations: Mostly these take the name of the object as a quoted symbol. 'define-advice' doesn't require the name to be quoted, and it also has a name starting with "def", so the leading "def" is a good clue as to whether you need to quote the object's name. 'add-to-alist' should look more like 'put' (3 args) and less like 'add-to-list' (2 args): (add-to-alist ALIST KEY VALUE). We should be consistent about whether there is a "to" in the middle of the name. 'add-to-list' and 'add-to-alist' refer to the set we are adding to, but 'add-hook' and 'define-advice' refer to the thing we are adding. 'put' has no noun at all; if we add a function that supports unloading, it might be clearer to call it 'add-to-plist'. < Stephen From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 00:09:24 2025 Received: (at 75170) by debbugs.gnu.org; 22 Jan 2025 05:09:24 +0000 Received: from localhost ([127.0.0.1]:59073 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taSzQ-00087K-H1 for submit@debbugs.gnu.org; Wed, 22 Jan 2025 00:09:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39866) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taSzM-000870-CG for 75170@debbugs.gnu.org; Wed, 22 Jan 2025 00:09:16 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taSzF-0000zk-Ug; Wed, 22 Jan 2025 00:09:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=DlaCfBWZR7CmTCkeAVWISWiWpT6JLJmg50PSU1q17W4=; b=mBVshSZk4+THGHKiKhDj mQgA9pOF9WvujWzQpg9iRydrscAO34u78st5O1wkQH5jKkmCCMvGkWsigvpmEKzmHqeJAloiskfeH lV0TAhWiwoajmSGgsIgejhsWZ9Drg0d4KXXFDSNVJ26SrvySoz9zbFZNEkLiTdqYUWshCxc6RxDve pZIZZucGUkHAk5vfGaJSkib++/BqzyXis5Vmgx4faCMfWl/EzdVHdawx4lFxaJrEshHMoK+wGEpic rhBlRsCLXeMxH8jIZrhzHjBuvBfY8kaYLiD9jceO1m1wVyUsEcwykrY+aI9OhpNkGJYUVWOEqF+5q L+DLNQj4bWQzAA==; From: Roland Winkler To: Eli Zaretskii Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <864j1s3qqe.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 21 Jan 2025 21:35:05 +0200") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <868qr43rnl.fsf@gnu.org> <87msfk0y8y.fsf@gnu.org> <864j1s3qqe.fsf@gnu.org> Date: Tue, 21 Jan 2025 23:09:08 -0600 Message-ID: <87r04vph8r.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, rpluim@gmail.com, acorallo@gnu.org, stefankangas@gmail.com, monnier@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Tue, Jan 21 2025, Eli Zaretskii wrote: > I know all this, but why do we think end-users who aren't comfortable > with alist-get and setf will need to "check for the presence of keys > and make sure that each key appears only once in an alist"? Since by > default add-to-list prepends the new association, those which come > after it don't matter, right? > > So if we want to cater to people for whom Lisp is not a first > language, why do we think they need anything beyond add-to-list? Does > the fact that I still use add-to-list, so many years after I started > using Emacs, tell something? You probably know better than almost everybody else what emacs is doing under the hood, how individual user variables are being processed and how changing their values in whatever way is going to change emacs' behavior. Then, if add-to-list is doing what you want or need, that's great. But is your level of expertise the benchmark for customizing emacs? I agree with Stefan K: > I believe that the "contains both associations" part is what will risk > confusing some users. It's not a given that they know that the first > one is the one that will be used. It could just as easily have been the > last one, for example. You replied: > And yet add-to-list is exactly what we tell users to use, see the node > (emacs) Frame Parameters. This quote is not about add-to-list as a feature for user init files, but it is about default-frame-alist. It does not address what Stefan said: with the next alist a user wants to customize, it could be the last association for a key that will be used. The goal of add-to-alist is to make customizing alists transparent for non-expert users. When a user inspects an alist that has been customized with add-to-alist, its value will be what the user expects it to be, and not just what it can also be to achieve that purpose, if only the first (or last) association for a key happens to be relevant. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 00:09:54 2025 Received: (at 75170) by debbugs.gnu.org; 22 Jan 2025 05:09:54 +0000 Received: from localhost ([127.0.0.1]:59077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taSzy-00088J-18 for submit@debbugs.gnu.org; Wed, 22 Jan 2025 00:09:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53288) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taSzu-000885-Qk for 75170@debbugs.gnu.org; Wed, 22 Jan 2025 00:09:51 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taSzn-00012R-FW; Wed, 22 Jan 2025 00:09:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=6fIARai2ECW77Rdc7kkx3WzsrraifQlTxhxFDOZb+1I=; b=M/gx2vKprpfhbR7Gtjkr 1JlVWfoa5ijrUctvmH5gWa5kmkSTmVhcWl48IK712iAOkLLe3+3wiZKbUF23WY8B4KNf+c1MDqlh5 c3WdA9jIgqeqsQEC1JOzKNXtBi9ij6Vf4t7tWS6Je5IhPiyeqspUFTtqsAqto5v9g0er8/xgLapFx 4RcnFHvWAjFvMpArWFqh+/jpE33uIreVB0ABD7Xtf9VJY9CjKQZYg+nN66QbLEOEiirHvvOIlLaJq szh7ivP8drp/KWDlnq59B8V/bnLlsDem5Cij+7gnRtPfiJ5bNubAHuJVzpUTW7udr7CSIce45sIaW o+hFCP+DSWnj4w==; From: Roland Winkler To: Stefan Monnier Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: (Stefan Monnier's message of "Tue, 21 Jan 2025 18:08:07 -0500") References: <878qrzm4sb.fsf@gnu.org> Date: Tue, 21 Jan 2025 23:09:42 -0600 Message-ID: <87plkfph7t.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Tue, Jan 21 2025, Stefan Monnier wrote: > I don't have much to add to this discussion except: > > - I personally dislike `add-to-list` because I think that conflating > symbols with variables is a bad practice (e.g. because it is > incompatible with lexical scoping). > > - Yet, it works OK for configuration, which always involves > global/dynamic variables anyway, and where `push` is not great and > `cl-pushnew` often requires `:test #'equal`. > > - I think we should try and provide better support (in general) for > unloading packages, and this means improving support for undoing > top-level operations. We currently support `defalias` and friends > fairly well, `defvar` and friends tolerably, but we fail miserably for > most other things. So maybe something like an `add-to-alist` dedicated > to top-level operations, which records the change somewhere > (e.g. `load-history`) so we can undo it when unloading, would be > an improvement. Of course it would make a lot of sense to do it > together with similar operations to add an element to a list, to add > a property to a symbol, to add an advice, to add a function on a hook, > ... so it's probably worth thinking of a more general way to provide > those operations than doing it one at a time. In an ideal world, the last item in your list would be great. But if dreaming of an ideal world should imply that nothing is going to improve in a foreseeable future, then I am in favor of less-than-ideal solutions that can be implemented more easily. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 03:31:08 2025 Received: (at 75170) by debbugs.gnu.org; 22 Jan 2025 08:31:08 +0000 Received: from localhost ([127.0.0.1]:59659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taW8h-0002Qn-KF for submit@debbugs.gnu.org; Wed, 22 Jan 2025 03:31:07 -0500 Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:50510) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1taW8f-0002QH-01 for 75170@debbugs.gnu.org; Wed, 22 Jan 2025 03:31:05 -0500 Received: by mail-wr1-x431.google.com with SMTP id ffacd0b85a97d-386329da1d9so3626510f8f.1 for <75170@debbugs.gnu.org>; Wed, 22 Jan 2025 00:31:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737534659; x=1738139459; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=983GamIV/eASn/vX9EBWBl2qS/8xalEW/4h5kLZi/pw=; b=IoIA+gh1Z582rRYqfFgi/9ihfM63sXnv4sbR6NO0MuT/jabSvZT6XdQaa1x8vkzQc/ GX1lqBC4xu7flf1fP+QwZhKMT77p3Oz2vG+i5NWUTWRHuf4J1ENMJ+uekGJP+HZgLnDZ Qz7hFG6LxRs4d7qGD5hqsro03efA4E8AaBahd9dvcVWw1crAi0Z+6pHTj8wu/UuaHHbG w68YAJlbIwWDibT1HmaEQvD1StLu7i2za7gyOwZw7vEYiWbb22CjlzD6jkvo4wjF67OL hZ7K4VTUeNWf6eNKf6VQmvqDG2yCPkztqQxCVDxlfCpuRey7jncBtOuWJSkSIQvPPbeh D6fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737534659; x=1738139459; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=983GamIV/eASn/vX9EBWBl2qS/8xalEW/4h5kLZi/pw=; b=qMOZ/RA2+WZa3zTJA0J+fp9iJGuL4A+BFIIklX1dCw8S4RqmCdiEmchOLasLa30v0s pkBf7VBRIuBncQmWp4oX/W0qFKs3hwWSHmmsiZXJ9g1qKyo8ssE+oNPHHZk0kJ0JpxDt hqCzJjklY2oIosr2k3bJkA144ZL/e6eCxT9p/BdGt43ssBngzNrX7POR9MDCp2xgIiaI Se01kemcxSYKWHRVKDVjuAuIaiGMNKFKTqwCeC1hdd4ptxNA4j16xMTKeVPhRBInNJHb rGN6tNtfWkwYTvLrRNL5JFOYglH/qzyoukchNrycYWAoVXNXKbkz8d+ZPxqMalySrUV2 Wshw== X-Forwarded-Encrypted: i=1; AJvYcCUGcEJzXbrK9+BZHJ1VWy0GncY2xx9y2mheMkrkg87uNWHWZIX2mb0U06AIUKr7kDDuVVzyTg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyiGx+WHCo7wXRqNrskAD1AaUtqvobwgvXnKpGW2eYXD5rNUKUd kYH8wHch25aGqG0bbjBmxNIqlmuTD+KOHQ2oReMfKUBh4okIQ9rq4wig5Q== X-Gm-Gg: ASbGncsdmgjlQ/fUna2IEkndUwvn1SqJSJk9UJ6zuoVDTaHKm1m8gBPW42XBPhuyw5g PWVkkhjcdPE+bUjvwJdGXA6YLz3kkIgEYxeRF9YNW/I2cs6OL0SvzJcH76TqC0buwxQbNjGzy9U pdREU/7II8RI6K/CDLlCh/KmQgg0uZ81oyU/TYIoHbmyE+Pe/4id25d0Xpj6jg+xFPfOzRLc47M WN9Lw6Tp+ESPdaUq5wm/anpOv3qIRsX1lzfFkeeosOfy4MT0cRW5ogXzA== X-Google-Smtp-Source: AGHT+IEEXbv9YpN3La3MsdP2hXLGSyBN5XkZgCZNPAU7wloHoYaZRzWmFU+VijDqnpBqAMB5+/lWEA== X-Received: by 2002:a5d:64a1:0:b0:385:df84:8496 with SMTP id ffacd0b85a97d-38bf56555cfmr19496815f8f.3.1737534658560; Wed, 22 Jan 2025 00:30:58 -0800 (PST) Received: from rltb ([2a01:e0a:3f3:fb51:2099:1877:99a3:a9fe]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38bf3215bf2sm15870058f8f.18.2025.01.22.00.30.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jan 2025 00:30:58 -0800 (PST) From: Robert Pluim To: Stefan Kangas Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: (Stefan Kangas's message of "Tue, 21 Jan 2025 12:50:16 -0600") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <874j1sbfji.fsf@gmail.com> Date: Wed, 22 Jan 2025 09:30:57 +0100 Message-ID: <87tt9r8d32.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 75170 Cc: winkler@gnu.org, monnier@gnu.org, "Alfred M. Szmidt" , 75170@debbugs.gnu.org, eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) >>>>> On Tue, 21 Jan 2025 12:50:16 -0600, Stefan Kangas said: Stefan> Robert Pluim writes: >> map.el assumes that a list that starts with an atom is a plist, and >> any other list is an alist. alist-get and assoc obviously disagree. Stefan> This is a tangent, but I'd be curious to know how much use map.= el is Stefan> getting. It doesn't seem to be too popular in emacs.git at lea= st. I knew that something like `map-let' and `map-delete' existed, but couldn=CA=BCt remember their names, and couldn=CA=BCt find them (the elisp manual talks about 'sequences', but that covers lists and arrays, and talks about "seq.el"). Perhaps we need to add a node to (info "(elisp) Lists") covering "map.el"? Also: (defalias 'plist-delete #=CA=BCmap-delete) might be a good idea, to prevent people (me :-)) reinventing it. Robert --=20 From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 07:38:37 2025 Received: (at 75170) by debbugs.gnu.org; 22 Jan 2025 12:38:37 +0000 Received: from localhost ([127.0.0.1]:60761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taa0C-0007OW-Oj for submit@debbugs.gnu.org; Wed, 22 Jan 2025 07:38:37 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58972) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taa07-0007OG-R6 for 75170@debbugs.gnu.org; Wed, 22 Jan 2025 07:38:34 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taa01-0001Xv-Jw; Wed, 22 Jan 2025 07:38:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=IXfvEj8RU3K3GUPyn5EcRKNbc3plpMoLXNzmh32IdBk=; b=ZgsQIrNlvvhVnPYhTAVI OtCXENyfWXh9QPhxfG8tI0EJnEbws7GjaZQd92tHQ3uLktO0Q5SZxK+qA/rhHjJhTDN7R0E4tS4Iq k036CeiP+PPQfVsuu6IwmdqCywfNKZvWnjALrDBmqpwbKPHJVpgxrLTCUcGTuFal3tARLuCkTMGiI T8IsZpoY+inqLdZCKirHSvlfYPfGUUGiZm6O8s4+RmjTKLm91nEU7kFKnf7OviqnVSNX4p/epgwDg /s7AZ92X7/w/n8GNbSrXDnikVqbncAiZhxm9FxUWDVr5VpP34zD7ZEPGWIUg7UxiMjKupbDOtgU07 78DQ9wPFEKaO1w==; From: Arash Esbati To: Robert Pluim Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <87tt9r8d32.fsf@gmail.com> (Robert Pluim's message of "Wed, 22 Jan 2025 09:30:57 +0100") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <874j1sbfji.fsf@gmail.com> <87tt9r8d32.fsf@gmail.com> Date: Wed, 22 Jan 2025 13:38:17 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: winkler@gnu.org, monnier@gnu.org, "Alfred M. Szmidt" , 75170@debbugs.gnu.org, Stefan Kangas , eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Robert Pluim writes: > Perhaps we need to add a node to (info "(elisp) Lists") covering > "map.el"? +1. I once tried to use map.el but gave up because of lacking documentation (like seq.el) and docstrings I couldn't parse. This site was a relief: https://flandrew.srht.site/listful/map-vs-other-libraries-through-hundreds-of-examples.html Best, Arash From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 09:06:13 2025 Received: (at 75170) by debbugs.gnu.org; 22 Jan 2025 14:06:13 +0000 Received: from localhost ([127.0.0.1]:60968 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tabMy-0003NF-OI for submit@debbugs.gnu.org; Wed, 22 Jan 2025 09:06:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36128) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tabMv-0003Mu-H8 for 75170@debbugs.gnu.org; Wed, 22 Jan 2025 09:06:10 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tabMp-0005cw-HW; Wed, 22 Jan 2025 09:06:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=mu5UqQK76XwMvgHGnPuXpmWY4y/SnU2Yi+yE2TVvGH8=; b=EFLErKxnzGEc 8ixwCygaGlaxcrIc8t6CV2DuLN8RWPjJxGnyHBDlb63N76wlq0A6Edn5yhg0qcnW7cagCLxaCrQkf FvL0Gz7lc9pFIdPtgfJrHeD3C+krLSP9trsxRyQ9HPyfcKqcyKRkv3JmuoKPZwJVmWbbMx1aP0yX/ NrHp5fth3ce5SkZWJ0103cYXOblh+M0FePwJV0rLceaDgkFhOJ43fvQ9ldU00JpVbZDcP9VqbXy1g RmXaJvVt/z2MH3XuEbPFUUvejb8rHOOTAIRlcao+AfWNL591BANGCc7hOZEfC+75d5uJLA7WJfm3I 87a1DtayHWlE8Ya/xM67Hg==; Date: Wed, 22 Jan 2025 16:05:48 +0200 Message-Id: <86tt9r2bb7.fsf@gnu.org> From: Eli Zaretskii To: Stefan Kangas In-Reply-To: (message from Stefan Kangas on Tue, 21 Jan 2025 14:34:48 -0600) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <868qr43rnl.fsf@gnu.org> <87msfk0y8y.fsf@gnu.org> <8634hb52qz.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, rpluim@gmail.com, acorallo@gnu.org, winkler@gnu.org, monnier@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Stefan Kangas > Date: Tue, 21 Jan 2025 14:34:48 -0600 > Cc: winkler@gnu.org, rpluim@gmail.com, acorallo@gnu.org, 75170@debbugs.gnu.org, > monnier@gnu.org > > Stefan Kangas writes: > > > Eli Zaretskii writes: > > > >>> From: Stefan Kangas > >>> Date: Tue, 21 Jan 2025 13:41:17 -0600 > >>> Cc: rpluim@gmail.com, acorallo@gnu.org, 75170@debbugs.gnu.org, monnier@gnu.org > >>> > >>> I believe that the "contains both associations" part is what will risk > >>> confusing some users. It's not a given that they know that the first > >>> one is the one that will be used. It could just as easily have been the > >>> last one, for example. > >> > >> And yet add-to-list is exactly what we tell users to use, see the node > >> (emacs) Frame Parameters. > > > > I'm personally on the fence about this addition. I see good arguments > > both for and against. > > > > Given your doubts, maybe we should close this as a wontfix. > > I sent that too soon. It should have read: > > Given your doubts, and the controversy around this, maybe we should > close this as a wontfix. I don't have strong feelings or opinions, actually. Adding another API whose name is similar to an existing one, but which works differently (and what's worse, has different syntactic requirements), will add to confusion and to the documentation efforts (need to go through all the places where we currently recommend add-to-list and change them). But if enough people insist on that... I do still wonder why people who most certainly know about Emacs Lisp enough to use setf/alist-git insist on adding this function to Emacs, even though they've already solved their problem by having a private definition for it. Why insist on adding this to Emacs? But I don't necessarily expect an answer to that. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 10:07:15 2025 Received: (at 75170) by debbugs.gnu.org; 22 Jan 2025 15:07:15 +0000 Received: from localhost ([127.0.0.1]:35830 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tacK2-0007Lq-Sj for submit@debbugs.gnu.org; Wed, 22 Jan 2025 10:07:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39028) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tacK0-0007Ld-4t for 75170@debbugs.gnu.org; Wed, 22 Jan 2025 10:07:12 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tacJu-0002rW-Nk; Wed, 22 Jan 2025 10:07:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Tx8IWMS1oBZj+iVeP/THS8k4aui16wogBE3zLLbOozQ=; b=rtg/9AykJInp C2py4Sor+5akuS6F8s0L2vh4ScJs8Kt1V9jXJtW3mvSIWFRo0EmPruMGjzKw7wYOcO0Hr+GbIjNex MVZnx8695M2A3gwNBy1Xal1xQ/b5KTF6hWvPcnRaQMZagL8zpg8ke09xMZmXMDBKnXvL6Nve4U2eg DP8LfTnhl4liOYkr+SOTeFeic1LZeQ3XbaR2Tho36+2Vb66hm/mAjuFy5QComJqu6Q0zTrOT5fuZD j9cgkzwPqeirbwjTA/6cuBM6Ksr2xV2ZJ2uY7P7ZvTZkRXbUSmJq0/OsUMg8YYMo5d/O9RFkVkBLd q5eVU2jULFbdpNERnlFlqA==; Date: Wed, 22 Jan 2025 17:06:55 +0200 Message-Id: <86ldv23n1s.fsf@gnu.org> From: Eli Zaretskii To: Arash Esbati In-Reply-To: (message from Arash Esbati on Wed, 22 Jan 2025 13:38:17 +0100) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <874j1sbfji.fsf@gmail.com> <87tt9r8d32.fsf@gmail.com> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: rpluim@gmail.com, winkler@gnu.org, monnier@gnu.org, ams@gnu.org, 75170@debbugs.gnu.org, stefankangas@gmail.com, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Arash Esbati > Cc: Stefan Kangas , winkler@gnu.org, > monnier@gnu.org, "Alfred M. Szmidt" , > 75170@debbugs.gnu.org, eliz@gnu.org, acorallo@gnu.org > Date: Wed, 22 Jan 2025 13:38:17 +0100 > > Robert Pluim writes: > > > Perhaps we need to add a node to (info "(elisp) Lists") covering > > "map.el"? > > +1. > > I once tried to use map.el but gave up because of lacking documentation > (like seq.el) and docstrings I couldn't parse. Let's begin by fixing the doc strings, then. We can consider adding to manual later, but the built-in documentation must be clear enough to use map.el. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 10:50:24 2025 Received: (at 75170) by debbugs.gnu.org; 22 Jan 2025 15:50:24 +0000 Received: from localhost ([127.0.0.1]:35979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taczo-0001Ep-6z for submit@debbugs.gnu.org; Wed, 22 Jan 2025 10:50:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50510) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taczk-0001EV-TC for 75170@debbugs.gnu.org; Wed, 22 Jan 2025 10:50:22 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tacze-0007jV-Fe; Wed, 22 Jan 2025 10:50:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=V5nLtMWEO+c9v7RukcJetXJO4Iq9YEt/S9KP4FP0GoM=; b=TmTiWS3epBoRZ3ydrwSD 2oZJbMagmvp9DYShV1AD2jfl5QduXJ3IYrwgP6nC4Du9WhmejF4d7KDksFmHHiImJ6Du7oub82DPY DOk1OZ9f1DJctpCgAc5wN7slh+SrvzzuKds7M+te/1WsT6nMAAu0lg5H6wHsdtNJKMKpZSHeThP8B SwOV7USW1HxodRtBYF4P0+sRhmtyJjCkaqiLCPxBf9LrMpYoE2wyCyZBPTHFBVfP6J8mmLAHuPw7G Ihpk6OknHpo+WhEVD8CbtiqSr6AcbPY6lQrjrNXMtfhybeNgQkCGQUaLUujqVicO9R5H5fDRwY04h QohLi0EZmVxCtw==; From: Roland Winkler To: Eli Zaretskii Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <86ldv23n1s.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 22 Jan 2025 17:06:55 +0200") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <874j1sbfji.fsf@gmail.com> <87tt9r8d32.fsf@gmail.com> <86ldv23n1s.fsf@gnu.org> Date: Wed, 22 Jan 2025 09:50:10 -0600 Message-ID: <87ldv2q24t.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: rpluim@gmail.com, Stephen Gildea , Arash Esbati , monnier@gnu.org, ams@gnu.org, 75170@debbugs.gnu.org, stefankangas@gmail.com, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Wed, Jan 22 2025, Eli Zaretskii wrote: >> Robert Pluim writes: >> >> > Perhaps we need to add a node to (info "(elisp) Lists") covering >> > "map.el"? >> >> +1. >> >> I once tried to use map.el but gave up because of lacking documentation >> (like seq.el) and docstrings I couldn't parse. > > Let's begin by fixing the doc strings, then. We can consider adding > to manual later, but the built-in documentation must be clear enough > to use map.el. Isn't this now a different topic? Didn't we conclude that map-put! is not a good option to be recommended for user init files? I like Stephen's arguments for adding add-to-alist to emacs that are based on 20+ years of actually using it in his init file. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 11:08:56 2025 Received: (at 75170) by debbugs.gnu.org; 22 Jan 2025 16:08:56 +0000 Received: from localhost ([127.0.0.1]:36038 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tadHj-00024u-TX for submit@debbugs.gnu.org; Wed, 22 Jan 2025 11:08:56 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:40184) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tadHg-00024a-V9 for 75170@debbugs.gnu.org; Wed, 22 Jan 2025 11:08:53 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tadHa-00062d-LN; Wed, 22 Jan 2025 11:08:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=EW4o5334ZLUF+mAABAh+mmY50dTfDa/J1fNDIdN8Gd0=; b=PMMgpMfYkw9S Uy2tNM17I4b8GtNISKJzx8vnOKH51y8TprQXrFBvXY6OPPh/Q7rIIgEPYXHgeFHF4mIuH2fY7QU+2 NJ4l2kHuKv479luGw0axf9GWVrgQ06Z/aq5Qq/taPi3MsrMpWJ1Jf7YuGo2CS/JFfApis6WA4fQ9b RQvdye94HdtVrMWBUkUxAANbr72MYg/15GEOiTmyD+g/NlqulmaZQKFeVgo9IQ89Be62oe2lizOBl jZFpUbLMveIUnAWXC1jhksZp47RDmt+tJ5FZwuiNIpg5GV100CnEmyZmVslUfAoq4cnPFt1Hx1qhL 18sSzTp0eC70cvJIfBGOnQ==; Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1tadHS-0008Sa-5u; Wed, 22 Jan 2025 11:08:40 -0500 From: "Alfred M. Szmidt" To: Roland Winkler In-Reply-To: <87ldv2q24t.fsf@gnu.org> (message from Roland Winkler on Wed, 22 Jan 2025 09:50:10 -0600) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <874j1sbfji.fsf@gmail.com> <87tt9r8d32.fsf@gmail.com> <86ldv23n1s.fsf@gnu.org> <87ldv2q24t.fsf@gnu.org> Message-Id: Date: Wed, 22 Jan 2025 11:08:38 -0500 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: rpluim@gmail.com, stepheng+emacs@gildea.com, monnier@gnu.org, arash@gnu.org, 75170@debbugs.gnu.org, stefankangas@gmail.com, eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) I like Stephen's arguments for adding add-to-alist to emacs that are based on 20+ years of actually using it in his init file. There are also examples of people not using it too, just because one or two users have an idea doesn't mean that such a trivial utility function makes sense to be added to Emacs. What is wrong with just using add-to-list? So far it seems to be "personal preference" and some worry that it adds keys multiple times into the alist bucket which seems like a trivial worry, and also .. how alists are supposed to work. From debbugs-submit-bounces@debbugs.gnu.org Wed Jan 22 16:56:36 2025 Received: (at 75170) by debbugs.gnu.org; 22 Jan 2025 21:56:36 +0000 Received: from localhost ([127.0.0.1]:36942 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taiiC-0003Sw-H0 for submit@debbugs.gnu.org; Wed, 22 Jan 2025 16:56:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60044) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taiiA-0003Sh-MY for 75170@debbugs.gnu.org; Wed, 22 Jan 2025 16:56:35 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taii4-0006sj-Ny; Wed, 22 Jan 2025 16:56:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=jbBdMq5W5/sSlbq0rM+CUGCyZttvqqS7wrZMOlHkvak=; b=U/xDQXPwc1mchBdKtdRZ 0Pswz4vhBwPCjyXfBU3FjNnUvMkJnMXuA+a/GhserPhRFJpTLWfVONUkBcQIOMsWIcx9iFNwkRRrf W2fz4ME+gxRokQ3bO2Hc63Rxh8N713uWD1/mU4GgeRQxjpuX+CTxiAgrHVvJL8zhBBf/DqcVbBPMF CjmUHrlIgxO9kjRKAFk4EeUpd1WNC3cJIMxRYlCbv1uTlYLmAzXAgsmOh+mnYuRao3ubjlH3vyfig M+1oUiRG9symKT6UBD64q9eOKS2Tgfj8x2YU25QqCgU+9unNlKY7k8uBnIlRHpitHp0ms9hZDxnG2 +PsmAmtaCzOUpA==; From: Arash Esbati To: Eli Zaretskii Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <86ldv23n1s.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 22 Jan 2025 17:06:55 +0200") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <874j1sbfji.fsf@gmail.com> <87tt9r8d32.fsf@gmail.com> <86ldv23n1s.fsf@gnu.org> Date: Wed, 22 Jan 2025 22:56:24 +0100 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: rpluim@gmail.com, winkler@gnu.org, monnier@gnu.org, ams@gnu.org, 75170@debbugs.gnu.org, stefankangas@gmail.com, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Eli Zaretskii writes: > Let's begin by fixing the doc strings, then. We can consider adding > to manual later, but the built-in documentation must be clear enough > to use map.el. For example, I was looking at the docstring of `map-insert': (map-insert MAP KEY VALUE) Return a new map like MAP except that it associates KEY with VALUE. For me, something like this would have been easier to grasp: Cons KEY/VALUE in front of MAP replacing value associated to KEY with VALUE. Next, I eval'ed: (map-insert '((y . 1)) 'a 2) => ((a . 2) (y . 1)) (map-insert '((y . 2) (x . 1)) 'x 3) => ((x . 3) (y . 2) (x . 1)) And sort of gave up since I was expecting ((x . 3) (y . 2)). But again, maybe it's just me having problems understanding the docstring. P.S. Sorry for hijacking this thread, maybe we should move this discussion somewhere else. Best, Arash From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 23 00:51:11 2025 Received: (at 75170) by debbugs.gnu.org; 23 Jan 2025 05:51:11 +0000 Received: from localhost ([127.0.0.1]:38675 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1taq7T-0005cr-7J for submit@debbugs.gnu.org; Thu, 23 Jan 2025 00:51:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34390) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1taq7R-0005cb-5x for 75170@debbugs.gnu.org; Thu, 23 Jan 2025 00:51:09 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1taq7L-000478-Mt; Thu, 23 Jan 2025 00:51:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=C1lUa3xyUOJhr/LHsWR6KB86ftY1W4X4syerG729L7E=; b=aUUK5dgEzHJ4 LlkEC3uSYdV3FVoA6SEdV5fGQ9aKw+L9iKnBpEvxu/yHoPHoOcm1UAfd+QXJLWHpDcTPoKL8t+TL/ Y5VlfNQskvDi5bkwokD35HQxSnmcZWYEtTV7elezsj3m+h0b36GcfFKMDW3RKCWy921O0E4wO+SiP i6qgDNYEoCaw8iAPcHdXJHTyPk0k1Zt1TH8Pbi6KVr6KzrItdYMArZhjNliIkDu+tH91JzSET437c LLP0LICx/wd3+4xGppuEsl/UEh4V+ai1GWI72hmmaOvX7vsyYKyj01DXgcu1c0kRlx5bzMRBj5fYX HbzR1NZAz4NpoCkpxle0Fg==; Received: from ams by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1taq7K-0003Pq-95; Thu, 23 Jan 2025 00:51:02 -0500 From: "Alfred M. Szmidt" To: Arash Esbati In-Reply-To: (message from Arash Esbati on Wed, 22 Jan 2025 22:56:24 +0100) Subject: Re: bug#75170: add-to-alist: new function References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <874j1sbfji.fsf@gmail.com> <87tt9r8d32.fsf@gmail.com> <86ldv23n1s.fsf@gnu.org> Message-Id: Date: Thu, 23 Jan 2025 00:51:02 -0500 X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: rpluim@gmail.com, winkler@gnu.org, monnier@gnu.org, 75170@debbugs.gnu.org, stefankangas@gmail.com, eliz@gnu.org, acorallo@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Please create a new ticket, or thread about improving map.el. From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 24 11:39:54 2025 Received: (at 75170) by debbugs.gnu.org; 24 Jan 2025 16:39:54 +0000 Received: from localhost ([127.0.0.1]:46735 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tbMin-000151-Le for submit@debbugs.gnu.org; Fri, 24 Jan 2025 11:39:53 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44860) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tbMii-000143-OT for 75170@debbugs.gnu.org; Fri, 24 Jan 2025 11:39:49 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tbMic-00082n-AW; Fri, 24 Jan 2025 11:39:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=uSdu9uv1heSR7MBCEM+E9hkvltk8Aw3jStaWOiYgvo4=; b=Xt/bEx3b8299+/CK3pad nMvbotkb6p6rB6OT4QDUw+LCqu1fapr3eHTn0GSqBVYq9vT54VgaFTXXly6BUzhBhEwnr0KM27vUp QQNtIYvsGZ9PwdFXxekgKJdo2DWSzS6e7YUtBDseiAI3b3P/4Xn0uD0ktQI36jadlvXD2kcNd/S5K x/+PumoKNO9/fVOMBNBPEu8Y0RWgHvzsTWn+OK0vD6BeT/k3doJa3uzKBkZLbehgwGCQgKwdH/lis /6jLQWxJVK+bx3Lmh/s78Wn4CP/fb9QLrqOCon09km5e6eZajXcy5BhSfSXra5OTr1TTNR5lUU2Oo bbrIDfXmaQUP6A==; From: Roland Winkler To: Eli Zaretskii Subject: Re: bug#75170: add-to-alist: new function In-Reply-To: <86tt9r2bb7.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 22 Jan 2025 16:05:48 +0200") References: <878qrzm4sb.fsf@gnu.org> <86cyhbq66r.fsf@gnu.org> <87zfkelf11.fsf@gnu.org> <86wmf970df.fsf@gnu.org> <86sepgbh5j.fsf@gnu.org> <87ed0xd8t5.fsf@gmail.com> <87a5blti3v.fsf@gnu.org> <87wmepryee.fsf@gnu.org> <87ikq8bmps.fsf@gmail.com> <868qr43rnl.fsf@gnu.org> <87msfk0y8y.fsf@gnu.org> <8634hb52qz.fsf@gnu.org> <86tt9r2bb7.fsf@gnu.org> Date: Fri, 24 Jan 2025 10:39:38 -0600 Message-ID: <87jzakmaid.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75170 Cc: 75170@debbugs.gnu.org, rpluim@gmail.com, acorallo@gnu.org, Stefan Kangas , monnier@gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) On Wed, Jan 22 2025, Eli Zaretskii wrote: > I don't have strong feelings or opinions, actually. Adding another > API whose name is similar to an existing one, but which works > differently (and what's worse, has different syntactic requirements), > will add to confusion and to the documentation efforts (need to go > through all the places where we currently recommend add-to-list and > change them). But if enough people insist on that... > > I do still wonder why people who most certainly know about Emacs Lisp > enough to use setf/alist-git insist on adding this function to Emacs, > even though they've already solved their problem by having a private > definition for it. Why insist on adding this to Emacs? But I don't > necessarily expect an answer to that. I can certainly remember my own learning curve with emacs. Only now I can meaningfully advocate for something that would have helped me years ago. I can come up with a patch that also considers current recommendations for add-to-list. Right now, I have too many other things on my plate. But I should be able to submit a patch for review around end of next month.