From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alex Newsgroups: gmane.emacs.bugs Subject: bug#14967: 24.3.50; package-delete deletes by trashing? Date: Sun, 11 Jun 2017 21:26:20 -0600 Message-ID: <87o9tt51k3.fsf@gmail.com> References: <87k2et39vp.fsf@gmail.com> <87efuqulfb.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1497238030 13866 195.159.176.226 (12 Jun 2017 03:27:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 12 Jun 2017 03:27:10 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: Sebastian Wiesner , Stefan Monnier , 14967@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 12 05:27:06 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKG0P-0003NI-Td for geb-bug-gnu-emacs@m.gmane.org; Mon, 12 Jun 2017 05:27:06 +0200 Original-Received: from localhost ([::1]:35939 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKG0V-0003o1-7H for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 Jun 2017 23:27:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40939) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dKG0P-0003nv-8t for bug-gnu-emacs@gnu.org; Sun, 11 Jun 2017 23:27:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dKG0M-00077y-3h for bug-gnu-emacs@gnu.org; Sun, 11 Jun 2017 23:27:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39018) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dKG0M-00077r-0K for bug-gnu-emacs@gnu.org; Sun, 11 Jun 2017 23:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dKG0L-0007KJ-Mz for bug-gnu-emacs@gnu.org; Sun, 11 Jun 2017 23:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alex Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 12 Jun 2017 03:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 14967 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: notabug Original-Received: via spool by 14967-submit@debbugs.gnu.org id=B14967.149723799128129 (code B ref 14967); Mon, 12 Jun 2017 03:27:01 +0000 Original-Received: (at 14967) by debbugs.gnu.org; 12 Jun 2017 03:26:31 +0000 Original-Received: from localhost ([127.0.0.1]:41695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKFzr-0007Jd-Ge for submit@debbugs.gnu.org; Sun, 11 Jun 2017 23:26:31 -0400 Original-Received: from mail-it0-f65.google.com ([209.85.214.65]:33619) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKFzp-0007JO-7f for 14967@debbugs.gnu.org; Sun, 11 Jun 2017 23:26:29 -0400 Original-Received: by mail-it0-f65.google.com with SMTP id l6so10477415iti.0 for <14967@debbugs.gnu.org>; Sun, 11 Jun 2017 20:26:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=fbCm0EyZLk0UrjQL2A/DYaPktXuYZAgQcTyqmckAS+I=; b=GOIA8i9eI/cIfFnEUxAsb/2UzNH1tmmgQZeuQZfW2i6z7fcCSVDCDMqFX2j+JRHnK+ DdKNWCzmKM1LOkmYFgvkw2Ork9KVEDjAAmmgBvilqjZXCsMQJzUVQzfnwz4WCOTMbR9t T6BCBQ9wvFQYlQrULYFvO5zfU0jAED1LPecOu6+8IssHz9PY8OpbORnsCljndtDrg3c0 0DCwEOMer9iGZ1JPnxHxEOJwtkanXRYiv6ltq/mUGbijG3TXN49pORjpyG4ycil6pBuv IwQuxRReLTjKGAKtLLhbgEONR//Xxxbb/S1K/+dZuDu2hYRBWuwPBUJvpti6Oa4lGWlu e2sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=fbCm0EyZLk0UrjQL2A/DYaPktXuYZAgQcTyqmckAS+I=; b=NIfTvMIYADwwH0oluJ/mL7xWS+u84uCGIereTOAturg+PZ573pYHKjHkzNIf5uAwHa PZfp35qaI1F3J7QZsL3xLaGzp/EKx5fyFYHMBybsvqyoAgeeG1yuZ4L+w801B8kvruGB vO/K/Deh0dcHla4MqlEUvv8ksUEtmQqqkODkCplSQSC4+Z0as42poHukOTVm9K7y6od4 +BNjh8Rrr42xXsNbBw6uopTT0ETdVv/Nv0jHdT/jP1r2iuRLrF9nxWYk2eP2+LxeQOVm vexraGtpjySBe+GsW+et0CeBaELxswyyTpruPRQnoXXvCUr0MbChEP0IVQVG9BAxBJfW XPKA== X-Gm-Message-State: AODbwcDqCem7I47zTB5FvqoNEHNTR1FnQU/l7a08/ZQosNk70cyVMmOS z23Zb4M+dShoXg== X-Received: by 10.36.203.132 with SMTP id u126mr9822883itg.11.1497237983665; Sun, 11 Jun 2017 20:26:23 -0700 (PDT) Original-Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59]) by smtp.gmail.com with ESMTPSA id 131sm2222120ioo.5.2017.06.11.20.26.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 11 Jun 2017 20:26:22 -0700 (PDT) In-Reply-To: <87efuqulfb.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Sun, 11 Jun 2017 19:58:00 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:133492 Archived-At: --=-=-= Content-Type: text/plain npostavs@users.sourceforge.net writes: > severity 14967 wishlist > quit > > Alex writes: > >> Stefan Monnier writes: >> >>>> Well, obviously I consider this behavior a bug. Trash is no place for >>>> deleted packages. I mean, does apt-get remove use the Trash?! >>> >>> I think the reasoning goes as follows: >>> Emacs uses "trash" when deleting a file upon the user's request (as >>> opposed to things like temp files used internally). >> >> Could there perhaps be a separate configuration option for deleting >> packages versus trashing them? I usually like Emacs using the trash, but >> I don't see a reason why packages should go there myself. > > Seems reasonable. Here's a patch for it. --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Make-package-delete-conditionally-not-use-the-trash.patch Content-Description: patch >From cf3039f10846155fde224a1f6c249799ab7cf41d Mon Sep 17 00:00:00 2001 From: Alexander Gramiak 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: Document it. --- etc/NEWS | 3 +++ lisp/emacs-lisp/package.el | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/etc/NEWS b/etc/NEWS index 7972511f7a..fa1e5c1312 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -743,6 +743,9 @@ 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. + ** Tramp +++ diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index bebfd18d7a..5173a32e33 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -2071,6 +2071,11 @@ package--newest-p (equal (cadr (assq (package-desc-name pkg) package-alist)) pkg)) +(defvar 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.") + (defun package-delete (pkg-desc &optional force nosave) "Delete package PKG-DESC. @@ -2127,7 +2132,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 --=-=-=--