X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/42dbaa0c43d5a6a1d03cdd046de448cf8a671015..dcefd2bbc0e404c26f1e5b68c910404355f488fb:/lisp/pcmpl-unix.el diff --git a/lisp/pcmpl-unix.el b/lisp/pcmpl-unix.el index a34458506e..d4939d8d17 100644 --- a/lisp/pcmpl-unix.el +++ b/lisp/pcmpl-unix.el @@ -1,6 +1,6 @@ ;;; pcmpl-unix.el --- standard UNIX completions -;; Copyright (C) 1999-2011 Free Software Foundation, Inc. +;; Copyright (C) 1999-2016 Free Software Foundation, Inc. ;; Package: pcomplete @@ -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)) - (while (and (looking-back ",") - (re-search-forward "\\([-.[:alnum:]]+\\)[, ]" - (line-end-position) 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 (eq (char-before) ?,) + (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 () @@ -203,8 +205,8 @@ Includes files as well as host names followed by a colon." ;; Avoid connecting to the remote host when we're ;; only completing the host name. (list string) - (comint--table-subvert (pcomplete-all-entries) - "" "/ssh:"))) + (completion-table-subvert (pcomplete-all-entries) + "" "/ssh:"))) ((string-match "/" string) ; Local file name. (pcomplete-all-entries)) (t ;Host name or local file name.