From: Michael Albinus Date: Sat, 5 Aug 2023 16:18:30 +0000 (+0200) Subject: Merge from origin/emacs-29 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=479c0543b68746977cf74414d5348a918f8c6695;p=emacs.git Merge from origin/emacs-29 f2b2c752a59 Fix documentation of saveplace facilities for Dired 4ed9d61c89a ; * lisp/tab-bar.el: Autoload cl--set-substring, as that ... 30976ecd8d8 ; * lisp/bindings.el (mode-line-modes): Fix typo (bug#650... 8574ef314c4 Fix loaddef generation with ";;;foo-autoload" cookies in ... 8cbd4a02a2b Delete comment saying that project.el is experimental --- 479c0543b68746977cf74414d5348a918f8c6695 diff --cc lisp/saveplace.el index 18d296ba2d9,71cd8b9bc0e..a28de6f63a8 --- a/lisp/saveplace.el +++ b/lisp/saveplace.el @@@ -399,27 -377,28 +410,28 @@@ It runs the hook `save-place-after-find (declare-function dired-goto-file "dired" (file)) (defun save-place-dired-hook () - "Position the point in a Dired buffer." + "Position point in a Dired buffer according to its saved place. + This is run via `dired-initial-position-hook', which see." (or save-place-loaded (save-place-load-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) - (car directory) - directory))) - save-place-alist))) - (if cell - (progn - (or revert-buffer-in-progress-p - (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-mode t))))) + (when-let ((directory (and (derived-mode-p 'dired-mode) + (boundp 'dired-subdir-alist) + dired-subdir-alist + (dired-current-directory))) + (item (expand-file-name (if (consp directory) + (car directory) + directory))) + (cell (assoc (if save-place-abbreviate-file-names + (abbreviate-file-name item) item) + save-place-alist))) + (or revert-buffer-in-progress-p + (cond + ((integerp (cdr cell)) + (goto-char (cdr cell))) + ((listp (cdr cell)) + (when-let ((elt (assq 'dired-filename (cdr cell)))) + (dired-goto-file (expand-file-name (cdr elt))))))) + ;; and make sure it will be saved again for later + (setq save-place-mode t))) (defun save-place-kill-emacs-hook () ;; First update the alist. This loads the old save-place-file if nec.