Subject: bug#19851: 25.0.50; package-install-{file,from-buffer} broken

From: Juri Linkov <[email-masked]>
Date: Mon, 15 Jun 2015 23:56:34 +0300

> Found it.  It is from using package-install-file on a directory while
> saveplace is enabled.  Saveplace gets stuck.  From emacs -Q:
>
> 1. mkdir /some/new/dir
> 2. Evaluate:
>
>   (setq-default save-place t)
>   (require 'saveplace)
>   (package-initialize)
>
> 3. M-x package-install-file RET /some/new/dir RET
>
>   "dired-current-directory: No subdir-alist in  *temp*"
>
> In order to quit emacs, one has to hack around kill-emacs-hook.

Does this patch fix it for you?

diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index fe54743..5bbcd79 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -158,6 +158,8 @@ (defun toggle-save-place (&optional parg) ;FIXME: save-place-local-mode!
 \(setq-default save-place t)"
   (interactive "P")
   (if (not (or buffer-file-name (and (derived-mode-p 'dired-mode)
+                                     (boundp 'dired-subdir-alist)
+				     dired-subdir-alist
 				     (dired-current-directory))))
       (message "Buffer `%s' not visiting a file or directory" (buffer-name))
     (setq save-place (if parg
@@ -178,6 +180,8 @@ (defun save-place-to-alist ()
   ;; will be saved again when Emacs is killed.
   (or save-place-loaded (load-save-place-alist-from-file))
   (let* ((directory (and (derived-mode-p 'dired-mode)
+                         (boundp 'dired-subdir-alist)
+			 dired-subdir-alist
 			 (dired-current-directory)))
 	 (item (or buffer-file-name
 		   (and directory
@@ -310,6 +314,8 @@ (defun save-places-to-alist ()
 	;; save-place checks buffer-file-name too, but we can avoid
 	;; overhead of function call by checking here too.
 	(and (or buffer-file-name (and (derived-mode-p 'dired-mode)
+                                       (boundp 'dired-subdir-alist)
+				       dired-subdir-alist
 				       (dired-current-directory)))
 	     (save-place-to-alist))
 	(setq buf-list (cdr buf-list))))))
@@ -331,6 +337,8 @@ (defun save-place-dired-hook ()
   "Position the point in a Dired buffer."
   (or save-place-loaded (load-save-place-alist-from-file))
   (let* ((directory (and (derived-mode-p 'dired-mode)
+                         (boundp 'dired-subdir-alist)
+			 dired-subdir-alist
 			 (dired-current-directory)))
 	 (cell (assoc (and directory
 			   (expand-file-name (if (consp directory)