all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Jimmy Yuen Ho Wong <wyuenho@gmail.com>
Cc: 63338@debbugs.gnu.org
Subject: bug#63338: 29.0.90; package-vc-install'ing the same package multiple times results in duplication in package-selected-packages
Date: Mon, 08 May 2023 10:36:55 +0000	[thread overview]
Message-ID: <873547jeig.fsf@posteo.net> (raw)
In-Reply-To: <m2a5yhoxb7.fsf@MobileCat.localdomain> (Jimmy Yuen Ho Wong's message of "Sun, 07 May 2023 00:27:24 +0100")

[-- Attachment #1: Type: text/plain, Size: 574 bytes --]

Jimmy Yuen Ho Wong <wyuenho@gmail.com> writes:

> Reproduction:
>
> 0. (setq custom-file (const user-emacs-directory "custom.el"))
> 1. M-x package-vc-install company
> 2. M-x package-vc-install company RET y
> 3. C-x C-f ~/.emacs/custom.el
> 4. Observe that `company` has been listed twice under
> `package-selected-packages`.
>
> Expectation:
>
> Installing the same package twice should not result in its duplication
> in `package-selected-packages`.

An easy fix would be just to ensure that package-selected-packages is
always deduplicated before assigning the value:


[-- Attachment #2: Type: text/plain, Size: 637 bytes --]

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index bbe2b8bb4af..988b92da75b 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1992,7 +1992,7 @@ package--find-non-dependencies
 (defun package--save-selected-packages (&optional value)
   "Set and save `package-selected-packages' to VALUE."
   (when value
-    (setq package-selected-packages value))
+    (setq package-selected-packages (delete-dups value)))
   (if after-init-time
       (customize-save-variable 'package-selected-packages package-selected-packages)
     (add-hook 'after-init-hook #'package--save-selected-packages)))

  reply	other threads:[~2023-05-08 10:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-06 23:27 bug#63338: 29.0.90; package-vc-install'ing the same package multiple times results in duplication in package-selected-packages Jimmy Yuen Ho Wong
2023-05-08 10:36 ` Philip Kaludercic [this message]
2023-05-08 12:04   ` Eli Zaretskii
2023-05-09  2:56     ` Jimmy Wong
2023-05-10  6:56       ` Philip Kaludercic
2023-05-13 17:18         ` Philip Kaludercic
2023-05-14 12:51           ` Jimmy Wong
2023-05-16 19:31             ` Philip Kaludercic

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=873547jeig.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=63338@debbugs.gnu.org \
    --cc=wyuenho@gmail.com \
    /path/to/YOUR_REPLY

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

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

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

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