changeset 87372:fb00bf8f41d7

(Man-follow-manual-reference): Fill the minibuffer's default list with a full list of references.
author Juri Linkov <juri@jurta.org>
date Sun, 23 Dec 2007 17:35:52 +0000
parents 32e5aafa903c
children 65667ab9216b
files lisp/man.el
diffstat 1 files changed, 26 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/man.el	Sun Dec 23 16:07:54 2007 +0000
+++ b/lisp/man.el	Sun Dec 23 17:35:52 2007 +0000
@@ -1380,25 +1380,32 @@
   (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)