1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

* lisp/man.el (man): Use active region for the default value.

While reading a manual name, provide text from the selected region
as another default value for the second 'M-n' in the minibuffer.
Also replace spaces with dashes in the name.
This commit is contained in:
Juri Linkov 2025-08-10 21:08:29 +03:00
parent e28ac4eca6
commit 3d7f51d872

View file

@ -1123,7 +1123,14 @@ for the current invocation."
(and (not (equal default-entry ""))
default-entry))
#'Man-completion-table
nil nil nil 'Man-topic-history default-entry)))
nil nil nil 'Man-topic-history
`(,default-entry
,@(when (use-region-p)
(list (string-replace
" " "-"
(buffer-substring-no-properties
(region-beginning)
(region-end)))))))))
(if Man-cache-completion-results-flag
(read)
(let ((Man-completion-cache)) (read))))))