changeset 17147:2824e1f84717

(term-completion-addsuffix): Doc fix. (term-dynamic-complete-as-filename): Support the case where term-completion-addsuffix is a (DIRSUFFIX . FILESUFFIX) cons pair.
author Karl Heuer <kwzh@gnu.org>
date Wed, 12 Mar 1997 00:23:49 +0000
parents b8536e42d4ef
children 10107950ac5e
files lisp/term.el
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/term.el	Tue Mar 11 23:55:24 1997 +0000
+++ b/lisp/term.el	Wed Mar 12 00:23:49 1997 +0000
@@ -2943,7 +2943,9 @@
 
 (defvar term-completion-addsuffix t
   "*If non-nil, add a `/' to completed directories, ` ' to file names.
-This mirrors the optional behavior of tcsh.")
+If a cons pair, it should be of the form (DIRSUFFIX . FILESUFFIX) where
+DIRSUFFIX and FILESUFFIX are strings added on unambiguous or exact
+completion.  This mirrors the optional behavior of tcsh.")
 
 (defvar term-completion-recexact nil
   "*If non-nil, use shortest completion if characters cannot be added.
@@ -3031,6 +3033,12 @@
   (let* ((completion-ignore-case nil)
 	 (completion-ignored-extensions term-completion-fignore)
 	 (success t)
+	 (dirsuffix (cond ((not term-completion-addsuffix) "")
+			  ((not (consp term-completion-addsuffix)) "/")
+			  (t (car term-completion-addsuffix))))
+	 (filesuffix (cond ((not term-completion-addsuffix) "")
+			   ((not (consp term-completion-addsuffix)) " ")
+			   (t (cdr term-completion-addsuffix))))	 
 	 (filename (or (term-match-partial-filename) ""))
 	 (pathdir (file-name-directory filename))
 	 (pathnondir (file-name-nondirectory filename))
@@ -3051,14 +3059,13 @@
                                 (length pathnondir)))
              (cond ((symbolp (file-name-completion completion directory))
                     ;; We inserted a unique completion.
-                    (if term-completion-addsuffix
-                        (insert (if (file-directory-p file) "/" " ")))
+		    (insert (if (file-directory-p file) dirsuffix filesuffix))
                     (or mini-flag (message "Completed")))
                    ((and term-completion-recexact term-completion-addsuffix
                          (string-equal pathnondir completion)
                          (file-exists-p file))
                     ;; It's not unique, but user wants shortest match.
-                    (insert (if (file-directory-p file) "/" " "))
+		    (insert (if (file-directory-p file) dirsuffix filesuffix))
                     (or mini-flag (message "Completed shortest")))
                    ((or term-completion-autolist
                         (string-equal pathnondir completion))