summaryrefslogtreecommitdiff
path: root/lisp/pcmpl-unix.el
diff options
context:
space:
mode:
authorMike Lamb <mrlamb@gmail.com>2012-01-27 13:14:16 -0800
committerGlenn Morris <rgm@gnu.org>2012-01-27 13:14:16 -0800
commit7dd37071d0a82f35507c6062bef0df2917564ab5 (patch)
treeae79330730821aecc8578cf0e6beaf856101f7cc /lisp/pcmpl-unix.el
parent2aa43abb72cd52d01a83924c65a3cd855d5c75ed (diff)
downloademacs-7dd37071d0a82f35507c6062bef0df2917564ab5.tar.gz
pcmpl-ssh-known-hosts tiny change
* lisp/pcmpl-unix.el (pcmpl-ssh-known-hosts): Handle [host]:port syntax. Fixes: debbugs:10533
Diffstat (limited to 'lisp/pcmpl-unix.el')
-rw-r--r--lisp/pcmpl-unix.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/lisp/pcmpl-unix.el b/lisp/pcmpl-unix.el
index 2dc25d93abf..3af22c82dfb 100644
--- a/lisp/pcmpl-unix.el
+++ b/lisp/pcmpl-unix.el
@@ -152,13 +152,15 @@ documentation), this function returns nil."
(file-readable-p pcmpl-ssh-known-hosts-file))
(with-temp-buffer
(insert-file-contents-literally pcmpl-ssh-known-hosts-file)
- (let (ssh-hosts-list)
- (while (re-search-forward "^ *\\([-.[:alnum:]]+\\)[, ]" nil t)
- (add-to-list 'ssh-hosts-list (match-string 1))
+ (let ((host-re "\\(?:\\([-.[:alnum:]]+\\)\\|\\[\\([-.[:alnum:]]+\\)\\]:[0-9]+\\)[, ]")
+ ssh-hosts-list)
+ (while (re-search-forward (concat "^ *" host-re) nil t)
+ (add-to-list 'ssh-hosts-list (concat (match-string 1)
+ (match-string 2)))
(while (and (looking-back ",")
- (re-search-forward "\\([-.[:alnum:]]+\\)[, ]"
- (line-end-position) t))
- (add-to-list 'ssh-hosts-list (match-string 1))))
+ (re-search-forward host-re (line-end-position) t))
+ (add-to-list 'ssh-hosts-list (concat (match-string 1)
+ (match-string 2)))))
ssh-hosts-list))))
(defun pcmpl-ssh-config-hosts ()