From debe92052c1c5451982e618e6c7057420a5a7f67 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Sun, 23 Dec 2007 17:35:52 +0000 Subject: [PATCH] (Man-follow-manual-reference): Fill the minibuffer's default list with a full list of references. --- lisp/man.el | 45 ++++++++++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 19 deletions(-) diff --git a/lisp/man.el b/lisp/man.el index ebf1ebc69bc..48639cd764b 100644 --- a/lisp/man.el +++ b/lisp/man.el @@ -1380,25 +1380,32 @@ Specify which REFERENCE to use; default is based on word at point." (interactive (if (not Man-refpages-alist) (error "There are no references in the current man page") - (list (let* ((default (or - (car (all-completions - (let ((word - (or (Man-possibly-hyphenated-word) - ""))) - ;; strip a trailing '-': - (if (string-match "-$" word) - (substring word 0 - (match-beginning 0)) - word)) - Man-refpages-alist)) - (aheadsym Man-refpages-alist))) - chosen - (prompt (concat "Refer to (default " default "): "))) - (setq chosen (completing-read prompt Man-refpages-alist)) - (if (or (not chosen) - (string= chosen "")) - default - chosen))))) + (list + (let* ((default (or + (car (all-completions + (let ((word + (or (Man-possibly-hyphenated-word) + ""))) + ;; strip a trailing '-': + (if (string-match "-$" word) + (substring word 0 + (match-beginning 0)) + word)) + Man-refpages-alist)) + (aheadsym Man-refpages-alist))) + (defaults + (mapcar 'substring-no-properties + (delete-dups + (delq nil (cons default + (mapcar 'car Man-refpages-alist)))))) + chosen + (prompt (concat "Refer to (default " default "): "))) + (setq chosen (completing-read prompt Man-refpages-alist + nil nil nil nil defaults)) + (if (or (not chosen) + (string= chosen "")) + default + chosen))))) (if (not Man-refpages-alist) (error "Can't find any references in the current manpage") (aput 'Man-refpages-alist reference) -- 2.39.2