summaryrefslogtreecommitdiff
path: root/lisp/complete.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-08-07 18:10:48 +0000
committerRichard M. Stallman <rms@gnu.org>1994-08-07 18:10:48 +0000
commit9557bdbba6ef68170a3f007491fa0167dd281526 (patch)
tree3c0644e368b45c9d103e6a744971c54a49f8bf5f /lisp/complete.el
parent9509bc27b7b69b146a1ea23de902f53e51a6bbd3 (diff)
downloademacs-9557bdbba6ef68170a3f007491fa0167dd281526.tar.gz
(PC-do-completion): Set completion-base-size.
Diffstat (limited to 'lisp/complete.el')
-rw-r--r--lisp/complete.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/complete.el b/lisp/complete.el
index daeac1f3bfd..fea94618632 100644
--- a/lisp/complete.el
+++ b/lisp/complete.el
@@ -263,6 +263,7 @@ See `PC-complete' for details."
(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 @@ See `PC-complete' for details."
(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 @@ See `PC-complete' for details."
(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)))))