Subject: bug#22616: 25.0.50; Change to lm-header breaks lm-header-multiline

From: Dmitry Gutov <[email-masked]>
Date: Wed, 11 May 2016 03:00:22 +0300

On 05/09/2016 05:13 AM, Artur Malabarba wrote:
> IIRC, I made this change because the previous behaviour caused
> `package-install-from-buffer' to move point. Since I saw no reason for
> lm-header to move point, I fixed the issue at its roots.

Doesn't package-install-from-buffer currently move point anyway? It 
jumps to the end of the buffer.

Moving save-excursion there does help.

diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 3f0e972..f481157 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1979,17 +1979,18 @@ package-install-from-buffer
  Downloads and installs required packages as needed."
    (interactive)
    (let* ((pkg-desc
-          (cond
-            ((derived-mode-p 'dired-mode)
-             ;; This is the only way a package-desc object with a `dir'
-             ;; desc-kind can be created.  Such packages can't be
-             ;; uploaded or installed from archives, they can only be
-             ;; installed from local buffers or directories.
-             (package-dir-info))
-            ((derived-mode-p 'tar-mode)
-             (package-tar-file-info))
-            (t
-             (package-buffer-info))))
+          (save-excursion
+            (cond
+             ((derived-mode-p 'dired-mode)
+              ;; This is the only way a package-desc object with a `dir'
+              ;; desc-kind can be created.  Such packages can't be
+              ;; uploaded or installed from archives, they can only be
+              ;; installed from local buffers or directories.
+              (package-dir-info))
+             ((derived-mode-p 'tar-mode)
+              (package-tar-file-info))
+             (t
+              (package-buffer-info)))))
           (name (package-desc-name pkg-desc)))
      ;; Download and install the dependencies.
      (let* ((requires (package-desc-reqs pkg-desc))