unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Phil Hagelberg <phil@hagelb.org>
To: emacs-devel@gnu.org
Subject: [PATCH] Forcing reinstall in package.el
Date: Thu, 10 Feb 2011 10:05:50 -0800	[thread overview]
Message-ID: <AANLkTinpFd_rcRPKt9q=7vhvue7pBkB72w4MR+FReSmd@mail.gmail.com> (raw)
In-Reply-To: <AANLkTin8HGP=NFi-AptW=9bZnZWtAZ3Z211Mko2N=DC8@mail.gmail.com>

On Wed, Dec 29, 2010 at 12:08 PM, Phil Hagelberg <phil@hagelb.org> wrote:
> Reinstalling the same version is very common for package developers.
>
> I'm only talking about overwriting files. Since different versions
> live in different paths, if you choose to install an older/newer
> version that hasn't been installed yet, you won't get an overwrite
> warning either way, so that question is really orthogonal.
>
> The only question about my proposed change is whether overwriting
> already-installed packages should happen automatically or require a
> prompt/prefix. I suppose it would be possible to have local changes to
> your packages that you want to avoid blowing away, so requiring a
> prompt is slightly safer. I will work on a patch that does this unless
> there are further objections.

Now I feel silly for not writing this patch sooner since it turned out to be
so simple. So here it is.

2011-02-10  Phil Hagelberg  <phil@hagelb.org>

	* emacs-lisp/package.el (package-unpack-single): Allow packages to
	be reinstalled.


-Phil

From 5f2acffcae9b76aafd1001c8e6bae77d060e29ce Mon Sep 17 00:00:00 2001
From: Phil Hagelberg <technomancy@gmail.com>
Date: Thu, 16 Sep 2010 22:17:59 -0700
Subject: [PATCH] Don't set 'excl when calling write-region.

This fixes a bug where re-installing a package would fail.
---
 lisp/emacs-lisp/package.el |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 54c6a09..3a77cd0 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -574,23 +574,22 @@ Otherwise it uses an external `tar' program.
       (let ((load-path (cons pkg-dir load-path)))
 	(byte-recompile-directory pkg-dir 0 t)))))

-(defun package--write-file-no-coding (file-name excl)
+(defun package--write-file-no-coding (file-name)
   (let ((buffer-file-coding-system 'no-conversion))
-    (write-region (point-min) (point-max) file-name nil nil nil excl)))
+    (write-region (point-min) (point-max) file-name)))

 (defun package-unpack-single (file-name version desc requires)
   "Install the contents of the current buffer as a package."
   ;; Special case "package".
   (if (string= file-name "package")
       (package--write-file-no-coding
-       (expand-file-name (concat file-name ".el") package-user-dir)
-       nil)
+       (expand-file-name (concat file-name ".el") package-user-dir))
     (let* ((pkg-dir  (expand-file-name (concat file-name "-" version)
 				       package-user-dir))
 	   (el-file  (expand-file-name (concat file-name ".el") pkg-dir))
 	   (pkg-file (expand-file-name (concat file-name "-pkg.el") pkg-dir)))
       (make-directory pkg-dir t)
-      (package--write-file-no-coding el-file 'excl)
+      (package--write-file-no-coding el-file)
       (let ((print-level nil)
 	    (print-length nil))
 	(write-region
-- 
1.7.0.4



  parent reply	other threads:[~2011-02-10 18:05 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14 18:21 Forcing reinstall in package.el Phil Hagelberg
2010-12-14 21:28 ` Ted Zlatanov
2010-12-15  1:27   ` Phil Hagelberg
2010-12-15 14:55     ` Ted Zlatanov
2010-12-15 20:06       ` Tom Tromey
2010-12-15 21:54         ` Ted Zlatanov
2010-12-29 20:08           ` Phil Hagelberg
2011-01-19 20:18             ` Ted Zlatanov
2011-02-10 18:05             ` Phil Hagelberg [this message]
2011-02-12  1:18               ` [PATCH] " Chong Yidong
2010-12-17  4:10         ` Stefan Monnier
2010-12-17 14:17           ` Tom Tromey
2010-12-17 14:48             ` Ted Zlatanov
2010-12-17 15:56               ` Tom Tromey
2010-12-18 15:42                 ` Ted Zlatanov
2010-12-21 15:42                   ` Tom Tromey

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to='AANLkTinpFd_rcRPKt9q=7vhvue7pBkB72w4MR+FReSmd@mail.gmail.com' \
    --to=phil@hagelb.org \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).