Commit 78b19c2c authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(PC-do-completion): Set completion-base-size.

parent 02680e9b
...@@ -263,6 +263,7 @@ See `PC-complete' for details." ...@@ -263,6 +263,7 @@ See `PC-complete' for details."
(filename (memq table '(read-file-name-internal (filename (memq table '(read-file-name-internal
read-directory-name-internal))) read-directory-name-internal)))
(dirname nil) (dirname nil)
dirlength
(str (buffer-substring beg end)) (str (buffer-substring beg end))
(incname (and filename (string-match "<\\([^\"<>]*\\)>?$" str))) (incname (and filename (string-match "<\\([^\"<>]*\\)>?$" str)))
(ambig nil) (ambig nil)
...@@ -278,6 +279,13 @@ See `PC-complete' for details." ...@@ -278,6 +279,13 @@ See `PC-complete' for details."
(PC-is-complete-p str table pred)) (PC-is-complete-p str table pred))
'complete '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 ;; Do substitutions in directory names
(and filename (and filename
(not (equal str (setq p (substitute-in-file-name str)))) (not (equal str (setq p (substitute-in-file-name str))))
...@@ -524,7 +532,13 @@ See `PC-complete' for details." ...@@ -524,7 +532,13 @@ See `PC-complete' for details."
(if (or completion-auto-help (if (or completion-auto-help
(eq mode 'help)) (eq mode 'help))
(with-output-to-temp-buffer "*Completions*" (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)")) (PC-temp-minibuffer-message " (Next char not unique)"))
nil))))) nil)))))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment