2020-09-02 14:37:13 +00:00
|
|
|
;;; pcmpl-unix.el --- standard UNIX completions -*- lexical-binding:t -*-
|
2000-06-27 10:55:46 +00:00
|
|
|
|
2022-01-01 07:45:51 +00:00
|
|
|
;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
|
2000-06-27 10:55:46 +00:00
|
|
|
|
2010-08-29 16:17:13 +00:00
|
|
|
;; Package: pcomplete
|
|
|
|
|
2000-06-27 10:55:46 +00:00
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2000-06-27 10:55:46 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2000-06-27 10:55:46 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2000-06-27 10:55:46 +00:00
|
|
|
|
2001-07-15 19:53:53 +00:00
|
|
|
;;; Commentary:
|
|
|
|
|
2000-06-27 10:55:46 +00:00
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(require 'pcomplete)
|
|
|
|
|
2022-09-08 09:09:42 +00:00
|
|
|
;;; User Variables
|
2000-06-27 10:55:46 +00:00
|
|
|
|
|
|
|
(defcustom pcmpl-unix-group-file "/etc/group"
|
2008-02-08 05:14:03 +00:00
|
|
|
"If non-nil, a string naming the group file on your system."
|
|
|
|
:type '(choice file (const nil))
|
2000-06-27 10:55:46 +00:00
|
|
|
:group 'pcmpl-unix)
|
|
|
|
|
|
|
|
(defcustom pcmpl-unix-passwd-file "/etc/passwd"
|
2008-02-08 05:14:03 +00:00
|
|
|
"If non-nil, a string naming the passwd file on your system."
|
|
|
|
:type '(choice file (const nil))
|
2000-06-27 10:55:46 +00:00
|
|
|
:group 'pcmpl-unix)
|
|
|
|
|
2008-02-08 05:07:50 +00:00
|
|
|
(defcustom pcmpl-ssh-known-hosts-file "~/.ssh/known_hosts"
|
2008-02-08 05:14:03 +00:00
|
|
|
"If non-nil, a string naming your SSH \"known_hosts\" file.
|
2011-01-22 02:20:57 +00:00
|
|
|
This allows one method of completion of SSH host names, the other
|
|
|
|
being via `pcmpl-ssh-config-file'. Note that newer versions of
|
|
|
|
ssh hash the hosts by default, to prevent Island-hopping SSH
|
|
|
|
attacks. This can be disabled, at some risk, with the SSH option
|
|
|
|
\"HashKnownHosts no\"."
|
2008-02-08 05:14:03 +00:00
|
|
|
:type '(choice file (const nil))
|
|
|
|
:group 'pcmpl-unix
|
|
|
|
:version "23.1")
|
2008-02-08 05:07:50 +00:00
|
|
|
|
2011-01-22 02:20:57 +00:00
|
|
|
(defcustom pcmpl-ssh-config-file "~/.ssh/config"
|
|
|
|
"If non-nil, a string naming your SSH \"config\" file.
|
|
|
|
This allows one method of completion of SSH host names, the other
|
|
|
|
being via `pcmpl-ssh-known-hosts-file'."
|
|
|
|
:type '(choice file (const nil))
|
|
|
|
:group 'pcmpl-unix
|
|
|
|
:version "24.1")
|
|
|
|
|
2022-09-08 09:09:42 +00:00
|
|
|
;;; Shell builtins and core utilities
|
2000-06-27 10:55:46 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/cd ()
|
|
|
|
"Completion for `cd'."
|
2009-12-01 19:42:28 +00:00
|
|
|
(while (pcomplete-here (pcomplete-dirs))))
|
2000-06-27 10:55:46 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defalias 'pcomplete/pushd 'pcomplete/cd)
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/rmdir ()
|
|
|
|
"Completion for `rmdir'."
|
2022-09-08 09:09:42 +00:00
|
|
|
(while (if (string-prefix-p "-" (pcomplete-arg))
|
|
|
|
(pcomplete-here (pcomplete-from-help "rmdir --help"))
|
|
|
|
(pcomplete-here (pcomplete-dirs)))))
|
2000-06-27 10:55:46 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/rm ()
|
2022-09-08 09:09:42 +00:00
|
|
|
"Completion for the `rm' command."
|
|
|
|
(pcomplete-here-using-help "rm --help"))
|
2000-06-27 10:55:46 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/xargs ()
|
|
|
|
"Completion for `xargs'."
|
2021-07-17 14:29:11 +00:00
|
|
|
(while (string-prefix-p "-" (pcomplete-arg 0))
|
2022-09-08 09:09:42 +00:00
|
|
|
(pcomplete-here (pcomplete-from-help "xargs --help"))
|
|
|
|
(when (pcomplete-match "\\`-[adEIiLnPs]\\'") (pcomplete-here)))
|
2020-09-28 02:07:14 +00:00
|
|
|
(funcall pcomplete-command-completion-function)
|
2000-06-27 10:55:46 +00:00
|
|
|
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
|
|
|
|
pcomplete-default-completion-function)))
|
|
|
|
|
|
|
|
;;;###autoload
|
2022-09-08 09:09:42 +00:00
|
|
|
(defun pcomplete/time ()
|
|
|
|
"Completion for the `time' command."
|
|
|
|
(pcomplete-opt "p")
|
|
|
|
(funcall pcomplete-command-completion-function)
|
|
|
|
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
|
|
|
|
pcomplete-default-completion-function)))
|
2000-06-27 10:55:46 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/which ()
|
|
|
|
"Completion for `which'."
|
2022-09-08 09:09:42 +00:00
|
|
|
(while (string-prefix-p "-" (pcomplete-arg 0))
|
|
|
|
(pcomplete-here (pcomplete-from-help "which --help")))
|
2000-06-27 10:55:46 +00:00
|
|
|
(while (pcomplete-here (funcall pcomplete-command-completion-function))))
|
|
|
|
|
|
|
|
(defun pcmpl-unix-read-passwd-file (file)
|
2010-01-16 20:50:23 +00:00
|
|
|
"Return an alist correlating gids to group names in FILE.
|
|
|
|
|
|
|
|
If FILE is in hashed format (as described in the OpenSSH
|
|
|
|
documentation), this function returns nil."
|
2000-06-27 10:55:46 +00:00
|
|
|
(let (names)
|
|
|
|
(when (file-readable-p file)
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert-file-contents file)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (not (eobp))
|
|
|
|
(let* ((fields
|
|
|
|
(split-string (buffer-substring
|
|
|
|
(point) (progn (end-of-line)
|
|
|
|
(point))) ":")))
|
|
|
|
(setq names (cons (nth 0 fields) names)))
|
|
|
|
(forward-line))))
|
2018-03-05 01:53:07 +00:00
|
|
|
(pcomplete-uniquify-list names)))
|
2000-06-27 10:55:46 +00:00
|
|
|
|
|
|
|
(defsubst pcmpl-unix-group-names ()
|
|
|
|
"Read the contents of /etc/group for group names."
|
|
|
|
(if pcmpl-unix-group-file
|
|
|
|
(pcmpl-unix-read-passwd-file pcmpl-unix-group-file)))
|
|
|
|
|
|
|
|
(defsubst pcmpl-unix-user-names ()
|
|
|
|
"Read the contents of /etc/passwd for user names."
|
|
|
|
(if pcmpl-unix-passwd-file
|
|
|
|
(pcmpl-unix-read-passwd-file pcmpl-unix-passwd-file)))
|
|
|
|
|
2022-09-08 09:09:42 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/cat ()
|
|
|
|
"Completion for the `cat' command."
|
|
|
|
(pcomplete-here-using-help "cat --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/tac ()
|
|
|
|
"Completion for the `tac' command."
|
|
|
|
(pcomplete-here-using-help "tac --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/nl ()
|
|
|
|
"Completion for the `nl' command."
|
|
|
|
(pcomplete-here-using-help "nl --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/od ()
|
|
|
|
"Completion for the `od' command."
|
|
|
|
(pcomplete-here-using-help "od --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/base32 ()
|
|
|
|
"Completion for the `base32' and `base64' commands."
|
|
|
|
(pcomplete-here-using-help "base32 --help"))
|
|
|
|
;;;###autoload
|
|
|
|
(defalias 'pcomplete/base64 'pcomplete/base32)
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/basenc ()
|
|
|
|
"Completion for the `basenc' command."
|
|
|
|
(pcomplete-here-using-help "basenc --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/fmt ()
|
|
|
|
"Completion for the `fmt' command."
|
|
|
|
(pcomplete-here-using-help "fmt --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/pr ()
|
|
|
|
"Completion for the `pr' command."
|
|
|
|
(pcomplete-here-using-help "pr --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/fold ()
|
|
|
|
"Completion for the `fold' command."
|
|
|
|
(pcomplete-here-using-help "fold --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/head ()
|
|
|
|
"Completion for the `head' command."
|
|
|
|
(pcomplete-here-using-help "head --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/tail ()
|
|
|
|
"Completion for the `tail' command."
|
|
|
|
(pcomplete-here-using-help "tail --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/split ()
|
|
|
|
"Completion for the `split' command."
|
|
|
|
(pcomplete-here-using-help "split --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/csplit ()
|
|
|
|
"Completion for the `csplit' command."
|
|
|
|
(pcomplete-here-using-help "csplit --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/wc ()
|
|
|
|
"Completion for the `wc' command."
|
|
|
|
(pcomplete-here-using-help "wc --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/sum ()
|
|
|
|
"Completion for the `sum' command."
|
|
|
|
(pcomplete-here-using-help "sum --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/cksum ()
|
|
|
|
"Completion for the `cksum' command."
|
|
|
|
(pcomplete-here-using-help "cksum --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/b2sum ()
|
|
|
|
"Completion for the `b2sum' command."
|
|
|
|
(pcomplete-here-using-help "b2sum --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/md5sum ()
|
|
|
|
"Completion for checksum commands."
|
|
|
|
(pcomplete-here-using-help "md5sum --help"))
|
|
|
|
;;;###autoload(defalias 'pcomplete/sha1sum 'pcomplete/md5sum)
|
|
|
|
;;;###autoload(defalias 'pcomplete/sha224sum 'pcomplete/md5sum)
|
|
|
|
;;;###autoload(defalias 'pcomplete/sha256sum 'pcomplete/md5sum)
|
|
|
|
;;;###autoload(defalias 'pcomplete/sha384sum 'pcomplete/md5sum)
|
|
|
|
;;;###autoload(defalias 'pcomplete/sha521sum 'pcomplete/md5sum)
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/sort ()
|
|
|
|
"Completion for the `sort' command."
|
|
|
|
(pcomplete-here-using-help "sort --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/shuf ()
|
|
|
|
"Completion for the `shuf' command."
|
|
|
|
(pcomplete-here-using-help "shuf --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/uniq ()
|
|
|
|
"Completion for the `uniq' command."
|
|
|
|
(pcomplete-here-using-help "uniq --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/comm ()
|
|
|
|
"Completion for the `comm' command."
|
|
|
|
(pcomplete-here-using-help "comm --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/ptx ()
|
|
|
|
"Completion for the `ptx' command."
|
|
|
|
(pcomplete-here-using-help "ptx --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/tsort ()
|
|
|
|
"Completion for the `tsort' command."
|
|
|
|
(pcomplete-here-using-help "tsort --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/cut ()
|
|
|
|
"Completion for the `cut' command."
|
|
|
|
(pcomplete-here-using-help "cut --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/paste ()
|
|
|
|
"Completion for the `paste' command."
|
|
|
|
(pcomplete-here-using-help "paste --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/join ()
|
|
|
|
"Completion for the `join' command."
|
|
|
|
(pcomplete-here-using-help "join --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/tr ()
|
|
|
|
"Completion for the `tr' command."
|
|
|
|
(pcomplete-here-using-help "tr --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/expand ()
|
|
|
|
"Completion for the `expand' command."
|
|
|
|
(pcomplete-here-using-help "expand --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/unexpand ()
|
|
|
|
"Completion for the `unexpand' command."
|
|
|
|
(pcomplete-here-using-help "unexpand --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/ls ()
|
|
|
|
"Completion for the `ls' command."
|
|
|
|
(pcomplete-here-using-help "ls --help"))
|
|
|
|
;;;###autoload(defalias 'pcomplete/dir 'pcomplete/ls)
|
|
|
|
;;;###autoload(defalias 'pcomplete/vdir 'pcomplete/ls)
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/cp ()
|
|
|
|
"Completion for the `cp' command."
|
|
|
|
(pcomplete-here-using-help "cp --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/dd ()
|
|
|
|
"Completion for the `dd' command."
|
|
|
|
(let ((operands (pcomplete-from-help "dd --help"
|
|
|
|
:argument "[a-z]+="
|
|
|
|
:narrow-start "\n\n"
|
|
|
|
:narrow-end "\n\n")))
|
|
|
|
(while
|
|
|
|
(cond ((pcomplete-match "\\`[io]f=\\(.*\\)" 0)
|
|
|
|
(pcomplete-here (pcomplete-entries)
|
|
|
|
(pcomplete-match-string 1 0)))
|
|
|
|
(t (pcomplete-here operands))))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/install ()
|
|
|
|
"Completion for the `install' command."
|
|
|
|
(pcomplete-here-using-help "install --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/mv ()
|
|
|
|
"Completion for the `mv' command."
|
|
|
|
(pcomplete-here-using-help "mv --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/shred ()
|
|
|
|
"Completion for the `shred' command."
|
|
|
|
(pcomplete-here-using-help "shred --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/ln ()
|
|
|
|
"Completion for the `ln' command."
|
|
|
|
(pcomplete-here-using-help "ln --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/mkdir ()
|
|
|
|
"Completion for the `mkdir' command."
|
|
|
|
(pcomplete-here-using-help "mkdir --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/mkfifo ()
|
|
|
|
"Completion for the `mkfifo' command."
|
|
|
|
(pcomplete-here-using-help "mkfifo --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/mknod ()
|
|
|
|
"Completion for the `mknod' command."
|
|
|
|
(pcomplete-here-using-help "mknod --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/readlink ()
|
|
|
|
"Completion for the `readlink' command."
|
|
|
|
(pcomplete-here-using-help "readlink --help"))
|
|
|
|
|
2000-06-27 10:55:46 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/chown ()
|
|
|
|
"Completion for the `chown' command."
|
2022-09-08 09:09:42 +00:00
|
|
|
(while (pcomplete-match "\\`-" 0)
|
|
|
|
(pcomplete-here (pcomplete-from-help "chown --help")))
|
|
|
|
(if (pcomplete-match "\\`[^.]*\\'" 0)
|
|
|
|
(pcomplete-here* (pcmpl-unix-user-names))
|
|
|
|
(if (pcomplete-match "\\.\\([^.]*\\)\\'" 0)
|
|
|
|
(pcomplete-here* (pcmpl-unix-group-names)
|
|
|
|
(pcomplete-match-string 1 0))
|
|
|
|
(pcomplete-here*)))
|
2000-06-27 10:55:46 +00:00
|
|
|
(while (pcomplete-here (pcomplete-entries))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/chgrp ()
|
|
|
|
"Completion for the `chgrp' command."
|
2022-09-08 09:09:42 +00:00
|
|
|
(while (pcomplete-match "\\`-" 0)
|
|
|
|
(pcomplete-here (pcomplete-from-help "chgrp --help")))
|
|
|
|
(pcomplete-here* (pcmpl-unix-group-names))
|
2000-06-27 10:55:46 +00:00
|
|
|
(while (pcomplete-here (pcomplete-entries))))
|
|
|
|
|
2022-09-08 09:09:42 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/chmod ()
|
|
|
|
"Completion for the `chmod' command."
|
|
|
|
(pcomplete-here-using-help "chmod --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/touch ()
|
|
|
|
"Completion for the `touch' command."
|
|
|
|
(pcomplete-here-using-help "touch --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/df ()
|
|
|
|
"Completion for the `df' command."
|
|
|
|
(pcomplete-here-using-help "df --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/du ()
|
|
|
|
"Completion for the `du' command."
|
|
|
|
(pcomplete-here-using-help "du --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/stat ()
|
|
|
|
"Completion for the `stat' command."
|
|
|
|
(pcomplete-here-using-help "stat --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/sync ()
|
|
|
|
"Completion for the `sync' command."
|
|
|
|
(pcomplete-here-using-help "sync --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/truncate ()
|
|
|
|
"Completion for the `truncate' command."
|
|
|
|
(pcomplete-here-using-help "truncate --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/echo ()
|
|
|
|
"Completion for the `echo' command."
|
|
|
|
(pcomplete-here-using-help '("echo" "--help")))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/test ()
|
|
|
|
"Completion for the `test' command."
|
|
|
|
(pcomplete-here-using-help '("[" "--help")
|
|
|
|
:margin "^ +\\([A-Z]+1 \\)?"))
|
|
|
|
;;;###autoload(defalias (intern "pcomplete/[") 'pcomplete/test)
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/tee ()
|
|
|
|
"Completion for the `tee' command."
|
|
|
|
(pcomplete-here-using-help "tee --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/basename ()
|
|
|
|
"Completion for the `basename' command."
|
|
|
|
(pcomplete-here-using-help "basename --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/dirname ()
|
|
|
|
"Completion for the `dirname' command."
|
|
|
|
(pcomplete-here-using-help "dirname --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/pathchk ()
|
|
|
|
"Completion for the `pathchk' command."
|
|
|
|
(pcomplete-here-using-help "pathchk --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/mktemp ()
|
|
|
|
"Completion for the `mktemp' command."
|
|
|
|
(pcomplete-here-using-help "mktemp --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/realpath ()
|
|
|
|
"Completion for the `realpath' command."
|
|
|
|
(pcomplete-here-using-help "realpath --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/id ()
|
|
|
|
"Completion for the `id' command."
|
|
|
|
(while (string-prefix-p "-" (pcomplete-arg 0))
|
|
|
|
(pcomplete-here (pcomplete-from-help "id --help")))
|
|
|
|
(while (pcomplete-here (pcmpl-unix-user-names))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/groups ()
|
|
|
|
"Completion for the `groups' command."
|
|
|
|
(while (pcomplete-here (pcmpl-unix-user-names))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/who ()
|
|
|
|
"Completion for the `who' command."
|
|
|
|
(pcomplete-here-using-help "who --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/date ()
|
|
|
|
"Completion for the `date' command."
|
|
|
|
(pcomplete-here-using-help "date --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/nproc ()
|
|
|
|
"Completion for the `nproc' command."
|
|
|
|
(pcomplete-here-using-help "nproc --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/uname ()
|
|
|
|
"Completion for the `uname' command."
|
|
|
|
(pcomplete-here-using-help "uname --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/hostname ()
|
|
|
|
"Completion for the `hostname' command."
|
|
|
|
(pcomplete-here-using-help "hostname --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/uptime ()
|
|
|
|
"Completion for the `uptime' command."
|
|
|
|
(pcomplete-here-using-help "uptime --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/chcon ()
|
|
|
|
"Completion for the `chcon' command."
|
|
|
|
(pcomplete-here-using-help "chcon --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/runcon ()
|
|
|
|
"Completion for the `runcon' command."
|
|
|
|
(while (string-prefix-p "-" (pcomplete-arg 0))
|
|
|
|
(pcomplete-here (pcomplete-from-help "runcon --help"))
|
|
|
|
(when (pcomplete-match "\\`-[turl]\\'" 0) (pcomplete-here)))
|
|
|
|
(funcall pcomplete-command-completion-function)
|
|
|
|
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
|
|
|
|
pcomplete-default-completion-function)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/chroot ()
|
|
|
|
"Completion for the `chroot' command."
|
|
|
|
(while (string-prefix-p "-" (pcomplete-arg 0))
|
|
|
|
(pcomplete-here (pcomplete-from-help "chroot --help")))
|
|
|
|
(pcomplete-here (pcomplete-dirs))
|
|
|
|
(funcall pcomplete-command-completion-function)
|
|
|
|
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
|
|
|
|
pcomplete-default-completion-function)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/env ()
|
|
|
|
"Completion for the `env' command."
|
|
|
|
(while (string-prefix-p "-" (pcomplete-arg 0))
|
|
|
|
(pcomplete-here (pcomplete-from-help "env --help"))
|
|
|
|
(when (pcomplete-match "\\`-[uCS]\\'") (pcomplete-here)))
|
|
|
|
(while (pcomplete-match "=" 0) (pcomplete-here)) ; FIXME: Complete env vars
|
|
|
|
(funcall pcomplete-command-completion-function)
|
|
|
|
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
|
|
|
|
pcomplete-default-completion-function)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/nice ()
|
|
|
|
"Completion for the `nice' command."
|
|
|
|
(while (string-prefix-p "-" (pcomplete-arg 0))
|
|
|
|
(pcomplete-here (pcomplete-from-help "nice --help"))
|
|
|
|
(pcomplete-here))
|
|
|
|
(funcall pcomplete-command-completion-function)
|
|
|
|
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
|
|
|
|
pcomplete-default-completion-function)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/nohup ()
|
|
|
|
"Completion for the `nohup' command."
|
|
|
|
(while (string-prefix-p "-" (pcomplete-arg 0))
|
|
|
|
(pcomplete-here (pcomplete-from-help "nohup --help")))
|
|
|
|
(funcall pcomplete-command-completion-function)
|
|
|
|
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
|
|
|
|
pcomplete-default-completion-function)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/stdbuf ()
|
|
|
|
"Completion for the `stdbuf' command."
|
|
|
|
(while (string-prefix-p "-" (pcomplete-arg 0))
|
|
|
|
(pcomplete-here (pcomplete-from-help "stdbuf --help"))
|
|
|
|
(when (pcomplete-match "\\`-[ioe]\\'") (pcomplete-here)))
|
|
|
|
(funcall pcomplete-command-completion-function)
|
|
|
|
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
|
|
|
|
pcomplete-default-completion-function)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/timeout ()
|
|
|
|
"Completion for the `timeout' command."
|
|
|
|
(while (string-prefix-p "-" (pcomplete-arg 0))
|
|
|
|
(pcomplete-here (pcomplete-from-help "timeout --help"))
|
|
|
|
(when (pcomplete-match "\\`-[ks]\\'") (pcomplete-here)))
|
|
|
|
(pcomplete-here) ; eat DURATION argument
|
|
|
|
(funcall pcomplete-command-completion-function)
|
|
|
|
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
|
|
|
|
pcomplete-default-completion-function)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/numfmt ()
|
|
|
|
"Completion for the `numfmt' command."
|
|
|
|
(pcomplete-here-using-help "numfmt --help"))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/seq ()
|
|
|
|
"Completion for the `seq' command."
|
|
|
|
(pcomplete-here-using-help "seq --help"))
|
|
|
|
|
|
|
|
;;; Network commands
|
2008-02-08 05:14:03 +00:00
|
|
|
|
2008-02-08 05:07:50 +00:00
|
|
|
;; ssh support by Phil Hagelberg.
|
2020-10-01 13:24:21 +00:00
|
|
|
;; https://www.emacswiki.org/cgi-bin/wiki/pcmpl-ssh.el
|
2008-02-08 05:07:50 +00:00
|
|
|
|
2011-01-22 02:20:57 +00:00
|
|
|
(defun pcmpl-ssh-known-hosts ()
|
2008-02-08 05:14:03 +00:00
|
|
|
"Return a list of hosts found in `pcmpl-ssh-known-hosts-file'."
|
|
|
|
(when (and pcmpl-ssh-known-hosts-file
|
|
|
|
(file-readable-p pcmpl-ssh-known-hosts-file))
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert-file-contents-literally pcmpl-ssh-known-hosts-file)
|
2012-01-27 21:14:16 +00:00
|
|
|
(let ((host-re "\\(?:\\([-.[:alnum:]]+\\)\\|\\[\\([-.[:alnum:]]+\\)\\]:[0-9]+\\)[, ]")
|
|
|
|
ssh-hosts-list)
|
|
|
|
(while (re-search-forward (concat "^ *" host-re) nil t)
|
2020-09-02 14:37:13 +00:00
|
|
|
(push (concat (match-string 1)
|
|
|
|
(match-string 2))
|
|
|
|
ssh-hosts-list)
|
2015-04-03 10:28:40 +00:00
|
|
|
(while (and (eq (char-before) ?,)
|
2012-01-27 21:14:16 +00:00
|
|
|
(re-search-forward host-re (line-end-position) t))
|
2020-09-02 14:37:13 +00:00
|
|
|
(push (concat (match-string 1)
|
|
|
|
(match-string 2))
|
|
|
|
ssh-hosts-list)))
|
2008-02-08 05:14:03 +00:00
|
|
|
ssh-hosts-list))))
|
2008-02-08 05:07:50 +00:00
|
|
|
|
2011-01-22 02:20:57 +00:00
|
|
|
(defun pcmpl-ssh-config-hosts ()
|
|
|
|
"Return a list of hosts found in `pcmpl-ssh-config-file'."
|
|
|
|
(when (and pcmpl-ssh-config-file
|
|
|
|
(file-readable-p pcmpl-ssh-config-file))
|
|
|
|
(with-temp-buffer
|
|
|
|
(insert-file-contents-literally pcmpl-ssh-config-file)
|
|
|
|
(let (ssh-hosts-list
|
|
|
|
(case-fold-search t))
|
|
|
|
(while (re-search-forward "^ *host\\(name\\)? +\\([-.[:alnum:]]+\\)"
|
|
|
|
nil t)
|
2020-09-02 14:37:13 +00:00
|
|
|
(push (match-string 2) ssh-hosts-list))
|
2011-01-22 02:20:57 +00:00
|
|
|
ssh-hosts-list))))
|
|
|
|
|
|
|
|
(defun pcmpl-ssh-hosts ()
|
|
|
|
"Return a list of known SSH hosts.
|
|
|
|
Uses both `pcmpl-ssh-config-file' and `pcmpl-ssh-known-hosts-file'."
|
|
|
|
(let ((hosts (pcmpl-ssh-known-hosts)))
|
|
|
|
(dolist (h (pcmpl-ssh-config-hosts))
|
2020-09-02 14:37:13 +00:00
|
|
|
(push h hosts))
|
2011-01-22 02:20:57 +00:00
|
|
|
hosts))
|
|
|
|
|
2008-02-08 05:07:50 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/ssh ()
|
|
|
|
"Completion rules for the `ssh' command."
|
2011-10-14 18:39:16 +00:00
|
|
|
(pcomplete-opt "1246AaCfgKkMNnqsTtVvXxYbcDeFiLlmOopRSw")
|
2008-02-08 05:07:50 +00:00
|
|
|
(pcomplete-here (pcmpl-ssh-hosts)))
|
|
|
|
|
2022-07-12 14:32:07 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defalias 'pcomplete/rsh #'pcomplete/ssh)
|
|
|
|
(defalias 'pcomplete/rlogin #'pcomplete/ssh)
|
|
|
|
|
2008-02-08 05:07:50 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/scp ()
|
|
|
|
"Completion rules for the `scp' command.
|
|
|
|
Includes files as well as host names followed by a colon."
|
|
|
|
(pcomplete-opt "1246BCpqrvcFiloPS")
|
2011-10-03 16:49:56 +00:00
|
|
|
(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)
|
2012-04-25 18:53:57 +00:00
|
|
|
(completion-table-subvert (pcomplete-all-entries)
|
|
|
|
"" "/ssh:")))
|
Use string-search instead of string-match[-p]
`string-search` is easier to understand, less error-prone, much
faster, does not pollute the regexp cache, and does not mutate global
state. Use it where applicable and obviously safe (erring on the
conservative side).
* admin/authors.el (authors-canonical-file-name)
(authors-scan-change-log):
* lisp/apropos.el (apropos-command)
(apropos-documentation-property, apropos-symbols-internal):
* lisp/arc-mode.el (archive-arc-summarize)
(archive-zoo-summarize):
* lisp/calc/calc-aent.el (math-read-factor):
* lisp/calc/calc-ext.el (math-read-big-expr)
(math-format-nice-expr, math-format-number-fancy):
* lisp/calc/calc-forms.el (math-read-angle-brackets):
* lisp/calc/calc-graph.el (calc-graph-set-range):
* lisp/calc/calc-keypd.el (calc-keypad-press):
* lisp/calc/calc-lang.el (tex, latex, math-read-big-rec):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-user-define-permanent, math-define-exp):
* lisp/calc/calc.el (calc-record, calcDigit-key)
(calc-count-lines):
* lisp/calc/calcalg2.el (calc-solve-for, calc-poly-roots)
(math-do-integral):
* lisp/calc/calcalg3.el (calc-find-root, calc-find-minimum)
(calc-get-fit-variables):
* lisp/cedet/ede/speedbar.el (ede-tag-expand):
* lisp/cedet/semantic/java.el (semantic-java-expand-tag):
* lisp/cedet/semantic/sb.el (semantic-sb-show-extra)
(semantic-sb-expand-group):
* lisp/cedet/semantic/wisent/python.el
(semantic-python-instance-variable-p):
* lisp/cus-edit.el (get):
* lisp/descr-text.el (describe-text-sexp):
* lisp/dired-aux.el (dired-compress-file):
* lisp/dired-x.el (dired-make-relative-symlink):
* lisp/dired.el (dired-glob-regexp):
* lisp/dos-fns.el (dos-convert-standard-filename, dos-8+3-filename):
* lisp/edmacro.el (edmacro-format-keys):
* lisp/emacs-lisp/eieio-opt.el (eieio-sb-expand):
* lisp/emacs-lisp/eieio-speedbar.el (eieio-speedbar-object-expand):
* lisp/emacs-lisp/lisp-mnt.el (lm-keywords-list):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/emulation/viper-ex.el (viper-ex-read-file-name)
(ex-print-display-lines):
* lisp/env.el (read-envvar-name, setenv):
* lisp/epa-mail.el (epa-mail-encrypt):
* lisp/epg.el (epg--start):
* lisp/erc/erc-backend.el (erc-parse-server-response):
* lisp/erc/erc-dcc.el (erc-dcc-member):
* lisp/erc/erc-speedbar.el (erc-speedbar-expand-server)
(erc-speedbar-expand-channel, erc-speedbar-expand-user):
* lisp/erc/erc.el (erc-send-input):
* lisp/eshell/em-glob.el (eshell-glob-entries):
* lisp/eshell/esh-proc.el (eshell-needs-pipe-p):
* lisp/eshell/esh-util.el (eshell-convert):
* lisp/eshell/esh-var.el (eshell-envvar-names):
* lisp/faces.el (x-resolve-font-name):
* lisp/ffap.el (ffap-file-at-point):
* lisp/files.el (wildcard-to-regexp, shell-quote-wildcard-pattern):
* lisp/forms.el (forms--update):
* lisp/frameset.el (frameset-filter-unshelve-param):
* lisp/gnus/gnus-art.el (article-decode-charset):
* lisp/gnus/gnus-kill.el (gnus-kill-parse-rn-kill-file):
* lisp/gnus/gnus-mlspl.el (gnus-group-split-fancy):
* lisp/gnus/gnus-msg.el (gnus-summary-resend-message-insert-gcc)
(gnus-inews-insert-gcc):
* lisp/gnus/gnus-rfc1843.el (rfc1843-decode-article-body):
* lisp/gnus/gnus-search.el (gnus-search-indexed-parse-output)
(gnus-search--complete-key-data):
* lisp/gnus/gnus-spec.el (gnus-parse-simple-format):
* lisp/gnus/gnus-sum.el (gnus-summary-refer-article):
* lisp/gnus/gnus-util.el (gnus-extract-address-components)
(gnus-newsgroup-directory-form):
* lisp/gnus/gnus-uu.el (gnus-uu-grab-view):
* lisp/gnus/gnus.el (gnus-group-native-p, gnus-short-group-name):
* lisp/gnus/message.el (message-check-news-header-syntax)
(message-make-message-id, message-user-mail-address)
(message-make-fqdn, message-get-reply-headers, message-followup):
* lisp/gnus/mm-decode.el (mm-dissect-buffer):
* lisp/gnus/nnheader.el (nnheader-insert):
* lisp/gnus/nnimap.el (nnimap-process-quirk)
(nnimap-imap-ranges-to-gnus-ranges):
* lisp/gnus/nnmaildir.el (nnmaildir--ensure-suffix):
* lisp/gnus/nnmairix.el (nnmairix-determine-original-group-from-path):
* lisp/gnus/nnrss.el (nnrss-match-macro):
* lisp/gnus/nntp.el (nntp-find-group-and-number):
* lisp/help-fns.el (help--symbol-completion-table-affixation):
* lisp/help.el (help-function-arglist):
* lisp/hippie-exp.el (he-concat-directory-file-name):
* lisp/htmlfontify.el (hfy-relstub):
* lisp/ido.el (ido-make-prompt, ido-complete, ido-copy-current-word)
(ido-exhibit):
* lisp/image/image-converter.el (image-convert-p):
* lisp/info-xref.el (info-xref-docstrings):
* lisp/info.el (Info-toc-build, Info-follow-reference)
(Info-backward-node, Info-finder-find-node)
(Info-speedbar-expand-node):
* lisp/international/mule-diag.el (print-fontset-element):
* lisp/language/korea-util.el (default-korean-keyboard):
* lisp/linum.el (linum-after-change):
* lisp/mail/ietf-drums.el (ietf-drums-parse-address):
* lisp/mail/mail-utils.el (mail-dont-reply-to):
* lisp/mail/rfc2047.el (rfc2047-encode-1, rfc2047-decode-string):
* lisp/mail/rfc2231.el (rfc2231-parse-string):
* lisp/mail/rmailkwd.el (rmail-set-label):
* lisp/mail/rmailsum.el (rmail-header-summary):
* lisp/mail/smtpmail.el (smtpmail-maybe-append-domain)
(smtpmail-user-mail-address):
* lisp/mail/uce.el (uce-reply-to-uce):
* lisp/man.el (Man-default-man-entry):
* lisp/mh-e/mh-alias.el (mh-alias-gecos-name)
(mh-alias-minibuffer-confirm-address):
* lisp/mh-e/mh-comp.el (mh-forwarded-letter-subject):
* lisp/mh-e/mh-speed.el (mh-speed-parse-flists-output):
* lisp/mh-e/mh-utils.el (mh-collect-folder-names-filter)
(mh-folder-completion-function):
* lisp/minibuffer.el (completion--make-envvar-table)
(completion-file-name-table, completion-flex-try-completion)
(completion-flex-all-completions):
* lisp/mpc.el (mpc--proc-quote-string, mpc-cmd-special-tag-p)
(mpc-constraints-tag-lookup):
* lisp/net/ange-ftp.el (ange-ftp-send-cmd)
(ange-ftp-allow-child-lookup):
* lisp/net/mailcap.el (mailcap-mime-types):
* lisp/net/mairix.el (mairix-search-thread-this-article):
* lisp/net/pop3.el (pop3-open-server):
* lisp/net/soap-client.el (soap-decode-xs-complex-type):
* lisp/net/socks.el (socks-filter):
* lisp/nxml/nxml-outln.el (nxml-highlighted-qname):
* lisp/nxml/rng-cmpct.el (rng-c-expand-name, rng-c-expand-datatype):
* lisp/nxml/rng-uri.el (rng-uri-file-name-1):
* lisp/obsolete/complete.el (partial-completion-mode)
(PC-do-completion):
* lisp/obsolete/longlines.el (longlines-encode-string):
* lisp/obsolete/nnir.el (nnir-compose-result):
* lisp/obsolete/terminal.el (te-quote-arg-for-sh):
* lisp/obsolete/tpu-edt.el (tpu-check-search-case):
* lisp/obsolete/url-ns.el (isPlainHostName):
* lisp/pcmpl-unix.el (pcomplete/scp):
* lisp/play/dunnet.el (dun-listify-string2, dun-get-path)
(dun-unix-parse, dun-doassign, dun-cat, dun-batch-unix-interface):
* lisp/progmodes/ebnf2ps.el: (ebnf-eps-header-footer-comment):
* lisp/progmodes/gdb-mi.el (gdb-var-delete)
(gdb-speedbar-expand-node, gdbmi-bnf-incomplete-record-result):
* lisp/progmodes/gud.el (gud-find-expr):
* lisp/progmodes/idlw-help.el (idlwave-do-context-help1):
* lisp/progmodes/idlw-shell.el (idlwave-shell-mode)
(idlwave-shell-filter-hidden-output, idlwave-shell-filter):
* lisp/progmodes/idlwave.el (idlwave-skip-label-or-case)
(idlwave-routine-info):
* lisp/progmodes/octave.el (inferior-octave-completion-at-point):
* lisp/progmodes/sh-script.el (sh-add-completer):
* lisp/progmodes/sql.el (defun):
* lisp/progmodes/xscheme.el (xscheme-process-filter):
* lisp/replace.el (query-replace-compile-replacement)
(map-query-replace-regexp):
* lisp/shell.el (shell--command-completion-data)
(shell-environment-variable-completion):
* lisp/simple.el (display-message-or-buffer):
* lisp/speedbar.el (speedbar-dired, speedbar-tag-file)
(speedbar-tag-expand):
* lisp/subr.el (split-string-and-unquote):
* lisp/tar-mode.el (tar-extract):
* lisp/term.el (term-command-hook, serial-read-name):
* lisp/textmodes/bibtex.el (bibtex-print-help-message):
* lisp/textmodes/ispell.el (ispell-lookup-words, ispell-filter)
(ispell-parse-output, ispell-buffer-local-parsing):
* lisp/textmodes/reftex-cite.el (reftex-do-citation):
* lisp/textmodes/reftex-parse.el (reftex-notice-new):
* lisp/textmodes/reftex-ref.el (reftex-show-entry):
* lisp/textmodes/reftex.el (reftex-compile-variables):
* lisp/textmodes/tex-mode.el (tex-send-command)
(tex-start-tex, tex-append):
* lisp/thingatpt.el (thing-at-point-url-at-point):
* lisp/tmm.el (tmm-add-one-shortcut):
* lisp/transient.el (transient-format-key):
* lisp/url/url-auth.el (url-basic-auth)
(url-digest-auth-directory-id-assoc):
* lisp/url/url-news.el (url-news):
* lisp/url/url-util.el (url-parse-query-string):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/wid-browse.el (widget-browse-sexp):
* lisp/woman.el (woman-parse-colon-path, woman-mini-help)
(WoMan-getpage-in-background, woman-negative-vertical-space):
* lisp/xml.el:
* test/lisp/emacs-lisp/check-declare-tests.el
(check-declare-tests-warn):
* test/lisp/files-tests.el
(files-tests-file-name-non-special-dired-compress-handler):
* test/lisp/net/network-stream-tests.el (server-process-filter):
* test/src/coding-tests.el (ert-test-unibyte-buffer-dos-eol-decode):
Use `string-search` instead of `string-match` and `string-match-p`.
2021-08-09 09:20:00 +00:00
|
|
|
((string-search "/" string) ; Local file name.
|
2011-10-03 16:49:56 +00:00
|
|
|
(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))))))
|
2008-02-08 05:07:50 +00:00
|
|
|
|
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.
2020-09-02 00:45:39 +00:00
|
|
|
(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)
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/telnet ()
|
|
|
|
(pcomplete-opt "xl(pcmpl-unix-user-names)")
|
|
|
|
(pcmpl-unix-complete-hostname))
|
|
|
|
|
2022-09-08 09:09:42 +00:00
|
|
|
;;; Miscellaneous
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete/sudo ()
|
|
|
|
"Completion for the `sudo' command."
|
|
|
|
(while (string-prefix-p "-" (pcomplete-arg 0))
|
|
|
|
(pcomplete-here (pcomplete-from-help "sudo --help"))
|
|
|
|
(when (pcomplete-match "\\`-[CDghpRtTUu]\\'") (pcomplete-here)))
|
|
|
|
(funcall pcomplete-command-completion-function)
|
|
|
|
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
|
|
|
|
pcomplete-default-completion-function)))
|
|
|
|
|
2008-02-08 05:14:03 +00:00
|
|
|
(provide 'pcmpl-unix)
|
|
|
|
|
2000-06-27 10:55:46 +00:00
|
|
|
;;; pcmpl-unix.el ends here
|