[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Forcing reinstall in package.el

From: Phil Hagelberg
Subject: [PATCH] Forcing reinstall in package.el
Date: Thu, 10 Feb 2011 10:05:50 -0800

On Wed, Dec 29, 2010 at 12:08 PM, Phil Hagelberg <address@hidden> 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  <address@hidden>

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


>From 5f2acffcae9b76aafd1001c8e6bae77d060e29ce Mon Sep 17 00:00:00 2001
From: Phil Hagelberg <address@hidden>
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")
-       (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)
           (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))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]