annotate lisp/pcmpl-unix.el @ 111789:f97704487fb3

Merge changes made in Gnus trunk. nnir.el: Batch header retrieval. proto-stream.el: New library to provide protocol-specific TLS/STARTTLS connections for IMAP, NNTP, SMTP, POP3 and similar protocols. nnimap.el (nnimap-open-connection): Use it. proto-stream.el (open-proto-stream): Complete the documentation. nnimap.el (nnimap-open-connection): Check for "OK" from the greeting. nntp.el: Use proto-streams for the relevant connections types. nntp.el (nntp-open-connection): Switch on STARTTLS on supported servers. proto-stream.el (open-proto-stream): Add a way to specify what the end of a command is. proto-stream.el (proto-stream-open-tls): Delete output from openssl if we're using tls.el. proto-stream.el (proto-stream-open-network): If we don't have gnutls-cli or gnutls built in, then don't try to establish a STARTTLS connection. color.el (color-lab->srgb): Fix function call name. proto-stream.el: Fix the syntax in the comment. nntp.el (nntp-open-connection): Fix the STARTTLS command syntax. proto-stream.el (proto-stream-open-starttls): Actually implement the starttls.el STARTTLS. proto-stream.el (proto-stream-always-use-starttls): New variable. proto-stream.el (proto-stream-open-starttls): De-duplicate the starttls code. proto-stream.el (proto-stream-open-starttls): Folded back into the main function. proto-stream.el (proto-stream-command): Refactor out. nnimap.el (nnimap-stream): Change default to `undecided'. nnimap.el (nnimap-open-connection): If `nnimap-stream' is `undecided', try ssl first, and then network. nnimap.el (nnimap-open-connection-1): Respect nnimap-server-port. nnimap.el (nnimap-open-connection): Be more backwards-compatible. proto-stream.el (open-protocol-stream): Renamed from open-proto-stream. proto-stream.el (proto-stream-open-network): When doing opportunistic TLS upgrades we don't really care about the identity of the peer. gnus.texi (Customizing the IMAP Connection): Note the new defaults. gnus.texi (Direct Functions): Note the STARTTLS upgrade. proto-stream.el (proto-stream-open-network): Force starttls.el to use gnutls-cli, since that what we've checked for. proto-stream.el (proto-stream-always-use-starttls): Only default to t if open-gnutls-stream exists. proto-stream.el (proto-stream-open-network): If STARTTLS failed, then just open a normal connection. proto-stream.el (proto-stream-open-network): Wait until the greeting before doing STARTTLS. nnimap.el (nnimap-open-connection-1): Always upgrade to STARTTLS (for backwards compatibility). nnimap.el (nnimap-open-connection-1): Really respect nnimap-server-port. nntp.el (nntp-open-connection): Provide a :success condition. nnimap.el (nnimap-open-connection-1): Ditto. proto-stream.el (proto-stream-open-network): See what the response to the STARTTLS command is. proto-stream.el (proto-stream-open-network): Add some comments. proto-stream.el: Fix example. proto-stream.el (open-protocol-stream): Actually mention the STARTTLS upgrade. nnir.el (nnir-get-active): Skip nnir-ignored-newsgroups when searching. nnir.el (nnir-ignore-newsgroups): Fix default value. nnir.el (nnir-run-gmane): Use mm-delete-duplicates instead of delete-dups that is not available in XEmacs 21.4. mm-util.el (mm-delete-duplicates): Add comment. gnus-sum.el (gnus-summary-delete-article): If delete fails don't change the registry. nnimap.el (nnimap-open-connection-1): w32 open-network-stream doesn't seem to accept strings-with-numbers as port numbers. color.el: fix docstring to use English rather than math notation for intervals. shr.el (shr-find-fill-point): Don't break before apostrophes. nnir.el (nnir-request-move-article): Bail out if no move support in group. color.el (color-rgb->hsv): Fix docstring. nnir.el (nnir-get-active): Improve active list retrieval. shr.el (shr-find-fill-point): Work better for kinsoku chars and apostrophes. gnus-gravatar.el (gnus-gravatar-size): Set gnus-gravatar-size to nil. nnimap.el (nnimap-open-connection-1): Use gnus-string-match-p. nnimap.el (nnimap-open-connection-1): Fix PREAUTH. proto-stream.el (open-protocol-stream): All starttls connections are handled by the network handler. gnus-gravatar.el (gnus-gravatar-insert): Delete unnecessary binding to t of inhibit-read-only since it is inside gnus-with-article-headers. gnus-gravatar.el (gnus-gravatar-transform-address): Use mail-extract-address-components that supports non-ASCII names rather than mail-header-parse-addresses. shr.el (shr-find-fill-point): Don't break line between kinsoku-bol characters. gnus-gravatar.el (gnus-gravatar-insert): Allow LWSP in the middle of names. nnmaildir.el (nnmaildir-request-set-mark): Add article to add-mark funcall. gnus-msg.el: Remove nastygram thing. message.el (message-from-style): Fix comment. message.el (message-user-organization): Do not use gnus-local-organization. gnus.el: Remove gnus-local-organization. rtree.el: New file to handle range trees. nnir.el, gnus-sum.el: Redo the way nnir handles registry updates. rtree.el (rtree-extract): Simplify. gnus-win.el (gnus-configure-windows): Remove Gnus 3.x setting support. gnus-msg.el: Mark gnus-outgoing-message-group as obsolete. gnus.texi (Archived Messages): Remove gnus-outgoing-message-group. gnus-win.el (gnus-configure-frame): Remove old compatibility code. rtree.el (rtree-memq): Rewrite it as a non-recursive function. rtree.el (rtree-add, rtree-delq, rtree-length): Implement. rtree.el (rtree-add): Make code slightly faster. nnir.el: Allow modified summary-line-format in nnir summary buffers.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Thu, 02 Dec 2010 22:21:31 +0000
parents 280c8ae2476d
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 29959
diff changeset
1 ;;; pcmpl-unix.el --- standard UNIX completions
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
2
74442
b2e5081b9320 Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 68651
diff changeset
3 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 106360
diff changeset
4 ;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
5
110015
280c8ae2476d Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents: 106869
diff changeset
6 ;; Package: pcomplete
280c8ae2476d Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents: 106869
diff changeset
7
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
9
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91644
diff changeset
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91644
diff changeset
12 ;; the Free Software Foundation, either version 3 of the License, or
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91644
diff changeset
13 ;; (at your option) any later version.
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
14
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
19
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
94678
ee5932bf781d Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91644
diff changeset
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
22
38414
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 29959
diff changeset
23 ;;; Commentary:
67b464da13ec Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents: 29959
diff changeset
24
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
25 ;;; Code:
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
26
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
27 (require 'pcomplete)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
28
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
29 ;; User Variables:
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
30
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
31 (defcustom pcmpl-unix-group-file "/etc/group"
91644
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
32 "If non-nil, a string naming the group file on your system."
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
33 :type '(choice file (const nil))
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
34 :group 'pcmpl-unix)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
35
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
36 (defcustom pcmpl-unix-passwd-file "/etc/passwd"
91644
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
37 "If non-nil, a string naming the passwd file on your system."
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
38 :type '(choice file (const nil))
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
39 :group 'pcmpl-unix)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
40
91643
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
41 (defcustom pcmpl-ssh-known-hosts-file "~/.ssh/known_hosts"
91644
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
42 "If non-nil, a string naming your SSH \"known_hosts\" file.
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
43 This allows completion of SSH host names. Note that newer
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
44 versions of ssh hash the hosts by default to prevent
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
45 Island-hopping SSH attacks. This can be disabled, at some risk,
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
46 with the SSH option \"HashKnownHosts no\"."
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
47 :type '(choice file (const nil))
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
48 :group 'pcmpl-unix
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
49 :version "23.1")
91643
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
50
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
51 ;; Functions:
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
52
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
53 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
54 (defun pcomplete/cd ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
55 "Completion for `cd'."
106360
33815099ecfc (pcomplete/cd): Complete more than one argument, just in case.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 100908
diff changeset
56 (while (pcomplete-here (pcomplete-dirs))))
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
57
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
58 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
59 (defalias 'pcomplete/pushd 'pcomplete/cd)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
60
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
61 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
62 (defun pcomplete/rmdir ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
63 "Completion for `rmdir'."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
64 (while (pcomplete-here (pcomplete-dirs))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
65
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
66 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
67 (defun pcomplete/rm ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
68 "Completion for `rm'."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
69 (let ((pcomplete-help "(fileutils)rm invocation"))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
70 (pcomplete-opt "dfirRv")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
71 (while (pcomplete-here (pcomplete-all-entries) nil
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
72 'expand-file-name))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
73
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
74 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
75 (defun pcomplete/xargs ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
76 "Completion for `xargs'."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
77 (pcomplete-here (funcall pcomplete-command-completion-function))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
78 (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
79 pcomplete-default-completion-function)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
80
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
81 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
82 (defalias 'pcomplete/time 'pcomplete/xargs)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
83
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
84 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
85 (defun pcomplete/which ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
86 "Completion for `which'."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
87 (while (pcomplete-here (funcall pcomplete-command-completion-function))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
88
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
89 (defun pcmpl-unix-read-passwd-file (file)
106869
54435fbb4206 * pcmpl-unix.el (pcmpl-unix-read-passwd-file): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
90 "Return an alist correlating gids to group names in FILE.
54435fbb4206 * pcmpl-unix.el (pcmpl-unix-read-passwd-file): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
91
54435fbb4206 * pcmpl-unix.el (pcmpl-unix-read-passwd-file): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
92 If FILE is in hashed format (as described in the OpenSSH
54435fbb4206 * pcmpl-unix.el (pcmpl-unix-read-passwd-file): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
93 documentation), this function returns nil."
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
94 (let (names)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
95 (when (file-readable-p file)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
96 (with-temp-buffer
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
97 (insert-file-contents file)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
98 (goto-char (point-min))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
99 (while (not (eobp))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
100 (let* ((fields
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
101 (split-string (buffer-substring
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
102 (point) (progn (end-of-line)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
103 (point))) ":")))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
104 (setq names (cons (nth 0 fields) names)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
105 (forward-line))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
106 (pcomplete-uniqify-list names)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
107
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
108 (defsubst pcmpl-unix-group-names ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
109 "Read the contents of /etc/group for group names."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
110 (if pcmpl-unix-group-file
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
111 (pcmpl-unix-read-passwd-file pcmpl-unix-group-file)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
112
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
113 (defsubst pcmpl-unix-user-names ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
114 "Read the contents of /etc/passwd for user names."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
115 (if pcmpl-unix-passwd-file
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
116 (pcmpl-unix-read-passwd-file pcmpl-unix-passwd-file)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
117
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
118 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
119 (defun pcomplete/chown ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
120 "Completion for the `chown' command."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
121 (unless (pcomplete-match "\\`-")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
122 (if (pcomplete-match "\\`[^.]*\\'" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
123 (pcomplete-here* (pcmpl-unix-user-names))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
124 (if (pcomplete-match "\\.\\([^.]*\\)\\'" 0)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
125 (pcomplete-here* (pcmpl-unix-group-names)
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
126 (pcomplete-match-string 1 0))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
127 (pcomplete-here*))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
128 (while (pcomplete-here (pcomplete-entries))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
129
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
130 ;;;###autoload
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
131 (defun pcomplete/chgrp ()
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
132 "Completion for the `chgrp' command."
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
133 (unless (pcomplete-match "\\`-")
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
134 (pcomplete-here* (pcmpl-unix-group-names)))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
135 (while (pcomplete-here (pcomplete-entries))))
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
136
91644
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
137
91643
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
138 ;; ssh support by Phil Hagelberg.
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
139 ;; http://www.emacswiki.org/cgi-bin/wiki/pcmpl-ssh.el
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
140
91644
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
141 (defun pcmpl-ssh-hosts ()
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
142 "Return a list of hosts found in `pcmpl-ssh-known-hosts-file'."
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
143 (when (and pcmpl-ssh-known-hosts-file
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
144 (file-readable-p pcmpl-ssh-known-hosts-file))
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
145 (with-temp-buffer
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
146 (insert-file-contents-literally pcmpl-ssh-known-hosts-file)
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
147 (let (ssh-hosts-list)
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
148 (while (re-search-forward "^ *\\([-.[:alnum:]]+\\)[, ]" nil t)
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
149 (add-to-list 'ssh-hosts-list (match-string 1))
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
150 (while (and (looking-back ",")
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
151 (re-search-forward "\\([-.[:alnum:]]+\\)[, ]"
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
152 (line-end-position) t))
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
153 (add-to-list 'ssh-hosts-list (match-string 1))))
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
154 ssh-hosts-list))))
91643
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
155
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
156 ;;;###autoload
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
157 (defun pcomplete/ssh ()
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
158 "Completion rules for the `ssh' command."
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
159 (pcomplete-opt "1246AaCfgKkMNnqsTtVvXxYbcDeFiLlmOopRSw" nil t)
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
160 (pcomplete-here (pcmpl-ssh-hosts)))
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
161
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
162 ;;;###autoload
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
163 (defun pcomplete/scp ()
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
164 "Completion rules for the `scp' command.
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
165 Includes files as well as host names followed by a colon."
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
166 (pcomplete-opt "1246BCpqrvcFiloPS")
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
167 (while t (pcomplete-here (append (pcomplete-all-entries)
91644
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
168 (mapcar (lambda (host)
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
169 (concat host ":"))
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
170 (pcmpl-ssh-hosts))))))
91643
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
171
91644
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
172 (provide 'pcmpl-unix)
91643
d3922949ea68 Phil Hagelberg <phil at evri.com>
Glenn Morris <rgm@gnu.org>
parents: 79721
diff changeset
173
91644
681a1b7488c2 (top-level): Move provide statement to end.
Glenn Morris <rgm@gnu.org>
parents: 91643
diff changeset
174 ;; arch-tag: 3f9eb5af-7e0e-449d-b586-381cbbf8fc5c
29959
d4e54e70814f *** empty log message ***
Gerd Moellmann <gerd@gnu.org>
parents:
diff changeset
175 ;;; pcmpl-unix.el ends here