changeset 8478:9d3d84a3c3fa

(PC-do-completion): Set completion-base-size.
author Richard M. Stallman <rms@gnu.org>
date Sun, 07 Aug 1994 18:10:48 +0000
parents f4aa7a288cb6
children 582ac9a744c4
files lisp/complete.el
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/complete.el	Sun Aug 07 18:09:18 1994 +0000
+++ b/lisp/complete.el	Sun Aug 07 18:10:48 1994 +0000
@@ -263,6 +263,7 @@
 	 (filename (memq table '(read-file-name-internal
 				 read-directory-name-internal)))
 	 (dirname nil)
+	 dirlength
 	 (str (buffer-substring beg end))
 	 (incname (and filename (string-match "<\\([^\"<>]*\\)>?$" str)))
 	 (ambig nil)
@@ -278,6 +279,13 @@
 	     (PC-is-complete-p str table pred))
 	'complete
 
+      ;; Record how many characters at the beginning are not included
+      ;; in completion.
+      (setq dirlength
+	    (if filename
+		(length (file-name-directory str))
+	      0))
+
       ;; Do substitutions in directory names
       (and filename
 	   (not (equal str (setq p (substitute-in-file-name str))))
@@ -524,7 +532,13 @@
 		(if (or completion-auto-help
 			(eq mode 'help))
 		    (with-output-to-temp-buffer "*Completions*"
-		      (display-completion-list (sort helpposs 'string-lessp)))
+		      (display-completion-list (sort helpposs 'string-lessp))
+		      (save-excursion
+			(set-buffer standard-output)
+			;; Record which part of the buffer we are completing
+			;; so that choosing a completion from the list
+			;; knows how much old text to replace.
+			(setq completion-base-size dirlength)))
 		  (PC-temp-minibuffer-message " (Next char not unique)"))
 		nil)))))