Fix documentation of saveplace facilities for Dired

* lisp/saveplace.el (save-place-dired-hook, save-place-alist):
* lisp/dired.el (dired-initial-position-hook)
(dired-initial-position): Doc fixes.  (Bug#65055)
This commit is contained in:
Eli Zaretskii 2023-08-05 12:13:47 +03:00
parent 4ed9d61c89
commit f2b2c752a5
2 changed files with 17 additions and 5 deletions

View file

@ -346,7 +346,7 @@ with the buffer narrowed to the listing."
:type 'boolean)
(defcustom dired-initial-position-hook nil
"This hook is used to position the point.
"Hook used to position point in a new Dired listing display.
It is run by the function `dired-initial-position'."
:group 'dired
:type 'hook
@ -3541,9 +3541,9 @@ as returned by `dired-get-filename'. LIMIT is the search limit."
;; FIXME document whatever dired-x is doing.
(defun dired-initial-position (dirname)
"Where point should go in a new listing of DIRNAME.
Point is assumed to be at the beginning of new subdir line.
It runs the hook `dired-initial-position-hook'."
"Return position of point in a new listing of DIRNAME.
Point is assumed to be at the beginning of a new subdir line.
Runs the hook `dired-initial-position-hook'."
(end-of-line)
(and (featurep 'dired-x) dired-find-subdir
(dired-goto-subdir dirname))

View file

@ -47,6 +47,17 @@
Each element looks like (FILENAME . POSITION);
visiting file FILENAME goes automatically to position POSITION
rather than the beginning of the buffer.
A list element can also have the form
(DIRECTORY (dired-filename . FILENAME))
where DIRECTORY is the name of a directory ending in a slash,
and FILENAME is the name of a file in that directory. This
format is used for saving places in Dired buffers, see the
function `save-place-dired-hook'; the FILENAME is the file
where point was located in the Dired listing of DIRECTORY
when the place in that buffer was recorded.
This alist is saved between Emacs sessions.")
(defcustom save-place-file (locate-user-emacs-file "places" ".emacs-places")
@ -366,7 +377,8 @@ It runs the hook `save-place-after-find-file-hook'."
(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)