diff options
| author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-10-03 12:49:56 -0400 |
|---|---|---|
| committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-10-03 12:49:56 -0400 |
| commit | 915a9b6440634287d48d184bb326a0c845c31863 (patch) | |
| tree | 8e9d8e4b86d60db4548c61fb8cdec7186acf482b /lisp/pcmpl-unix.el | |
| parent | 3dc61a0913bb72f576cfbd18ef31299f8548ab19 (diff) | |
| download | emacs-915a9b6440634287d48d184bb326a0c845c31863.tar.gz | |
* lisp/pcmpl-unix.el (pcomplete/scp): Don't assume pcomplete-all-entries
returns a list. Add remote file name completion.
* lisp/comint.el (comint--table-subvert): Curry and get quote&unquote
functions as arguments.
(comint--complete-file-name-data): Adjust call accordingly.
* lisp/pcomplete.el (pcomplete--table-subvert): Remove.
(pcomplete-completions-at-point): Use comint--table-subvert instead.
Fixes: debbugs:9554
Diffstat (limited to 'lisp/pcmpl-unix.el')
| -rw-r--r-- | lisp/pcmpl-unix.el | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/lisp/pcmpl-unix.el b/lisp/pcmpl-unix.el index e947bfe1da6..b466c2cd899 100644 --- a/lisp/pcmpl-unix.el +++ b/lisp/pcmpl-unix.el @@ -193,10 +193,25 @@ Uses both `pcmpl-ssh-config-file' and `pcmpl-ssh-known-hosts-file'." "Completion rules for the `scp' command. Includes files as well as host names followed by a colon." (pcomplete-opt "1246BCpqrvcFiloPS") - (while t (pcomplete-here (append (pcomplete-all-entries) - (mapcar (lambda (host) - (concat host ":")) - (pcmpl-ssh-hosts)))))) + (while t (pcomplete-here + (lambda (string pred action) + (let ((table + (cond + ((string-match "\\`[^:/]+:" string) ; Remote file name. + (if (and (eq action 'lambda) + (eq (match-end 0) (length string))) + ;; Avoid connecting to the remote host when we're + ;; only completing the host name. + (list string) + (comint--table-subvert (pcomplete-all-entries) + "" "/ssh:"))) + ((string-match "/" string) ; Local file name. + (pcomplete-all-entries)) + (t ;Host name or local file name. + (append (all-completions string (pcomplete-all-entries)) + (mapcar (lambda (host) (concat host ":")) + (pcmpl-ssh-hosts))))))) + (complete-with-action action table string pred)))))) (provide 'pcmpl-unix) |
