diff options
| author | Karl Heuer | 1997-03-12 00:23:49 +0000 |
|---|---|---|
| committer | Karl Heuer | 1997-03-12 00:23:49 +0000 |
| commit | 3b4956e86847edf8db3bdc87413771ca51d48d5c (patch) | |
| tree | e763a37e9f21161bb1bb0b54bf307119cd16a9b6 | |
| parent | 31aa282eeb71c48ebf9ad41e7a2bbb1c36662c3f (diff) | |
| download | emacs-3b4956e86847edf8db3bdc87413771ca51d48d5c.tar.gz emacs-3b4956e86847edf8db3bdc87413771ca51d48d5c.zip | |
(term-completion-addsuffix): Doc fix.
(term-dynamic-complete-as-filename): Support the case where
term-completion-addsuffix is a (DIRSUFFIX . FILESUFFIX) cons
pair.
| -rw-r--r-- | lisp/term.el | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lisp/term.el b/lisp/term.el index 4ddd78dd5e0..f1c4c4c26ef 100644 --- a/lisp/term.el +++ b/lisp/term.el | |||
| @@ -2943,7 +2943,9 @@ This mirrors the optional behavior of tcsh.") | |||
| 2943 | 2943 | ||
| 2944 | (defvar term-completion-addsuffix t | 2944 | (defvar term-completion-addsuffix t |
| 2945 | "*If non-nil, add a `/' to completed directories, ` ' to file names. | 2945 | "*If non-nil, add a `/' to completed directories, ` ' to file names. |
| 2946 | This mirrors the optional behavior of tcsh.") | 2946 | If a cons pair, it should be of the form (DIRSUFFIX . FILESUFFIX) where |
| 2947 | DIRSUFFIX and FILESUFFIX are strings added on unambiguous or exact | ||
| 2948 | completion. This mirrors the optional behavior of tcsh.") | ||
| 2947 | 2949 | ||
| 2948 | (defvar term-completion-recexact nil | 2950 | (defvar term-completion-recexact nil |
| 2949 | "*If non-nil, use shortest completion if characters cannot be added. | 2951 | "*If non-nil, use shortest completion if characters cannot be added. |
| @@ -3031,6 +3033,12 @@ See `term-dynamic-complete-filename'. Returns t if successful." | |||
| 3031 | (let* ((completion-ignore-case nil) | 3033 | (let* ((completion-ignore-case nil) |
| 3032 | (completion-ignored-extensions term-completion-fignore) | 3034 | (completion-ignored-extensions term-completion-fignore) |
| 3033 | (success t) | 3035 | (success t) |
| 3036 | (dirsuffix (cond ((not term-completion-addsuffix) "") | ||
| 3037 | ((not (consp term-completion-addsuffix)) "/") | ||
| 3038 | (t (car term-completion-addsuffix)))) | ||
| 3039 | (filesuffix (cond ((not term-completion-addsuffix) "") | ||
| 3040 | ((not (consp term-completion-addsuffix)) " ") | ||
| 3041 | (t (cdr term-completion-addsuffix)))) | ||
| 3034 | (filename (or (term-match-partial-filename) "")) | 3042 | (filename (or (term-match-partial-filename) "")) |
| 3035 | (pathdir (file-name-directory filename)) | 3043 | (pathdir (file-name-directory filename)) |
| 3036 | (pathnondir (file-name-nondirectory filename)) | 3044 | (pathnondir (file-name-nondirectory filename)) |
| @@ -3051,14 +3059,13 @@ See `term-dynamic-complete-filename'. Returns t if successful." | |||
| 3051 | (length pathnondir))) | 3059 | (length pathnondir))) |
| 3052 | (cond ((symbolp (file-name-completion completion directory)) | 3060 | (cond ((symbolp (file-name-completion completion directory)) |
| 3053 | ;; We inserted a unique completion. | 3061 | ;; We inserted a unique completion. |
| 3054 | (if term-completion-addsuffix | 3062 | (insert (if (file-directory-p file) dirsuffix filesuffix)) |
| 3055 | (insert (if (file-directory-p file) "/" " "))) | ||
| 3056 | (or mini-flag (message "Completed"))) | 3063 | (or mini-flag (message "Completed"))) |
| 3057 | ((and term-completion-recexact term-completion-addsuffix | 3064 | ((and term-completion-recexact term-completion-addsuffix |
| 3058 | (string-equal pathnondir completion) | 3065 | (string-equal pathnondir completion) |
| 3059 | (file-exists-p file)) | 3066 | (file-exists-p file)) |
| 3060 | ;; It's not unique, but user wants shortest match. | 3067 | ;; It's not unique, but user wants shortest match. |
| 3061 | (insert (if (file-directory-p file) "/" " ")) | 3068 | (insert (if (file-directory-p file) dirsuffix filesuffix)) |
| 3062 | (or mini-flag (message "Completed shortest"))) | 3069 | (or mini-flag (message "Completed shortest"))) |
| 3063 | ((or term-completion-autolist | 3070 | ((or term-completion-autolist |
| 3064 | (string-equal pathnondir completion)) | 3071 | (string-equal pathnondir completion)) |