changeset 67472:dc66229d83bf

(lisp-complete-symbol): Regenerate the completion list, even after a partial completion has been inserted in the current buffer. If there are more than 1 completion, redisplay the *Completions* buffer; if the completion is unique, delete the *Completions* window.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 10 Dec 2005 11:39:24 +0000
parents 8e00ea681e4d
children b3b489c17f2e
files lisp/emacs-lisp/lisp.el
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/lisp.el	Sat Dec 10 11:32:44 2005 +0000
+++ b/lisp/emacs-lisp/lisp.el	Sat Dec 10 11:39:24 2005 +0000
@@ -569,10 +569,11 @@
 	      ((null completion)
 	       (message "Can't find completion for \"%s\"" pattern)
 	       (ding))
-	      ((not (string= pattern completion))
-	       (delete-region beg end)
-	       (insert completion))
 	      (t
+	       (unless (string= completion pattern)
+		 (delete-region beg end)
+		 (insert completion)
+		 (setq pattern completion))
 	       (message "Making completion list...")
 	       (let ((list (all-completions pattern obarray predicate)))
 		 (setq list (sort list 'string<))
@@ -585,8 +586,10 @@
 					 new))
 			 (setq list (cdr list)))
 		       (setq list (nreverse new))))
-		 (with-output-to-temp-buffer "*Completions*"
-		   (display-completion-list list pattern)))
+		 (if (> (length list) 1)
+		     (with-output-to-temp-buffer "*Completions*"
+		       (display-completion-list list pattern))
+		   (delete-windows-on "*Completions*")))
 	       (message "Making completion list...%s" "done")))))))
 
 ;;; arch-tag: aa7fa8a4-2e6f-4e9b-9cd9-fef06340e67e