+2014-12-27 Juri Linkov <juri@linkov.net>
+
+ Support subdirectories when saving places in dired.
+ * saveplace.el (toggle-save-place, save-place-to-alist)
+ (save-places-to-alist, save-place-dired-hook):
+ Use dired-current-directory instead of dired-directory (bug#19436).
+ (save-place-dired-hook): Add check for alist to make the new
+ format future-proof to allow other possible formats.
+
2014-12-26 Fabián Ezequiel Gallina <fgallina@gnu.org>
python.el: Generate clearer shell buffer names.
\(setq-default save-place t)"
(interactive "P")
(if (not (or buffer-file-name (and (derived-mode-p 'dired-mode)
- dired-directory)))
+ (dired-current-directory))))
(message "Buffer `%s' not visiting a file or directory" (buffer-name))
(setq save-place (if parg
(> (prefix-numeric-value parg) 0)
;; file. If not, do so, then feel free to modify the alist. It
;; will be saved again when Emacs is killed.
(or save-place-loaded (load-save-place-alist-from-file))
- (let ((item (or buffer-file-name
- (and (derived-mode-p 'dired-mode)
- dired-directory
- (expand-file-name (if (consp dired-directory)
- (car dired-directory)
- dired-directory))))))
+ (let* ((directory (and (derived-mode-p 'dired-mode)
+ (dired-current-directory)))
+ (item (or buffer-file-name
+ (and directory
+ (expand-file-name (if (consp directory)
+ (car directory)
+ directory))))))
(when (and item
(or (not save-place-ignore-files-regexp)
(not (string-match save-place-ignore-files-regexp
(position (cond ((eq major-mode 'hexl-mode)
(with-no-warnings
(1+ (hexl-current-address))))
- ((and (derived-mode-p 'dired-mode)
- dired-directory)
+ ((and (derived-mode-p 'dired-mode) directory)
(let ((filename (dired-get-filename nil t)))
(if filename
`((dired-filename . ,filename))
;; 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)
- dired-directory))
+ (dired-current-directory)))
(save-place-to-alist))
(setq buf-list (cdr buf-list))))))
(defun save-place-dired-hook ()
"Position the point in a Dired buffer."
(or save-place-loaded (load-save-place-alist-from-file))
- (let ((cell (assoc (and (derived-mode-p 'dired-mode)
- dired-directory
- (expand-file-name (if (consp dired-directory)
- (car dired-directory)
- dired-directory)))
- save-place-alist)))
+ (let* ((directory (and (derived-mode-p 'dired-mode)
+ (dired-current-directory)))
+ (cell (assoc (and directory
+ (expand-file-name (if (consp directory)
+ (car directory)
+ directory)))
+ save-place-alist)))
(if cell
(progn
(or revert-buffer-in-progress-p
- (if (integerp (cdr cell))
- (goto-char (cdr cell))
- (and (assq 'dired-filename (cdr cell))
- (dired-goto-file (cdr (assq 'dired-filename (cdr cell)))))))
+ (cond
+ ((integerp (cdr cell))
+ (goto-char (cdr cell)))
+ ((and (listp (cdr cell)) (assq 'dired-filename (cdr cell)))
+ (dired-goto-file (cdr (assq 'dired-filename (cdr cell)))))))
;; and make sure it will be saved again for later
(setq save-place t)))))