summaryrefslogtreecommitdiff
path: root/lisp/pcmpl-unix.el
diff options
context:
space:
mode:
authorStefan Kangas <stefankangas@gmail.com>2020-09-02 02:45:39 +0200
committerStefan Kangas <stefan@marxist.se>2020-09-21 20:38:56 +0200
commitfb68645b5a258c98acc11efdc3caae80683cc6b0 (patch)
treed301a59e36103264a11aa28f846ee88f7001b22e /lisp/pcmpl-unix.el
parent600d3f0669742b398d91c421e335fc6680f6fdc0 (diff)
downloademacs-fb68645b5a258c98acc11efdc3caae80683cc6b0.tar.gz
Move several completions from eshell to pcomplete (Bug#10585)
* lisp/eshell/em-unix.el (eshell-complete-hostname) (pcomplete/ftp, pcomplete/ncftp, pcomplete/ping) (pcomplete/rlogin, pcomplete/telnet, pcomplete/rsh): Move from here... * lisp/pcmpl-unix.el (pcmpl-unix-complete-hostname) (pcomplete/ftp, pcomplete/ncftp, pcomplete/ping) (pcomplete/rlogin, pcomplete/telnet, pcomplete/rsh): ...to here. Make old names into aliases. * lisp/eshell/esh-util.el (eshell-hosts-file) (eshell-host-names, eshell-host-timestamp) (eshell-read-hosts-file, eshell-read-hosts) (eshell-read-host-names): Move from here... * lisp/pcomplete.el (pcomplete-hosts-file) (pcomplete--host-name-cache) (pcomplete--host-name-cache-timestamp) (pcomplete-read-hosts-file, pcomplete-read-hosts) (pcomplete-read-host-names): ...to here. Make old names into aliases. * lisp/eshell/em-unix.el (eshell-complete-host-reference): Update caller.
Diffstat (limited to 'lisp/pcmpl-unix.el')
-rw-r--r--lisp/pcmpl-unix.el23
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/pcmpl-unix.el b/lisp/pcmpl-unix.el
index 822f6f37e78..74f45b95233 100644
--- a/lisp/pcmpl-unix.el
+++ b/lisp/pcmpl-unix.el
@@ -217,6 +217,29 @@ Includes files as well as host names followed by a colon."
(pcmpl-ssh-hosts)))))))
(complete-with-action action table string pred))))))
+(defsubst pcmpl-unix-complete-hostname ()
+ "Complete a command that wants a hostname for an argument."
+ (pcomplete-here (pcomplete-read-host-names)))
+
+(defalias 'pcomplete/ftp 'pcmpl-unix-complete-hostname)
+(defalias 'pcomplete/ncftp 'pcmpl-unix-complete-hostname)
+(defalias 'pcomplete/ping 'pcmpl-unix-complete-hostname)
+(defalias 'pcomplete/rlogin 'pcmpl-unix-complete-hostname)
+
+;;;###autoload
+(defun pcomplete/telnet ()
+ (pcomplete-opt "xl(pcmpl-unix-user-names)")
+ (pcmpl-unix-complete-hostname))
+
+;;;###autoload
+(defun pcomplete/rsh ()
+ "Complete `rsh', which, after the user and hostname, is like xargs."
+ (pcomplete-opt "l(pcmpl-unix-user-names)")
+ (pcmpl-unix-complete-hostname)
+ (pcomplete-here (funcall pcomplete-command-completion-function))
+ (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
+ pcomplete-default-completion-function)))
+
(provide 'pcmpl-unix)
;;; pcmpl-unix.el ends here