all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alex <agrambot@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: lunaryorn@gmail.com, monnier@iro.umontreal.ca,
	14967@debbugs.gnu.org, npostavs@users.sourceforge.net
Subject: bug#14967: 24.3.50; package-delete deletes by trashing?
Date: Mon, 12 Jun 2017 13:37:46 -0600	[thread overview]
Message-ID: <87vao12e0l.fsf@gmail.com> (raw)
In-Reply-To: <83bmpt5li4.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 12 Jun 2017 17:27:47 +0300")

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

Eli Zaretskii <eliz@gnu.org> writes:

>> +(defvar package-trash-old-packages t
>> +  "If non-nil, `package-delete' may trash packages.
>
> Why "may"?

Since after this patch, `package-delete' may trash packages, or may not,
depending on the value of `delete-by-moving-to-trash'.

>> +`delete-by-moving-to-trash' must be non-nil for this variable to
>> +have an effect.")
>
> I think it would be better to make this defcustom.

Right, I forgot to do that. I updated and attached a new patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: trash2 --]
[-- Type: text/x-patch, Size: 2065 bytes --]

From ee33b113826efb6130dfe2d9c568b8e4ddc80eb2 Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@gmail.com>
Date: Sun, 11 Jun 2017 21:12:24 -0600
Subject: [PATCH] Make package-delete conditionally not use the trash

Some users would like to trash other files, but not old package
files (Bug#14967).

* lisp/emacs-lisp/package.el: Add `package-trash-old-packages'.
---
 etc/NEWS                   | 4 ++++
 lisp/emacs-lisp/package.el | 9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/etc/NEWS b/etc/NEWS
index 7972511f7a..ee99d114a7 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -743,6 +743,10 @@ header's value.
 where the GnuPG home directory (used for signature verification) is
 located and whether GnuPG's option "--homedir" is used or not.
 
+*** The new variable 'package-trash-old-packages' has been added to
+control whether or not 'package-delete' trashes old packages
+files. The default behaviour is to trash old packages.
+
 ** Tramp
 
 +++
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index bebfd18d7a..c92ce19e6c 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -368,6 +368,13 @@ package-menu-async
   :type 'boolean
   :version "25.1")
 
+(defcustom package-trash-old-packages t
+  "If non-nil, `package-delete' may trash packages.
+`delete-by-moving-to-trash' must be non-nil for this variable to
+have an effect."
+  :type 'boolean
+  :version "26.1")
+
 \f
 ;;; `package-desc' object definition
 ;; This is the struct used internally to represent packages.
@@ -2127,7 +2134,7 @@ package-delete
                   (package-desc-name pkg-used-elsewhere-by)))
           (t
            (add-hook 'post-command-hook #'package-menu--post-refresh)
-           (delete-directory dir t t)
+           (delete-directory dir t package-trash-old-packages)
            ;; Remove NAME-VERSION.signed and NAME-readme.txt files.
            (dolist (suffix '(".signed" "readme.txt"))
              (let* ((version (package-version-join (package-desc-version pkg-desc)))
-- 
2.11.0


      parent reply	other threads:[~2017-06-12 19:37 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-27 10:30 bug#14967: 24.3.50; package-delete deletes by trashing? Sebastian Wiesner
2013-07-29 22:02 ` Glenn Morris
2013-07-30 10:51   ` Sebastian Wiesner
2013-07-30 14:21     ` Stefan Monnier
2013-07-30 14:40       ` Sebastian Wiesner
2013-07-30 15:14         ` Stefan Monnier
2016-08-05 23:40           ` npostavs
2016-09-03  4:06       ` Alex
2017-06-11 23:58         ` npostavs
2017-06-12  3:26           ` Alex
2017-06-12 14:27             ` Eli Zaretskii
2017-06-12 16:03               ` Glenn Morris
2017-06-12 16:33                 ` Eli Zaretskii
2017-06-12 16:56                   ` Glenn Morris
2017-06-12 17:02                     ` Stefan Monnier
2017-06-14  2:54                       ` Richard Stallman
2017-06-12 17:04                     ` Eli Zaretskii
2017-06-12 17:17                       ` Stefan Monnier
2017-06-12 19:45                         ` Alex
2017-06-12 20:32                           ` Glenn Morris
2017-06-13  3:50                             ` Alex
2017-06-19 18:47                             ` Glenn Morris
2017-06-12 19:37               ` Alex [this message]

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=87vao12e0l.fsf@gmail.com \
    --to=agrambot@gmail.com \
    --cc=14967@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=lunaryorn@gmail.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=npostavs@users.sourceforge.net \
    /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.