2011-06-17 18:52:46 +00:00
|
|
|
;;; pcomplete.el --- programmable completion -*- lexical-binding: t -*-
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2019-01-01 00:59:58 +00:00
|
|
|
;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;; Author: John Wiegley <johnw@gnu.org>
|
2000-10-15 17:13:58 +00:00
|
|
|
;; Keywords: processes abbrev
|
2000-06-23 05:24:10 +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-23 05:24:10 +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-23 05:24:10 +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-23 05:24:10 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
|
|
;; This module provides a programmable completion facility using
|
|
|
|
;; "completion functions". Each completion function is responsible
|
|
|
|
;; for producing a list of possible completions relevant to the current
|
|
|
|
;; argument position.
|
|
|
|
;;
|
|
|
|
;; To use pcomplete with shell-mode, for example, you will need the
|
2012-09-17 05:41:04 +00:00
|
|
|
;; following in your init file:
|
2000-06-23 05:24:10 +00:00
|
|
|
;;
|
|
|
|
;; (add-hook 'shell-mode-hook 'pcomplete-shell-setup)
|
|
|
|
;;
|
|
|
|
;; Most of the code below simply provides support mechanisms for
|
|
|
|
;; writing completion functions. Completion functions themselves are
|
|
|
|
;; very easy to write. They have few requirements beyond those of
|
|
|
|
;; regular Lisp functions.
|
|
|
|
;;
|
|
|
|
;; Consider the following example, which will complete against
|
|
|
|
;; filenames for the first two arguments, and directories for all
|
|
|
|
;; remaining arguments:
|
|
|
|
;;
|
|
|
|
;; (defun pcomplete/my-command ()
|
|
|
|
;; (pcomplete-here (pcomplete-entries))
|
|
|
|
;; (pcomplete-here (pcomplete-entries))
|
|
|
|
;; (while (pcomplete-here (pcomplete-dirs))))
|
|
|
|
;;
|
|
|
|
;; Here are the requirements for completion functions:
|
|
|
|
;;
|
|
|
|
;; @ They must be called "pcomplete/MAJOR-MODE/NAME", or
|
|
|
|
;; "pcomplete/NAME". This is how they are looked up, using the NAME
|
|
|
|
;; specified in the command argument (the argument in first
|
|
|
|
;; position).
|
|
|
|
;;
|
|
|
|
;; @ They must be callable with no arguments.
|
|
|
|
;;
|
|
|
|
;; @ Their return value is ignored. If they actually return normally,
|
|
|
|
;; it means no completions were available.
|
|
|
|
;;
|
|
|
|
;; @ In order to provide completions, they must throw the tag
|
2009-10-22 15:17:48 +00:00
|
|
|
;; `pcomplete-completions'. The value must be a completion table
|
|
|
|
;; (i.e. a table that can be passed to try-completion and friends)
|
|
|
|
;; for the final argument.
|
2000-06-23 05:24:10 +00:00
|
|
|
;;
|
|
|
|
;; @ To simplify completion function logic, the tag `pcompleted' may
|
|
|
|
;; be thrown with a value of nil in order to abort the function. It
|
|
|
|
;; means that there were no completions available.
|
|
|
|
;;
|
|
|
|
;; When a completion function is called, the variable `pcomplete-args'
|
|
|
|
;; is in scope, and contains all of the arguments specified on the
|
|
|
|
;; command line. The variable `pcomplete-last' is the index of the
|
|
|
|
;; last argument in that list.
|
|
|
|
;;
|
|
|
|
;; The variable `pcomplete-index' is used by the completion code to
|
|
|
|
;; know which argument the completion function is currently examining.
|
|
|
|
;; It always begins at 1, meaning the first argument after the command
|
|
|
|
;; name.
|
|
|
|
;;
|
|
|
|
;; To facilitate writing completion logic, a special macro,
|
|
|
|
;; `pcomplete-here', has been provided which does several things:
|
|
|
|
;;
|
|
|
|
;; 1. It will throw `pcompleted' (with a value of nil) whenever
|
|
|
|
;; `pcomplete-index' exceeds `pcomplete-last'.
|
|
|
|
;;
|
|
|
|
;; 2. It will increment `pcomplete-index' if the final argument has
|
|
|
|
;; not been reached yet.
|
|
|
|
;;
|
|
|
|
;; 3. It will evaluate the form passed to it, and throw the result
|
|
|
|
;; using the `pcomplete-completions' tag, if it is called when
|
|
|
|
;; `pcomplete-index' is pointing to the final argument.
|
|
|
|
;;
|
|
|
|
;; Sometimes a completion function will want to vary the possible
|
|
|
|
;; completions for an argument based on the previous one. To
|
|
|
|
;; facilitate tests like this, the function `pcomplete-test' and
|
|
|
|
;; `pcomplete-match' are provided. Called with one argument, they
|
|
|
|
;; test the value of the previous command argument. Otherwise, a
|
|
|
|
;; relative index may be given as an optional second argument, where 0
|
|
|
|
;; refers to the current argument, 1 the previous, 2 the one before
|
|
|
|
;; that, etc. The symbols `first' and `last' specify absolute
|
|
|
|
;; offsets.
|
|
|
|
;;
|
|
|
|
;; Here is an example which will only complete against directories for
|
|
|
|
;; the second argument if the first argument is also a directory:
|
|
|
|
;;
|
|
|
|
;; (defun pcomplete/example ()
|
|
|
|
;; (pcomplete-here (pcomplete-entries))
|
|
|
|
;; (if (pcomplete-test 'file-directory-p)
|
|
|
|
;; (pcomplete-here (pcomplete-dirs))
|
|
|
|
;; (pcomplete-here (pcomplete-entries))))
|
|
|
|
;;
|
|
|
|
;; For generating completion lists based on directory contents, see
|
|
|
|
;; the functions `pcomplete-entries', `pcomplete-dirs',
|
|
|
|
;; `pcomplete-executables' and `pcomplete-all-entries'.
|
|
|
|
;;
|
|
|
|
;; Consult the documentation for `pcomplete-here' for information
|
|
|
|
;; about its other arguments.
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
2011-10-02 04:08:50 +00:00
|
|
|
(require 'comint)
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(defgroup pcomplete nil
|
|
|
|
"Programmable completion."
|
2000-10-15 17:13:58 +00:00
|
|
|
:version "21.1"
|
2000-06-23 05:24:10 +00:00
|
|
|
:group 'processes)
|
|
|
|
|
|
|
|
;;; User Variables:
|
|
|
|
|
|
|
|
(defcustom pcomplete-file-ignore nil
|
2008-12-03 05:48:14 +00:00
|
|
|
"A regexp of filenames to be disregarded during file completion."
|
2001-01-26 06:19:25 +00:00
|
|
|
:type '(choice regexp (const :tag "None" nil))
|
2000-06-23 05:24:10 +00:00
|
|
|
:group 'pcomplete)
|
|
|
|
|
|
|
|
(defcustom pcomplete-dir-ignore nil
|
2008-12-03 05:48:14 +00:00
|
|
|
"A regexp of names to be disregarded during directory completion."
|
2001-01-26 06:19:25 +00:00
|
|
|
:type '(choice regexp (const :tag "None" nil))
|
2000-06-23 05:24:10 +00:00
|
|
|
:group 'pcomplete)
|
|
|
|
|
2003-01-31 15:24:20 +00:00
|
|
|
(defcustom pcomplete-ignore-case (memq system-type '(ms-dos windows-nt cygwin))
|
2009-10-23 17:37:09 +00:00
|
|
|
;; FIXME: the doc mentions file-name completion, but the code
|
|
|
|
;; seems to apply it to all completions.
|
2008-12-03 05:48:14 +00:00
|
|
|
"If non-nil, ignore case when doing filename completion."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'boolean
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
|
|
|
(defcustom pcomplete-autolist nil
|
2008-12-03 05:48:14 +00:00
|
|
|
"If non-nil, automatically list possibilities on partial completion.
|
2000-06-23 05:24:10 +00:00
|
|
|
This mirrors the optional behavior of tcsh."
|
|
|
|
:type 'boolean
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
2004-10-27 15:05:12 +00:00
|
|
|
(defcustom pcomplete-suffix-list (list ?/ ?:)
|
2008-12-03 05:48:14 +00:00
|
|
|
"A list of characters which constitute a proper suffix."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type '(repeat character)
|
|
|
|
:group 'pcomplete)
|
2011-06-17 18:52:46 +00:00
|
|
|
(make-obsolete-variable 'pcomplete-suffix-list nil "24.1")
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(defcustom pcomplete-recexact nil
|
2008-12-03 05:48:14 +00:00
|
|
|
"If non-nil, use shortest completion if characters cannot be added.
|
2000-06-23 05:24:10 +00:00
|
|
|
This mirrors the optional behavior of tcsh.
|
|
|
|
|
|
|
|
A non-nil value is useful if `pcomplete-autolist' is non-nil too."
|
|
|
|
:type 'boolean
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
2012-04-25 18:53:57 +00:00
|
|
|
(define-obsolete-variable-alias
|
2012-08-15 16:29:11 +00:00
|
|
|
'pcomplete-arg-quote-list 'comint-file-name-quote-list "24.3")
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(defcustom pcomplete-man-function 'man
|
2008-12-03 05:48:14 +00:00
|
|
|
"A function to that will be called to display a manual page.
|
2000-06-23 05:24:10 +00:00
|
|
|
It will be passed the name of the command to document."
|
|
|
|
:type 'function
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
|
|
|
(defcustom pcomplete-compare-entry-function 'string-lessp
|
2008-12-03 05:48:14 +00:00
|
|
|
"This function is used to order file entries for completion.
|
2000-06-23 05:24:10 +00:00
|
|
|
The behavior of most all shells is to sort alphabetically."
|
|
|
|
:type '(radio (function-item string-lessp)
|
|
|
|
(function-item file-newer-than-file-p)
|
|
|
|
(function :tag "Other"))
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
|
|
|
(defcustom pcomplete-help nil
|
2008-12-03 05:48:14 +00:00
|
|
|
"A string or function (or nil) used for context-sensitive help.
|
2000-06-23 05:24:10 +00:00
|
|
|
If a string, it should name an Info node that will be jumped to.
|
|
|
|
If non-nil, it must a sexp that will be evaluated, and whose
|
|
|
|
result will be shown in the minibuffer.
|
|
|
|
If nil, the function `pcomplete-man-function' will be called with the
|
|
|
|
current command argument."
|
|
|
|
:type '(choice string sexp (const :tag "Use man page" nil))
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
|
|
|
(defcustom pcomplete-expand-before-complete nil
|
2008-12-03 05:48:14 +00:00
|
|
|
"If non-nil, expand the current argument before completing it.
|
Prefer directed to neutral quotes
Prefer directed to neutral quotes in docstings and diagnostics.
In docstrings, escape apostrophes that would otherwise be translated
to curved quotes using the newer, simpler rules.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-lang.el (math-read-giac-subscr)
(math-read-math-subscr):
* lisp/calc/calc-misc.el (report-calc-bug):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/dabbrev.el (dabbrev-expand):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/elint.el (elint-get-top-forms):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emulation/viper-cmd.el (viper-toggle-search-style):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-arg.el (eshell-parse-arguments):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/files-x.el (modify-file-local-variable):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer)
(filesets-update-pre010505):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/gnus/auth-source.el (auth-source-netrc-parse-entries):
* lisp/gnus/gnus-agent.el (gnus-agent-check-overview-buffer)
(gnus-agent-fetch-headers):
* lisp/gnus/gnus-int.el (gnus-start-news-server):
* lisp/gnus/gnus-registry.el:
(gnus-registry--split-fancy-with-parent-internal):
* lisp/gnus/gnus-score.el (gnus-summary-increase-score):
* lisp/gnus/gnus-start.el (gnus-convert-old-newsrc):
* lisp/gnus/gnus-topic.el (gnus-topic-rename):
* lisp/gnus/legacy-gnus-agent.el (gnus-agent-unlist-expire-days):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/gnus/spam.el (spam-check-blackholes):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/tramp-cache.el:
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-bibtex.el (org-bibtex-fields):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/play/dunnet.el (dun-score, dun-help, dun-endgame-question)
(dun-rooms, dun-endgame-questions):
* lisp/progmodes/ada-mode.el (ada-goto-matching-start):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/antlr-mode.el (antlr-options-alists):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/server.el (server-get-auth-key):
* lisp/subr.el (version-to-list):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/vc/ediff-diff.el (ediff-same-contents):
* lisp/vc/vc-cvs.el (vc-cvs-mode-line-string):
* test/automated/tramp-tests.el (tramp-test33-asynchronous-requests):
Use directed rather than neutral quotes in diagnostics.
2015-08-25 06:39:33 +00:00
|
|
|
This means that typing something such as `$HOME/bi' followed by
|
2000-06-23 05:24:10 +00:00
|
|
|
\\[pcomplete-argument] will cause the variable reference to be
|
|
|
|
resolved first, and the resultant value that will be completed against
|
|
|
|
to be inserted in the buffer. Note that exactly what gets expanded
|
|
|
|
and how is entirely up to the behavior of the
|
|
|
|
`pcomplete-parse-arguments-function'."
|
|
|
|
:type 'boolean
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
|
|
|
(defcustom pcomplete-parse-arguments-function
|
|
|
|
'pcomplete-parse-buffer-arguments
|
2008-12-03 05:48:14 +00:00
|
|
|
"A function to call to parse the current line's arguments.
|
2000-06-23 05:24:10 +00:00
|
|
|
It should be called with no parameters, and with point at the position
|
|
|
|
of the argument that is to be completed.
|
|
|
|
|
|
|
|
It must either return nil, or a cons cell of the form:
|
|
|
|
|
|
|
|
((ARG...) (BEG-POS...))
|
|
|
|
|
|
|
|
The two lists must be identical in length. The first gives the final
|
|
|
|
value of each command line argument (which need not match the textual
|
|
|
|
representation of that argument), and BEG-POS gives the beginning
|
|
|
|
position of each argument, as it is seen by the user. The establishes
|
|
|
|
a relationship between the fully resolved value of the argument, and
|
|
|
|
the textual representation of the argument."
|
|
|
|
:type 'function
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
|
|
|
(defcustom pcomplete-cycle-completions t
|
2008-12-03 05:48:14 +00:00
|
|
|
"If non-nil, hitting the TAB key cycles through the completion list.
|
2000-06-23 05:24:10 +00:00
|
|
|
Typical Emacs behavior is to complete as much as possible, then pause
|
|
|
|
waiting for further input. Then if TAB is hit again, show a list of
|
|
|
|
possible completions. When `pcomplete-cycle-completions' is non-nil,
|
|
|
|
it acts more like zsh or 4nt, showing the first maximal match first,
|
|
|
|
followed by any further matches on each subsequent pressing of the TAB
|
|
|
|
key. \\[pcomplete-list] is the key to press if the user wants to see
|
|
|
|
the list of possible completions."
|
|
|
|
:type 'boolean
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
|
|
|
(defcustom pcomplete-cycle-cutoff-length 5
|
2008-12-03 05:48:14 +00:00
|
|
|
"If the number of completions is greater than this, don't cycle.
|
2000-06-23 05:24:10 +00:00
|
|
|
This variable is a compromise between the traditional Emacs style of
|
|
|
|
completion, and the \"cycling\" style. Basically, if there are more
|
|
|
|
than this number of completions possible, don't automatically pick the
|
|
|
|
first one and then expect the user to press TAB to cycle through them.
|
|
|
|
Typically, when there are a large number of completion possibilities,
|
|
|
|
the user wants to see them in a list buffer so that they can know what
|
|
|
|
options are available. But if the list is small, it means the user
|
|
|
|
has already entered enough input to disambiguate most of the
|
|
|
|
possibilities, and therefore they are probably most interested in
|
|
|
|
cycling through the candidates. Set this value to nil if you want
|
|
|
|
cycling to always be enabled."
|
|
|
|
:type '(choice integer (const :tag "Always cycle" nil))
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
|
|
|
(defcustom pcomplete-restore-window-delay 1
|
2008-12-03 05:48:14 +00:00
|
|
|
"The number of seconds to wait before restoring completion windows.
|
2000-06-23 05:24:10 +00:00
|
|
|
Once the completion window has been displayed, if the user then goes
|
|
|
|
on to type something else, that completion window will be removed from
|
|
|
|
the display (actually, the original window configuration before it was
|
|
|
|
displayed will be restored), after this many seconds of idle time. If
|
|
|
|
set to nil, completion windows will be left on second until the user
|
|
|
|
removes them manually. If set to 0, they will disappear immediately
|
|
|
|
after the user enters a key other than TAB."
|
|
|
|
:type '(choice integer (const :tag "Never restore" nil))
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
|
|
|
(defcustom pcomplete-try-first-hook nil
|
2008-12-03 05:48:14 +00:00
|
|
|
"A list of functions which are called before completing an argument.
|
2000-06-23 05:24:10 +00:00
|
|
|
This can be used, for example, for completing things which might apply
|
|
|
|
to all arguments, such as variable names after a $."
|
|
|
|
:type 'hook
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
2007-11-19 08:50:04 +00:00
|
|
|
(defsubst pcomplete-executables (&optional regexp)
|
|
|
|
"Complete amongst a list of directories and executables."
|
|
|
|
(pcomplete-entries regexp 'file-executable-p))
|
|
|
|
|
2018-03-15 16:32:22 +00:00
|
|
|
(defmacro pcomplete-here (&optional form stub paring form-only)
|
|
|
|
"Complete against the current argument, if at the end.
|
|
|
|
If completion is to be done here, evaluate FORM to generate the completion
|
|
|
|
table which will be used for completion purposes. If STUB is a
|
|
|
|
string, use it as the completion stub instead of the default (which is
|
|
|
|
the entire text of the current argument).
|
|
|
|
|
|
|
|
For an example of when you might want to use STUB: if the current
|
|
|
|
argument text is `long-path-name/', you don't want the completions
|
|
|
|
list display to be cluttered by `long-path-name/' appearing at the
|
|
|
|
beginning of every alternative. Not only does this make things less
|
|
|
|
intelligible, but it is also inefficient. Yet, if the completion list
|
|
|
|
does not begin with this string for every entry, the current argument
|
|
|
|
won't complete correctly.
|
|
|
|
|
|
|
|
The solution is to specify a relative stub. It allows you to
|
|
|
|
substitute a different argument from the current argument, almost
|
|
|
|
always for the sake of efficiency.
|
|
|
|
|
|
|
|
If PARING is nil, this argument will be pared against previous
|
|
|
|
arguments using the function `file-truename' to normalize them.
|
|
|
|
PARING may be a function, in which case that function is used for
|
|
|
|
normalization. If PARING is t, the argument dealt with by this
|
|
|
|
call will not participate in argument paring. If it is the
|
|
|
|
integer 0, all previous arguments that have been seen will be
|
|
|
|
cleared.
|
|
|
|
|
|
|
|
If FORM-ONLY is non-nil, only the result of FORM will be used to
|
|
|
|
generate the completions list. This means that the hook
|
|
|
|
`pcomplete-try-first-hook' will not be run."
|
|
|
|
(declare (debug t))
|
|
|
|
`(pcomplete--here (lambda () ,form) ,stub ,paring ,form-only))
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
(defcustom pcomplete-command-completion-function
|
|
|
|
(function
|
|
|
|
(lambda ()
|
|
|
|
(pcomplete-here (pcomplete-executables))))
|
2008-12-03 05:48:14 +00:00
|
|
|
"Function called for completing the initial command argument."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'function
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
|
|
|
(defcustom pcomplete-command-name-function 'pcomplete-command-name
|
2008-12-03 05:48:14 +00:00
|
|
|
"Function called for determining the current command name."
|
2000-06-23 05:24:10 +00:00
|
|
|
:type 'function
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
|
|
|
(defcustom pcomplete-default-completion-function
|
|
|
|
(function
|
|
|
|
(lambda ()
|
|
|
|
(while (pcomplete-here (pcomplete-entries)))))
|
2008-12-03 05:48:14 +00:00
|
|
|
"Function called when no completion rule can be found.
|
2000-06-23 05:24:10 +00:00
|
|
|
This function is used to generate completions for every argument."
|
|
|
|
:type 'function
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
2000-08-29 00:47:45 +00:00
|
|
|
(defcustom pcomplete-use-paring t
|
2008-12-03 05:48:14 +00:00
|
|
|
"If t, pare alternatives that have already been used.
|
2000-08-29 00:47:45 +00:00
|
|
|
If nil, you will always see the completion set of possible options, no
|
|
|
|
matter which of those options have already been used in previous
|
|
|
|
command arguments."
|
|
|
|
:type 'boolean
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
2003-01-10 07:01:14 +00:00
|
|
|
(defcustom pcomplete-termination-string " "
|
2008-12-03 05:48:14 +00:00
|
|
|
"A string that is inserted after any completion or expansion.
|
2003-01-10 07:01:14 +00:00
|
|
|
This is usually a space character, useful when completing lists of
|
|
|
|
words separated by spaces. However, if your list uses a different
|
|
|
|
separator character, or if the completion occurs in a word that is
|
|
|
|
already terminated by a character, this variable should be locally
|
|
|
|
modified to be an empty string, or the desired separation string."
|
|
|
|
:type 'string
|
|
|
|
:group 'pcomplete)
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;;; Internal Variables:
|
|
|
|
|
|
|
|
;; for cycling completion support
|
|
|
|
(defvar pcomplete-current-completions nil)
|
|
|
|
(defvar pcomplete-last-completion-length)
|
|
|
|
(defvar pcomplete-last-completion-stub)
|
|
|
|
(defvar pcomplete-last-completion-raw)
|
|
|
|
(defvar pcomplete-last-window-config nil)
|
|
|
|
(defvar pcomplete-window-restore-timer nil)
|
|
|
|
|
|
|
|
(make-variable-buffer-local 'pcomplete-current-completions)
|
|
|
|
(make-variable-buffer-local 'pcomplete-last-completion-length)
|
|
|
|
(make-variable-buffer-local 'pcomplete-last-completion-stub)
|
|
|
|
(make-variable-buffer-local 'pcomplete-last-completion-raw)
|
|
|
|
(make-variable-buffer-local 'pcomplete-last-window-config)
|
|
|
|
(make-variable-buffer-local 'pcomplete-window-restore-timer)
|
|
|
|
|
|
|
|
;; used for altering pcomplete's behavior. These global variables
|
|
|
|
;; should always be nil.
|
|
|
|
(defvar pcomplete-show-help nil)
|
|
|
|
(defvar pcomplete-show-list nil)
|
|
|
|
(defvar pcomplete-expand-only-p nil)
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
;; for the sake of the bye-compiler, when compiling other files that
|
|
|
|
;; contain completion functions
|
|
|
|
(defvar pcomplete-args nil)
|
|
|
|
(defvar pcomplete-begins nil)
|
|
|
|
(defvar pcomplete-last nil)
|
|
|
|
(defvar pcomplete-index nil)
|
|
|
|
(defvar pcomplete-stub nil)
|
|
|
|
(defvar pcomplete-seen nil)
|
|
|
|
(defvar pcomplete-norm-func nil)
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;;; User Functions:
|
|
|
|
|
2009-10-25 20:38:06 +00:00
|
|
|
;;; Alternative front-end using the standard completion facilities.
|
|
|
|
|
|
|
|
;; The way pcomplete-parse-arguments, pcomplete-stub, and
|
|
|
|
;; pcomplete-quote-argument work only works because of some deep
|
|
|
|
;; hypothesis about the way the completion work. Basically, it makes
|
|
|
|
;; it pretty much impossible to have completion other than
|
|
|
|
;; prefix-completion.
|
|
|
|
;;
|
2012-04-25 18:53:57 +00:00
|
|
|
;; pcomplete--common-suffix and completion-table-subvert try to work around
|
|
|
|
;; this difficulty with heuristics, but it's really a hack.
|
|
|
|
|
|
|
|
(defvar pcomplete-unquote-argument-function #'comint--unquote-argument)
|
|
|
|
|
|
|
|
(defsubst pcomplete-unquote-argument (s)
|
|
|
|
(funcall pcomplete-unquote-argument-function s))
|
|
|
|
|
|
|
|
(defvar pcomplete-requote-argument-function #'comint--requote-argument)
|
|
|
|
|
|
|
|
(defun pcomplete--common-suffix (s1 s2)
|
|
|
|
;; Since S2 is expected to be the "unquoted/expanded" version of S1,
|
|
|
|
;; there shouldn't be any case difference, even if the completion is
|
|
|
|
;; case-insensitive.
|
|
|
|
(let ((case-fold-search nil))
|
|
|
|
(string-match
|
|
|
|
;; \x3FFF7F is just an arbitrary char among the ones Emacs accepts
|
|
|
|
;; that hopefully will never appear in normal text.
|
|
|
|
"\\(?:.\\|\n\\)*?\\(\\(?:.\\|\n\\)*\\)\x3FFF7F\\(?:.\\|\n\\)*\\1\\'"
|
|
|
|
(concat s1 "\x3FFF7F" s2))
|
|
|
|
(- (match-end 1) (match-beginning 1))))
|
|
|
|
|
2010-05-15 03:50:26 +00:00
|
|
|
(defun pcomplete-completions-at-point ()
|
2009-10-22 15:17:48 +00:00
|
|
|
"Provide standard completion using pcomplete's completion tables.
|
|
|
|
Same as `pcomplete' but using the standard completion UI."
|
2009-10-26 04:06:01 +00:00
|
|
|
;; FIXME: it only completes the text before point, whereas the
|
|
|
|
;; standard UI may also consider text after point.
|
2010-05-15 03:50:26 +00:00
|
|
|
;; FIXME: the `pcomplete' UI may be used internally during
|
|
|
|
;; pcomplete-completions and then throw to `pcompleted', thus
|
|
|
|
;; imposing the pcomplete UI over the standard UI.
|
2009-10-22 15:17:48 +00:00
|
|
|
(catch 'pcompleted
|
|
|
|
(let* ((pcomplete-stub)
|
|
|
|
pcomplete-seen pcomplete-norm-func
|
|
|
|
pcomplete-args pcomplete-last pcomplete-index
|
|
|
|
(pcomplete-autolist pcomplete-autolist)
|
|
|
|
(pcomplete-suffix-list pcomplete-suffix-list)
|
|
|
|
;; Apparently the vars above are global vars modified by
|
|
|
|
;; side-effects, whereas pcomplete-completions is the core
|
|
|
|
;; function that finds the chunk of text to complete
|
|
|
|
;; (returned indirectly in pcomplete-stub) and the set of
|
|
|
|
;; possible completions.
|
|
|
|
(completions (pcomplete-completions))
|
2009-10-23 17:37:09 +00:00
|
|
|
;; Usually there's some close connection between pcomplete-stub
|
|
|
|
;; and the text before point. But depending on what
|
|
|
|
;; pcomplete-parse-arguments-function does, that connection
|
|
|
|
;; might not be that close. E.g. in eshell,
|
|
|
|
;; pcomplete-parse-arguments-function expands envvars.
|
2011-04-19 13:44:55 +00:00
|
|
|
;;
|
2009-10-23 17:37:09 +00:00
|
|
|
;; Since we use minibuffer-complete, which doesn't know
|
|
|
|
;; pcomplete-stub and works from the buffer's text instead,
|
|
|
|
;; we need to trick minibuffer-complete, into using
|
|
|
|
;; pcomplete-stub without its knowledge. To that end, we
|
2012-04-25 18:53:57 +00:00
|
|
|
;; use completion-table-subvert to construct a completion
|
2009-10-23 17:37:09 +00:00
|
|
|
;; table which expects strings using a prefix from the
|
|
|
|
;; buffer's text but internally uses the corresponding
|
|
|
|
;; prefix from pcomplete-stub.
|
2019-03-20 16:30:53 +00:00
|
|
|
;;
|
|
|
|
(argbeg (pcomplete-begin))
|
|
|
|
;; When completing an envvar within an argument in Eshell
|
|
|
|
;; (e.g. "cd /home/$US TAB"), `pcomplete-stub' will just be
|
|
|
|
;; "US" whereas `argbeg' will point to the first "/".
|
|
|
|
;; We could rely on c-t-subvert to handle the difference,
|
|
|
|
;; but we try here to guess the "real" beginning so as to
|
|
|
|
;; rely less on c-t-subvert.
|
2009-10-23 17:37:09 +00:00
|
|
|
(beg (max (- (point) (length pcomplete-stub))
|
2019-03-20 16:30:53 +00:00
|
|
|
argbeg))
|
|
|
|
buftext)
|
|
|
|
;; Try and improve our guess of `beg' in case the difference
|
|
|
|
;; between pcomplete-stub and the buffer's text is simply due to
|
|
|
|
;; some chars removed by unquoting. Again, this is not
|
|
|
|
;; indispensable but reduces the reliance on c-t-subvert and
|
|
|
|
;; improves corner case behaviors.
|
|
|
|
(while (progn (setq buftext (pcomplete-unquote-argument
|
|
|
|
(buffer-substring beg (point))))
|
|
|
|
(and (> beg argbeg)
|
|
|
|
(> (length pcomplete-stub) (length buftext))))
|
|
|
|
(setq beg (max argbeg (- beg (- (length pcomplete-stub)
|
|
|
|
(length buftext))))))
|
2011-04-28 19:39:11 +00:00
|
|
|
(when completions
|
|
|
|
(let ((table
|
2012-04-25 18:53:57 +00:00
|
|
|
(completion-table-with-quoting
|
|
|
|
(if (equal pcomplete-stub buftext)
|
|
|
|
completions
|
|
|
|
;; This may not always be strictly right, but given the lack
|
|
|
|
;; of any other info, it's about as good as it gets, and in
|
|
|
|
;; practice it should work just fine (fingers crossed).
|
|
|
|
(let ((suf-len (pcomplete--common-suffix
|
2011-04-28 19:39:11 +00:00
|
|
|
pcomplete-stub buftext)))
|
2012-04-25 18:53:57 +00:00
|
|
|
(completion-table-subvert
|
|
|
|
completions
|
|
|
|
(substring buftext 0 (- (length buftext) suf-len))
|
|
|
|
(substring pcomplete-stub 0
|
|
|
|
(- (length pcomplete-stub) suf-len)))))
|
|
|
|
pcomplete-unquote-argument-function
|
|
|
|
pcomplete-requote-argument-function))
|
2011-04-28 19:39:11 +00:00
|
|
|
(pred
|
|
|
|
;; Pare it down, if applicable.
|
|
|
|
(when (and pcomplete-use-paring pcomplete-seen)
|
2011-06-17 18:52:46 +00:00
|
|
|
;; Capture the dynbound values for later use.
|
|
|
|
(let ((norm-func pcomplete-norm-func)
|
2011-09-20 01:06:29 +00:00
|
|
|
(seen
|
|
|
|
(mapcar (lambda (f)
|
|
|
|
(funcall pcomplete-norm-func
|
|
|
|
(directory-file-name f)))
|
|
|
|
pcomplete-seen)))
|
2011-06-17 18:52:46 +00:00
|
|
|
(lambda (f)
|
|
|
|
(not (member
|
|
|
|
(funcall norm-func (directory-file-name f))
|
|
|
|
seen)))))))
|
2011-04-28 19:39:11 +00:00
|
|
|
(when pcomplete-ignore-case
|
2011-10-03 15:03:00 +00:00
|
|
|
(setq table (completion-table-case-fold table)))
|
2011-05-24 02:45:50 +00:00
|
|
|
(list beg (point) table
|
|
|
|
:predicate pred
|
|
|
|
:exit-function
|
2012-09-17 14:45:51 +00:00
|
|
|
;; If completion is finished, add a terminating space.
|
|
|
|
;; We used to also do this if STATUS is `sole', but
|
|
|
|
;; that does not work right when completion cycling.
|
2011-05-24 02:45:50 +00:00
|
|
|
(unless (zerop (length pcomplete-termination-string))
|
2012-09-17 14:45:51 +00:00
|
|
|
(lambda (_s status)
|
|
|
|
(when (eq status 'finished)
|
2011-05-24 02:45:50 +00:00
|
|
|
(if (looking-at
|
|
|
|
(regexp-quote pcomplete-termination-string))
|
|
|
|
(goto-char (match-end 0))
|
|
|
|
(insert pcomplete-termination-string)))))))))))
|
2010-05-15 03:50:26 +00:00
|
|
|
|
|
|
|
;; I don't think such commands are usable before first setting up buffer-local
|
|
|
|
;; variables to parse args, so there's no point autoloading it.
|
|
|
|
;; ;;;###autoload
|
|
|
|
(defun pcomplete-std-complete ()
|
2011-04-29 17:33:30 +00:00
|
|
|
(let ((data (pcomplete-completions-at-point)))
|
2011-04-29 17:24:09 +00:00
|
|
|
(completion-in-region (nth 0 data) (nth 1 data) (nth 2 data)
|
|
|
|
(plist-get :predicate (nthcdr 3 data)))))
|
2009-10-22 15:17:48 +00:00
|
|
|
|
2009-10-25 20:38:06 +00:00
|
|
|
;;; Pcomplete's native UI.
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete (&optional interactively)
|
|
|
|
"Support extensible programmable completion.
|
|
|
|
To use this function, just bind the TAB key to it, or add it to your
|
|
|
|
completion functions list (it should occur fairly early in the list)."
|
|
|
|
(interactive "p")
|
|
|
|
(if (and interactively
|
|
|
|
pcomplete-cycle-completions
|
|
|
|
pcomplete-current-completions
|
|
|
|
(memq last-command '(pcomplete
|
|
|
|
pcomplete-expand-and-complete
|
|
|
|
pcomplete-reverse)))
|
|
|
|
(progn
|
Replace Lisp calls to delete-backward-char by delete-char.
* bs.el, expand.el, ido.el, image-dired.el, lpr.el, pcomplete.el,
skeleton.el, term.el, time.el, wid-edit.el, woman.el,
calc/calc-graph.el, calc/calc-help.el, calc/calc-incom.el,
calc/calc.el, emacs-cl-extra.el, emacs-cl-loaddefs.el,
emulation/cua-rect.el, emulation/viper-ex.el, eshell/esh-test.el,
eshell/eshell.el, gnus/gnus-uu.el, gnus/nndoc.el, gnus/nnrss.el,
gnus/rfc2047.el, gnus/utf7.el, international/utf-7.el,
language/ethio-util.el, mh-e/mh-alias.el, mh-e/mh-search.el,
net/imap.el, net/rcirc.el, obsolete/complete.el, play/decipher.el,
progmodes/ada-mode.el, progmodes/cc-awk.el, progmodes/dcl-mode.el,
progmodes/ps-mode.el, progmodes/verilog-mode.el,
progmodes/vhdl-mode.el, textmodes/bibtex.el, textmodes/fill.el,
textmodes/reftex-auc.el, textmodes/rst.el, textmodes/sgml-mode.el,
textmodes/table.el, textmodes/texinfmt.el: Replace Lisp calls to
delete-backward-char by calls to delete-char.
2010-05-25 02:11:08 +00:00
|
|
|
(delete-char (- pcomplete-last-completion-length))
|
2009-10-25 20:38:06 +00:00
|
|
|
(if (eq this-command 'pcomplete-reverse)
|
|
|
|
(progn
|
2009-10-26 04:06:01 +00:00
|
|
|
(push (car (last pcomplete-current-completions))
|
|
|
|
pcomplete-current-completions)
|
2009-10-25 20:38:06 +00:00
|
|
|
(setcdr (last pcomplete-current-completions 2) nil))
|
|
|
|
(nconc pcomplete-current-completions
|
|
|
|
(list (car pcomplete-current-completions)))
|
|
|
|
(setq pcomplete-current-completions
|
|
|
|
(cdr pcomplete-current-completions)))
|
|
|
|
(pcomplete-insert-entry pcomplete-last-completion-stub
|
|
|
|
(car pcomplete-current-completions)
|
|
|
|
nil pcomplete-last-completion-raw))
|
|
|
|
(setq pcomplete-current-completions nil
|
|
|
|
pcomplete-last-completion-raw nil)
|
|
|
|
(catch 'pcompleted
|
|
|
|
(let* ((pcomplete-stub)
|
|
|
|
pcomplete-seen pcomplete-norm-func
|
|
|
|
pcomplete-args pcomplete-last pcomplete-index
|
|
|
|
(pcomplete-autolist pcomplete-autolist)
|
|
|
|
(pcomplete-suffix-list pcomplete-suffix-list)
|
|
|
|
(completions (pcomplete-completions))
|
|
|
|
(result (pcomplete-do-complete pcomplete-stub completions)))
|
|
|
|
(and result
|
|
|
|
(not (eq (car result) 'listed))
|
|
|
|
(cdr result)
|
|
|
|
(pcomplete-insert-entry pcomplete-stub (cdr result)
|
|
|
|
(memq (car result)
|
|
|
|
'(sole shortest))
|
|
|
|
pcomplete-last-completion-raw))))))
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete-reverse ()
|
|
|
|
"If cycling completion is in use, cycle backwards."
|
|
|
|
(interactive)
|
|
|
|
(call-interactively 'pcomplete))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete-expand-and-complete ()
|
|
|
|
"Expand the textual value of the current argument.
|
|
|
|
This will modify the current buffer."
|
|
|
|
(interactive)
|
|
|
|
(let ((pcomplete-expand-before-complete t))
|
|
|
|
(pcomplete)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete-continue ()
|
|
|
|
"Complete without reference to any cycling completions."
|
|
|
|
(interactive)
|
|
|
|
(setq pcomplete-current-completions nil
|
|
|
|
pcomplete-last-completion-raw nil)
|
|
|
|
(call-interactively 'pcomplete))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete-expand ()
|
|
|
|
"Expand the textual value of the current argument.
|
|
|
|
This will modify the current buffer."
|
|
|
|
(interactive)
|
|
|
|
(let ((pcomplete-expand-before-complete t)
|
|
|
|
(pcomplete-expand-only-p t))
|
|
|
|
(pcomplete)
|
|
|
|
(when (and pcomplete-current-completions
|
2009-10-22 15:17:48 +00:00
|
|
|
(> (length pcomplete-current-completions) 0)) ;??
|
Replace Lisp calls to delete-backward-char by delete-char.
* bs.el, expand.el, ido.el, image-dired.el, lpr.el, pcomplete.el,
skeleton.el, term.el, time.el, wid-edit.el, woman.el,
calc/calc-graph.el, calc/calc-help.el, calc/calc-incom.el,
calc/calc.el, emacs-cl-extra.el, emacs-cl-loaddefs.el,
emulation/cua-rect.el, emulation/viper-ex.el, eshell/esh-test.el,
eshell/eshell.el, gnus/gnus-uu.el, gnus/nndoc.el, gnus/nnrss.el,
gnus/rfc2047.el, gnus/utf7.el, international/utf-7.el,
language/ethio-util.el, mh-e/mh-alias.el, mh-e/mh-search.el,
net/imap.el, net/rcirc.el, obsolete/complete.el, play/decipher.el,
progmodes/ada-mode.el, progmodes/cc-awk.el, progmodes/dcl-mode.el,
progmodes/ps-mode.el, progmodes/verilog-mode.el,
progmodes/vhdl-mode.el, textmodes/bibtex.el, textmodes/fill.el,
textmodes/reftex-auc.el, textmodes/rst.el, textmodes/sgml-mode.el,
textmodes/table.el, textmodes/texinfmt.el: Replace Lisp calls to
delete-backward-char by calls to delete-char.
2010-05-25 02:11:08 +00:00
|
|
|
(delete-char (- pcomplete-last-completion-length))
|
2000-06-23 05:24:10 +00:00
|
|
|
(while pcomplete-current-completions
|
|
|
|
(unless (pcomplete-insert-entry
|
|
|
|
"" (car pcomplete-current-completions) t
|
2009-10-22 15:17:48 +00:00
|
|
|
pcomplete-last-completion-raw)
|
2003-01-10 07:01:14 +00:00
|
|
|
(insert-and-inherit pcomplete-termination-string))
|
2000-06-23 05:24:10 +00:00
|
|
|
(setq pcomplete-current-completions
|
|
|
|
(cdr pcomplete-current-completions))))))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete-help ()
|
|
|
|
"Display any help information relative to the current argument."
|
|
|
|
(interactive)
|
|
|
|
(let ((pcomplete-show-help t))
|
|
|
|
(pcomplete)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete-list ()
|
|
|
|
"Show the list of possible completions for the current argument."
|
|
|
|
(interactive)
|
|
|
|
(when (and pcomplete-cycle-completions
|
|
|
|
pcomplete-current-completions
|
|
|
|
(eq last-command 'pcomplete-argument))
|
Replace Lisp calls to delete-backward-char by delete-char.
* bs.el, expand.el, ido.el, image-dired.el, lpr.el, pcomplete.el,
skeleton.el, term.el, time.el, wid-edit.el, woman.el,
calc/calc-graph.el, calc/calc-help.el, calc/calc-incom.el,
calc/calc.el, emacs-cl-extra.el, emacs-cl-loaddefs.el,
emulation/cua-rect.el, emulation/viper-ex.el, eshell/esh-test.el,
eshell/eshell.el, gnus/gnus-uu.el, gnus/nndoc.el, gnus/nnrss.el,
gnus/rfc2047.el, gnus/utf7.el, international/utf-7.el,
language/ethio-util.el, mh-e/mh-alias.el, mh-e/mh-search.el,
net/imap.el, net/rcirc.el, obsolete/complete.el, play/decipher.el,
progmodes/ada-mode.el, progmodes/cc-awk.el, progmodes/dcl-mode.el,
progmodes/ps-mode.el, progmodes/verilog-mode.el,
progmodes/vhdl-mode.el, textmodes/bibtex.el, textmodes/fill.el,
textmodes/reftex-auc.el, textmodes/rst.el, textmodes/sgml-mode.el,
textmodes/table.el, textmodes/texinfmt.el: Replace Lisp calls to
delete-backward-char by calls to delete-char.
2010-05-25 02:11:08 +00:00
|
|
|
(delete-char (- pcomplete-last-completion-length))
|
2000-06-23 05:24:10 +00:00
|
|
|
(setq pcomplete-current-completions nil
|
|
|
|
pcomplete-last-completion-raw nil))
|
|
|
|
(let ((pcomplete-show-list t))
|
|
|
|
(pcomplete)))
|
|
|
|
|
|
|
|
;;; Internal Functions:
|
|
|
|
|
|
|
|
;; argument handling
|
|
|
|
(defun pcomplete-arg (&optional index offset)
|
|
|
|
"Return the textual content of the INDEXth argument.
|
|
|
|
INDEX is based from the current processing position. If INDEX is
|
|
|
|
positive, values returned are closer to the command argument; if
|
|
|
|
negative, they are closer to the last argument. If the INDEX is
|
|
|
|
outside of the argument list, nil is returned. The default value for
|
|
|
|
INDEX is 0, meaning the current argument being examined.
|
|
|
|
|
|
|
|
The special indices `first' and `last' may be used to access those
|
|
|
|
parts of the list.
|
|
|
|
|
|
|
|
The OFFSET argument is added to/taken away from the index that will be
|
|
|
|
used. This is really only useful with `first' and `last', for
|
|
|
|
accessing absolute argument positions."
|
|
|
|
(setq index
|
|
|
|
(if (eq index 'first)
|
|
|
|
0
|
|
|
|
(if (eq index 'last)
|
|
|
|
pcomplete-last
|
|
|
|
(- pcomplete-index (or index 0)))))
|
|
|
|
(if offset
|
|
|
|
(setq index (+ index offset)))
|
|
|
|
(nth index pcomplete-args))
|
|
|
|
|
|
|
|
(defun pcomplete-begin (&optional index offset)
|
|
|
|
"Return the beginning position of the INDEXth argument.
|
|
|
|
See the documentation for `pcomplete-arg'."
|
|
|
|
(setq index
|
|
|
|
(if (eq index 'first)
|
|
|
|
0
|
|
|
|
(if (eq index 'last)
|
|
|
|
pcomplete-last
|
|
|
|
(- pcomplete-index (or index 0)))))
|
|
|
|
(if offset
|
|
|
|
(setq index (+ index offset)))
|
|
|
|
(nth index pcomplete-begins))
|
|
|
|
|
|
|
|
(defsubst pcomplete-actual-arg (&optional index offset)
|
|
|
|
"Return the actual text representation of the last argument.
|
2004-04-23 21:34:46 +00:00
|
|
|
This is different from `pcomplete-arg', which returns the textual value
|
2000-06-23 05:24:10 +00:00
|
|
|
that the last argument evaluated to. This function returns what the
|
|
|
|
user actually typed in."
|
|
|
|
(buffer-substring (pcomplete-begin index offset) (point)))
|
|
|
|
|
|
|
|
(defsubst pcomplete-next-arg ()
|
|
|
|
"Move the various pointers to the next argument."
|
|
|
|
(setq pcomplete-index (1+ pcomplete-index)
|
|
|
|
pcomplete-stub (pcomplete-arg))
|
|
|
|
(if (> pcomplete-index pcomplete-last)
|
|
|
|
(progn
|
|
|
|
(message "No completions")
|
|
|
|
(throw 'pcompleted nil))))
|
|
|
|
|
|
|
|
(defun pcomplete-command-name ()
|
|
|
|
"Return the command name of the first argument."
|
|
|
|
(file-name-nondirectory (pcomplete-arg 'first)))
|
|
|
|
|
|
|
|
(defun pcomplete-match (regexp &optional index offset start)
|
|
|
|
"Like `string-match', but on the current completion argument."
|
|
|
|
(let ((arg (pcomplete-arg (or index 1) offset)))
|
|
|
|
(if arg
|
|
|
|
(string-match regexp arg start)
|
|
|
|
(throw 'pcompleted nil))))
|
|
|
|
|
|
|
|
(defun pcomplete-match-string (which &optional index offset)
|
2004-04-23 21:34:46 +00:00
|
|
|
"Like `match-string', but on the current completion argument."
|
2000-06-23 05:24:10 +00:00
|
|
|
(let ((arg (pcomplete-arg (or index 1) offset)))
|
|
|
|
(if arg
|
|
|
|
(match-string which arg)
|
|
|
|
(throw 'pcompleted nil))))
|
|
|
|
|
|
|
|
(defalias 'pcomplete-match-beginning 'match-beginning)
|
|
|
|
(defalias 'pcomplete-match-end 'match-end)
|
|
|
|
|
|
|
|
(defsubst pcomplete--test (pred arg)
|
|
|
|
"Perform a programmable completion predicate match."
|
|
|
|
(and pred
|
|
|
|
(cond ((eq pred t) t)
|
|
|
|
((functionp pred)
|
|
|
|
(funcall pred arg))
|
|
|
|
((stringp pred)
|
|
|
|
(string-match (concat "^" pred "$") arg)))
|
|
|
|
pred))
|
|
|
|
|
|
|
|
(defun pcomplete-test (predicates &optional index offset)
|
|
|
|
"Predicates to test the current programmable argument with."
|
|
|
|
(let ((arg (pcomplete-arg (or index 1) offset)))
|
|
|
|
(unless (null predicates)
|
|
|
|
(if (not (listp predicates))
|
|
|
|
(pcomplete--test predicates arg)
|
|
|
|
(let ((pred predicates)
|
|
|
|
found)
|
|
|
|
(while (and pred (not found))
|
|
|
|
(setq found (pcomplete--test (car pred) arg)
|
|
|
|
pred (cdr pred)))
|
|
|
|
found)))))
|
|
|
|
|
|
|
|
(defun pcomplete-parse-buffer-arguments ()
|
|
|
|
"Parse whitespace separated arguments in the current region."
|
|
|
|
(let ((begin (point-min))
|
|
|
|
(end (point-max))
|
|
|
|
begins args)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char begin)
|
|
|
|
(while (< (point) end)
|
|
|
|
(skip-chars-forward " \t\n")
|
2009-10-26 04:06:01 +00:00
|
|
|
(push (point) begins)
|
2000-06-23 05:24:10 +00:00
|
|
|
(skip-chars-forward "^ \t\n")
|
2009-10-26 04:06:01 +00:00
|
|
|
(push (buffer-substring-no-properties
|
|
|
|
(car begins) (point))
|
|
|
|
args))
|
|
|
|
(cons (nreverse args) (nreverse begins)))))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete-comint-setup (completef-sym)
|
|
|
|
"Setup a comint buffer to use pcomplete.
|
|
|
|
COMPLETEF-SYM should be the symbol where the
|
2004-04-23 21:34:46 +00:00
|
|
|
dynamic-complete-functions are kept. For comint mode itself,
|
|
|
|
this is `comint-dynamic-complete-functions'."
|
2000-06-23 05:24:10 +00:00
|
|
|
(set (make-local-variable 'pcomplete-parse-arguments-function)
|
|
|
|
'pcomplete-parse-comint-arguments)
|
2011-06-17 18:52:46 +00:00
|
|
|
(add-hook 'completion-at-point-functions
|
|
|
|
'pcomplete-completions-at-point nil 'local)
|
2009-10-23 17:37:09 +00:00
|
|
|
(set (make-local-variable completef-sym)
|
|
|
|
(copy-sequence (symbol-value completef-sym)))
|
2009-07-12 16:20:50 +00:00
|
|
|
(let* ((funs (symbol-value completef-sym))
|
2011-04-28 00:18:12 +00:00
|
|
|
(elem (or (memq 'comint-filename-completion funs)
|
|
|
|
(memq 'shell-filename-completion funs)
|
|
|
|
(memq 'shell-dynamic-complete-filename funs)
|
2009-10-28 13:59:30 +00:00
|
|
|
(memq 'comint-dynamic-complete-filename funs))))
|
2000-06-23 05:24:10 +00:00
|
|
|
(if elem
|
|
|
|
(setcar elem 'pcomplete)
|
2002-07-31 23:32:14 +00:00
|
|
|
(add-to-list completef-sym 'pcomplete))))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun pcomplete-shell-setup ()
|
2009-10-22 15:17:48 +00:00
|
|
|
"Setup `shell-mode' to use pcomplete."
|
2009-10-25 20:38:06 +00:00
|
|
|
;; FIXME: insufficient
|
2009-10-23 17:37:09 +00:00
|
|
|
(pcomplete-comint-setup 'comint-dynamic-complete-functions))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2007-11-19 08:50:04 +00:00
|
|
|
(declare-function comint-bol "comint" (&optional arg))
|
|
|
|
|
2000-06-23 05:24:10 +00:00
|
|
|
(defun pcomplete-parse-comint-arguments ()
|
|
|
|
"Parse whitespace separated arguments in the current region."
|
Use declare forms, where possible, to mark obsolete functions.
* lisp/allout.el (allout-passphrase-hint-string): Likewise.
(allout-init): Use a declare form to mark obsolete.
* lisp/calendar/calendar.el (calendar-version):
* lisp/calendar/icalendar.el (icalendar-extract-ical-from-buffer)
(icalendar-convert-diary-to-ical):
* lisp/cus-edit.el (custom-mode):
* lisp/ansi-color.el (ansi-color-unfontify-region):
* lisp/international/latin1-disp.el (latin1-char-displayable-p):
* lisp/progmodes/cwarn.el (turn-on-cwarn-mode):
* lisp/progmodes/which-func.el (which-func-update-1): Use
define-obsolete-function-alias.
* lisp/bookmark.el (bookmark-jump-noselect): Use a declare form to mark
this function obsolete.
* lisp/calendar/cal-x.el (calendar-two-frame-setup)
(calendar-only-one-frame-setup, calendar-one-frame-setup):
* lisp/calendar/calendar.el (american-calendar, european-calendar)
(calendar-for-loop):
* lisp/comint.el (comint-dynamic-simple-complete)
(comint-dynamic-complete-as-filename, comint-unquote-filename):
* lisp/desktop.el (desktop-load-default):
* lisp/dired-x.el (dired-omit-here-always)
(dired-hack-local-variables, dired-default-directory):
* lisp/emacs-lisp/derived.el (derived-mode-class):
* lisp/emacs-lisp/timer.el (timer-set-time-with-usecs):
* lisp/emacs-lock.el (toggle-emacs-lock):
* lisp/epa.el (epa-display-verify-result):
* lisp/epg.el (epg-sign-keys, epg-start-sign-keys)
(epg-passphrase-callback-function):
* lisp/eshell/esh-util.el (eshell-for):
* lisp/eshell/eshell.el (eshell-remove-from-window-buffer-names)
(eshell-add-to-window-buffer-names):
* lisp/files.el (locate-file-completion):
* lisp/imenu.el (imenu-example--create-c-index)
(imenu-example--create-lisp-index)
(imenu-example--lisp-extract-index-name)
(imenu-example--name-and-position):
* lisp/international/mule-cmds.el (princ-list):
* lisp/international/mule-diag.el (decode-codepage-char):
* lisp/international/mule-util.el (detect-coding-with-priority):
* lisp/iswitchb.el (iswitchb-read-buffer):
* lisp/mail/mailalias.el (mail-complete):
* lisp/mail/sendmail.el (mail-sent-via):
* lisp/mouse.el (mouse-popup-menubar-stuff, mouse-popup-menubar)
(mouse-major-mode-menu):
* lisp/password-cache.el (password-read-and-add):
* lisp/pcomplete.el (pcomplete-parse-comint-arguments):
* lisp/progmodes/sh-script.el (sh-maybe-here-document):
* lisp/replace.el (query-replace-regexp-eval):
* lisp/savehist.el (savehist-load):
* lisp/simple.el (choose-completion-delete-max-match):
* lisp/term.el (term-dynamic-simple-complete):
* lisp/vc/ediff-init.el (ediff-check-version):
* lisp/vc/ediff-wind.el (ediff-choose-window-setup-function-automatically):
* lisp/vc/vc.el (vc-diff-switches-list):
* lisp/view.el (view-return-to-alist-update): Likewise.
* lisp/iswitchb.el (iswitchb-read-buffer): Move code of
iswitchb-define-mode-map here, and delete that obsolete function.
* lisp/subr.el (eval-next-after-load, makehash, insert-string)
(assoc-ignore-representation, assoc-ignore-case): Use declare to
mark obsolete.
(mode-line-inverse-video): Variable deleted.
* lisp/emacs-lisp/byte-run.el (make-obsolete): Doc fix; emphasize that
this applies to functions.
* lisp/erc/erc.el (erc-send-command): Use define-obsolete-function-alias.
* lisp/international/mule-util.el (string-to-sequence): Remove.
* lisp/net/newst-backend.el (newsticker-cache-filename):
* lisp/net/newst-treeview.el (newsticker-groups-filename): Fix
incorrect obsolescence declaration.
* lisp/net/snmp-mode.el (snmp-font-lock-keywords-3): Don't use obsolete
font-lock-reference-face.
* lisp/url/url-parse.el (url-recreate-url-attributes):
* lisp/url/url-util.el (url-generate-unique-filename): Use declare to mark
obsolete.
* src/xdisp.c (mode_line_inverse_video): Delete obsolete variable.
2012-09-25 04:13:02 +00:00
|
|
|
(declare (obsolete comint-parse-pcomplete-arguments "24.1"))
|
2000-06-23 05:24:10 +00:00
|
|
|
(let ((begin (save-excursion (comint-bol nil) (point)))
|
|
|
|
(end (point))
|
|
|
|
begins args)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char begin)
|
|
|
|
(while (< (point) end)
|
|
|
|
(skip-chars-forward " \t\n")
|
2009-10-23 17:37:09 +00:00
|
|
|
(push (point) begins)
|
2011-08-23 05:21:09 +00:00
|
|
|
(while
|
|
|
|
(progn
|
2019-03-20 16:23:05 +00:00
|
|
|
(skip-chars-forward "^ \t\n\\\\")
|
2011-08-23 05:21:09 +00:00
|
|
|
(when (eq (char-after) ?\\)
|
|
|
|
(forward-char 1)
|
|
|
|
(unless (eolp)
|
|
|
|
(forward-char 1)
|
|
|
|
t))))
|
2009-10-23 17:37:09 +00:00
|
|
|
(push (buffer-substring-no-properties (car begins) (point))
|
|
|
|
args))
|
|
|
|
(cons (nreverse args) (nreverse begins)))))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(defun pcomplete-parse-arguments (&optional expand-p)
|
|
|
|
"Parse the command line arguments. Most completions need this info."
|
|
|
|
(let ((results (funcall pcomplete-parse-arguments-function)))
|
|
|
|
(when results
|
|
|
|
(setq pcomplete-args (or (car results) (list ""))
|
|
|
|
pcomplete-begins (or (cdr results) (list (point)))
|
|
|
|
pcomplete-last (1- (length pcomplete-args))
|
|
|
|
pcomplete-index 0
|
|
|
|
pcomplete-stub (pcomplete-arg 'last))
|
|
|
|
(let ((begin (pcomplete-begin 'last)))
|
2015-01-16 02:35:51 +00:00
|
|
|
(if (and (listp pcomplete-stub) ;??
|
2000-06-23 05:24:10 +00:00
|
|
|
(not pcomplete-expand-only-p))
|
2009-10-23 17:37:09 +00:00
|
|
|
(let* ((completions pcomplete-stub) ;??
|
2000-06-23 05:24:10 +00:00
|
|
|
(common-stub (car completions))
|
|
|
|
(c completions)
|
|
|
|
(len (length common-stub)))
|
|
|
|
(while (and c (> len 0))
|
|
|
|
(while (and (> len 0)
|
|
|
|
(not (string=
|
|
|
|
(substring common-stub 0 len)
|
|
|
|
(substring (car c) 0
|
|
|
|
(min (length (car c))
|
|
|
|
len)))))
|
|
|
|
(setq len (1- len)))
|
|
|
|
(setq c (cdr c)))
|
|
|
|
(setq pcomplete-stub (substring common-stub 0 len)
|
|
|
|
pcomplete-autolist t)
|
2017-11-05 16:36:20 +00:00
|
|
|
(when (and begin (> len 0) (not pcomplete-show-list))
|
2000-06-23 05:24:10 +00:00
|
|
|
(delete-region begin (point))
|
|
|
|
(pcomplete-insert-entry "" pcomplete-stub))
|
|
|
|
(throw 'pcomplete-completions completions))
|
|
|
|
(when expand-p
|
|
|
|
(if (stringp pcomplete-stub)
|
|
|
|
(when begin
|
|
|
|
(delete-region begin (point))
|
|
|
|
(insert-and-inherit pcomplete-stub))
|
|
|
|
(if (and (listp pcomplete-stub)
|
|
|
|
pcomplete-expand-only-p)
|
|
|
|
;; this is for the benefit of `pcomplete-expand'
|
|
|
|
(setq pcomplete-last-completion-length (- (point) begin)
|
|
|
|
pcomplete-current-completions pcomplete-stub)
|
|
|
|
(error "Cannot expand argument"))))
|
|
|
|
(if pcomplete-expand-only-p
|
|
|
|
(throw 'pcompleted t)
|
|
|
|
pcomplete-args))))))
|
|
|
|
|
2012-04-25 18:53:57 +00:00
|
|
|
(define-obsolete-function-alias
|
2012-08-15 16:29:11 +00:00
|
|
|
'pcomplete-quote-argument #'comint-quote-filename "24.3")
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;; file-system completion lists
|
|
|
|
|
|
|
|
(defsubst pcomplete-dirs-or-entries (&optional regexp predicate)
|
|
|
|
"Return either directories, or qualified entries."
|
2009-10-22 15:17:48 +00:00
|
|
|
(pcomplete-entries
|
|
|
|
nil
|
2011-06-17 18:52:46 +00:00
|
|
|
(lambda (f)
|
|
|
|
(or (file-directory-p f)
|
|
|
|
(and (or (null regexp) (string-match regexp f))
|
|
|
|
(or (null predicate) (funcall predicate f)))))))
|
|
|
|
|
|
|
|
(defun pcomplete--entries (&optional regexp predicate)
|
|
|
|
"Like `pcomplete-entries' but without env-var handling."
|
|
|
|
(let* ((ign-pred
|
|
|
|
(when (or pcomplete-file-ignore pcomplete-dir-ignore)
|
|
|
|
;; Capture the dynbound value for later use.
|
|
|
|
(let ((file-ignore pcomplete-file-ignore)
|
|
|
|
(dir-ignore pcomplete-dir-ignore))
|
|
|
|
(lambda (file)
|
|
|
|
(not
|
|
|
|
(if (eq (aref file (1- (length file))) ?/)
|
|
|
|
(and dir-ignore (string-match dir-ignore file))
|
|
|
|
(and file-ignore (string-match file-ignore file))))))))
|
|
|
|
(reg-pred (if regexp (lambda (file) (string-match regexp file))))
|
|
|
|
(pred (cond
|
|
|
|
((null (or ign-pred reg-pred)) predicate)
|
|
|
|
((null (or ign-pred predicate)) reg-pred)
|
|
|
|
((null (or reg-pred predicate)) ign-pred)
|
|
|
|
(t (lambda (f)
|
|
|
|
(and (or (null reg-pred) (funcall reg-pred f))
|
|
|
|
(or (null ign-pred) (funcall ign-pred f))
|
|
|
|
(or (null predicate) (funcall predicate f))))))))
|
|
|
|
(lambda (s p a)
|
|
|
|
(if (and (eq a 'metadata) pcomplete-compare-entry-function)
|
|
|
|
`(metadata (cycle-sort-function
|
|
|
|
. ,(lambda (comps)
|
|
|
|
(sort comps pcomplete-compare-entry-function)))
|
|
|
|
,@(cdr (completion-file-name-table s p a)))
|
2012-11-19 19:22:07 +00:00
|
|
|
(let ((completion-ignored-extensions nil)
|
|
|
|
(completion-ignore-case pcomplete-ignore-case))
|
2011-06-17 18:52:46 +00:00
|
|
|
(completion-table-with-predicate
|
2011-10-02 04:08:50 +00:00
|
|
|
#'comint-completion-file-name-table pred 'strict s p a))))))
|
2011-06-17 18:52:46 +00:00
|
|
|
|
|
|
|
(defconst pcomplete--env-regexp
|
|
|
|
"\\(?:\\`\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(\\$\\(?:{\\([^}]+\\)}\\|\\(?2:[[:alnum:]_]+\\)\\)\\)")
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(defun pcomplete-entries (&optional regexp predicate)
|
|
|
|
"Complete against a list of directory candidates.
|
|
|
|
If REGEXP is non-nil, it is a regular expression used to refine the
|
|
|
|
match (files not matching the REGEXP will be excluded).
|
|
|
|
If PREDICATE is non-nil, it will also be used to refine the match
|
|
|
|
\(files for which the PREDICATE returns nil will be excluded).
|
2002-07-31 22:01:54 +00:00
|
|
|
If no directory information can be extracted from the completed
|
2004-04-23 21:34:46 +00:00
|
|
|
component, `default-directory' is used as the basis for completion."
|
2011-06-17 18:52:46 +00:00
|
|
|
;; FIXME: The old code did env-var expansion here, so we reproduce this
|
|
|
|
;; behavior for now, but really env-var handling should be performed globally
|
|
|
|
;; rather than here since it also applies to non-file arguments.
|
|
|
|
(let ((table (pcomplete--entries regexp predicate)))
|
|
|
|
(lambda (string pred action)
|
|
|
|
(let ((strings nil)
|
|
|
|
(orig-length (length string)))
|
|
|
|
;; Perform env-var expansion.
|
|
|
|
(while (string-match pcomplete--env-regexp string)
|
|
|
|
(push (substring string 0 (match-beginning 1)) strings)
|
|
|
|
(push (getenv (match-string 2 string)) strings)
|
|
|
|
(setq string (substring string (match-end 1))))
|
|
|
|
(if (not (and strings
|
|
|
|
(or (eq action t)
|
|
|
|
(eq (car-safe action) 'boundaries))))
|
|
|
|
(let ((newstring
|
|
|
|
(mapconcat 'identity (nreverse (cons string strings)) "")))
|
|
|
|
;; FIXME: We could also try to return unexpanded envvars.
|
|
|
|
(complete-with-action action table newstring pred))
|
|
|
|
(let* ((envpos (apply #'+ (mapcar #' length strings)))
|
|
|
|
(newstring
|
|
|
|
(mapconcat 'identity (nreverse (cons string strings)) ""))
|
|
|
|
(bounds (completion-boundaries newstring table pred
|
|
|
|
(or (cdr-safe action) ""))))
|
|
|
|
(if (>= (car bounds) envpos)
|
|
|
|
;; The env-var is "out of bounds".
|
|
|
|
(if (eq action t)
|
|
|
|
(complete-with-action action table newstring pred)
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
`(boundaries
|
|
|
|
,(+ (car bounds) (- orig-length (length newstring)))
|
|
|
|
. ,(cdr bounds)))
|
2011-06-17 18:52:46 +00:00
|
|
|
;; The env-var is in the file bounds.
|
|
|
|
(if (eq action t)
|
|
|
|
(let ((comps (complete-with-action
|
|
|
|
action table newstring pred))
|
|
|
|
(len (- envpos (car bounds))))
|
|
|
|
;; Strip the part of each completion that's actually
|
|
|
|
;; coming from the env-var.
|
|
|
|
(mapcar (lambda (s) (substring s len)) comps))
|
Reduce use of (require 'cl).
* admin/bzrmerge.el: Use cl-lib.
* leim/quail/hangul.el: Don't require CL.
* leim/quail/ipa.el: Use cl-lib.
* vc/smerge-mode.el, vc/pcvs.el, vc/pcvs-util.el, vc/pcvs-info.el:
* vc/diff-mode.el, vc/cvs-status.el, uniquify.el, scroll-bar.el:
* register.el, progmodes/sh-script.el, net/gnutls.el, net/dbus.el:
* msb.el, mpc.el, minibuffer.el, international/ucs-normalize.el:
* international/quail.el, info-xref.el, imenu.el, image-mode.el:
* font-lock.el, filesets.el, edmacro.el, doc-view.el, bookmark.el:
* battery.el, avoid.el, abbrev.el: Use cl-lib.
* vc/pcvs-parse.el, vc/pcvs-defs.el, vc/log-view.el, vc/log-edit.el:
* vc/diff.el, simple.el, pcomplete.el, lpr.el, comint.el, loadhist.el:
* jit-lock.el, international/iso-ascii.el, info.el, frame.el, bs.el:
* emulation/crisp.el, electric.el, dired.el, cus-dep.el, composite.el:
* calculator.el, autorevert.el, apropos.el: Don't require CL.
* emacs-bytecomp.el (byte-recompile-directory, display-call-tree)
(byte-compile-unfold-bcf, byte-compile-check-variable):
* emacs-byte-opt.el (byte-compile-trueconstp)
(byte-compile-nilconstp):
* emacs-autoload.el (make-autoload): Use pcase.
* face-remap.el (text-scale-adjust): Simplify pcase patterns.
2012-07-10 11:51:54 +00:00
|
|
|
`(boundaries
|
|
|
|
,(+ envpos (- orig-length (length newstring)))
|
|
|
|
. ,(cdr bounds))))))))))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(defsubst pcomplete-all-entries (&optional regexp predicate)
|
|
|
|
"Like `pcomplete-entries', but doesn't ignore any entries."
|
|
|
|
(let (pcomplete-file-ignore
|
|
|
|
pcomplete-dir-ignore)
|
|
|
|
(pcomplete-entries regexp predicate)))
|
|
|
|
|
|
|
|
(defsubst pcomplete-dirs (&optional regexp)
|
|
|
|
"Complete amongst a list of directories."
|
|
|
|
(pcomplete-entries regexp 'file-directory-p))
|
|
|
|
|
|
|
|
;; generation of completion lists
|
|
|
|
|
|
|
|
(defun pcomplete-find-completion-function (command)
|
|
|
|
"Find the completion function to call for the given COMMAND."
|
|
|
|
(let ((sym (intern-soft
|
|
|
|
(concat "pcomplete/" (symbol-name major-mode) "/" command))))
|
|
|
|
(unless sym
|
|
|
|
(setq sym (intern-soft (concat "pcomplete/" command))))
|
|
|
|
(and sym (fboundp sym) sym)))
|
|
|
|
|
|
|
|
(defun pcomplete-completions ()
|
|
|
|
"Return a list of completions for the current argument position."
|
|
|
|
(catch 'pcomplete-completions
|
|
|
|
(when (pcomplete-parse-arguments pcomplete-expand-before-complete)
|
|
|
|
(if (= pcomplete-index pcomplete-last)
|
|
|
|
(funcall pcomplete-command-completion-function)
|
|
|
|
(let ((sym (or (pcomplete-find-completion-function
|
|
|
|
(funcall pcomplete-command-name-function))
|
|
|
|
pcomplete-default-completion-function)))
|
|
|
|
(ignore
|
|
|
|
(pcomplete-next-arg)
|
|
|
|
(funcall sym)))))))
|
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
(defun pcomplete-opt (options &optional prefix _no-ganging _args-follow)
|
2000-06-23 05:24:10 +00:00
|
|
|
"Complete a set of OPTIONS, each beginning with PREFIX (?- by default).
|
|
|
|
PREFIX may be t, in which case no PREFIX character is necessary.
|
2004-04-23 21:34:46 +00:00
|
|
|
If NO-GANGING is non-nil, each option is separate (-xy is not allowed).
|
|
|
|
If ARGS-FOLLOW is non-nil, then options which take arguments may have
|
|
|
|
the argument appear after a ganged set of options. This is how tar
|
2011-04-19 13:44:55 +00:00
|
|
|
behaves, for example.
|
|
|
|
Arguments NO-GANGING and ARGS-FOLLOW are currently ignored."
|
2000-06-23 05:24:10 +00:00
|
|
|
(if (and (= pcomplete-index pcomplete-last)
|
|
|
|
(string= (pcomplete-arg) "-"))
|
|
|
|
(let ((len (length options))
|
|
|
|
(index 0)
|
|
|
|
char choices)
|
|
|
|
(while (< index len)
|
|
|
|
(setq char (aref options index))
|
|
|
|
(if (eq char ?\()
|
|
|
|
(let ((result (read-from-string options index)))
|
|
|
|
(setq index (cdr result)))
|
|
|
|
(unless (memq char '(?/ ?* ?? ?.))
|
2009-10-26 04:06:01 +00:00
|
|
|
(push (char-to-string char) choices))
|
2000-06-23 05:24:10 +00:00
|
|
|
(setq index (1+ index))))
|
|
|
|
(throw 'pcomplete-completions
|
|
|
|
(mapcar
|
|
|
|
(function
|
|
|
|
(lambda (opt)
|
|
|
|
(concat "-" opt)))
|
2018-03-05 01:53:07 +00:00
|
|
|
(pcomplete-uniquify-list choices))))
|
2000-06-23 05:24:10 +00:00
|
|
|
(let ((arg (pcomplete-arg)))
|
|
|
|
(when (and (> (length arg) 1)
|
|
|
|
(stringp arg)
|
|
|
|
(eq (aref arg 0) (or prefix ?-)))
|
|
|
|
(pcomplete-next-arg)
|
|
|
|
(let ((char (aref arg 1))
|
|
|
|
(len (length options))
|
|
|
|
(index 0)
|
|
|
|
opt-char arg-char result)
|
|
|
|
(while (< (1+ index) len)
|
|
|
|
(setq opt-char (aref options index)
|
|
|
|
arg-char (aref options (1+ index)))
|
|
|
|
(if (eq arg-char ?\()
|
|
|
|
(setq result
|
|
|
|
(read-from-string options (1+ index))
|
|
|
|
index (cdr result)
|
|
|
|
result (car result))
|
|
|
|
(setq result nil))
|
|
|
|
(when (and (eq char opt-char)
|
|
|
|
(memq arg-char '(?\( ?/ ?* ?? ?.)))
|
|
|
|
(if (< pcomplete-index pcomplete-last)
|
|
|
|
(pcomplete-next-arg)
|
|
|
|
(throw 'pcomplete-completions
|
|
|
|
(cond ((eq arg-char ?/) (pcomplete-dirs))
|
|
|
|
((eq arg-char ?*) (pcomplete-executables))
|
|
|
|
((eq arg-char ??) nil)
|
|
|
|
((eq arg-char ?.) (pcomplete-entries))
|
|
|
|
((eq arg-char ?\() (eval result))))))
|
|
|
|
(setq index (1+ index))))))))
|
|
|
|
|
|
|
|
(defun pcomplete--here (&optional form stub paring form-only)
|
2004-04-23 21:34:46 +00:00
|
|
|
"Complete against the current argument, if at the end.
|
2000-06-23 05:24:10 +00:00
|
|
|
See the documentation for `pcomplete-here'."
|
|
|
|
(if (< pcomplete-index pcomplete-last)
|
|
|
|
(progn
|
|
|
|
(if (eq paring 0)
|
|
|
|
(setq pcomplete-seen nil)
|
|
|
|
(unless (eq paring t)
|
|
|
|
(let ((arg (pcomplete-arg)))
|
2009-10-22 15:17:48 +00:00
|
|
|
(when (stringp arg)
|
2009-10-26 04:06:01 +00:00
|
|
|
(push (if paring
|
|
|
|
(funcall paring arg)
|
|
|
|
(file-truename arg))
|
|
|
|
pcomplete-seen)))))
|
2000-06-23 05:24:10 +00:00
|
|
|
(pcomplete-next-arg)
|
|
|
|
t)
|
|
|
|
(when pcomplete-show-help
|
|
|
|
(pcomplete--help)
|
|
|
|
(throw 'pcompleted t))
|
|
|
|
(if stub
|
|
|
|
(setq pcomplete-stub stub))
|
|
|
|
(if (or (eq paring t) (eq paring 0))
|
|
|
|
(setq pcomplete-seen nil)
|
|
|
|
(setq pcomplete-norm-func (or paring 'file-truename)))
|
|
|
|
(unless form-only
|
|
|
|
(run-hooks 'pcomplete-try-first-hook))
|
2009-10-22 15:17:48 +00:00
|
|
|
(throw 'pcomplete-completions
|
|
|
|
(if (functionp form)
|
|
|
|
(funcall form)
|
|
|
|
;; Old calling convention, might still be used by files
|
|
|
|
;; byte-compiled with the older code.
|
|
|
|
(eval form)))))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
(defmacro pcomplete-here* (&optional form stub form-only)
|
|
|
|
"An alternate form which does not participate in argument paring."
|
2009-10-22 15:17:48 +00:00
|
|
|
(declare (debug t))
|
2010-04-13 01:24:10 +00:00
|
|
|
`(pcomplete-here ,form ,stub t ,form-only))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;; display support
|
|
|
|
|
|
|
|
(defun pcomplete-restore-windows ()
|
|
|
|
"If the only window change was due to Completions, restore things."
|
|
|
|
(if pcomplete-last-window-config
|
|
|
|
(let* ((cbuf (get-buffer "*Completions*"))
|
|
|
|
(cwin (and cbuf (get-buffer-window cbuf))))
|
2007-06-14 00:07:15 +00:00
|
|
|
(when (window-live-p cwin)
|
2000-06-23 05:24:10 +00:00
|
|
|
(bury-buffer cbuf)
|
|
|
|
(set-window-configuration pcomplete-last-window-config))))
|
|
|
|
(setq pcomplete-last-window-config nil
|
|
|
|
pcomplete-window-restore-timer nil))
|
|
|
|
|
|
|
|
;; Abstractions so that the code below will work for both Emacs 20 and
|
|
|
|
;; XEmacs 21
|
|
|
|
|
2007-11-17 17:35:09 +00:00
|
|
|
(defalias 'pcomplete-event-matches-key-specifier-p
|
|
|
|
(if (featurep 'xemacs)
|
|
|
|
'event-matches-key-specifier-p
|
|
|
|
'eq))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
2007-04-08 13:47:33 +00:00
|
|
|
(defun pcomplete-read-event (&optional prompt)
|
|
|
|
(if (fboundp 'read-event)
|
|
|
|
(read-event prompt)
|
2000-06-23 05:24:10 +00:00
|
|
|
(aref (read-key-sequence prompt) 0)))
|
|
|
|
|
|
|
|
(defun pcomplete-show-completions (completions)
|
|
|
|
"List in help buffer sorted COMPLETIONS.
|
|
|
|
Typing SPC flushes the help buffer."
|
2009-10-22 15:17:48 +00:00
|
|
|
(when pcomplete-window-restore-timer
|
|
|
|
(cancel-timer pcomplete-window-restore-timer)
|
|
|
|
(setq pcomplete-window-restore-timer nil))
|
|
|
|
(unless pcomplete-last-window-config
|
|
|
|
(setq pcomplete-last-window-config (current-window-configuration)))
|
|
|
|
(with-output-to-temp-buffer "*Completions*"
|
|
|
|
(display-completion-list completions))
|
2012-09-28 13:42:19 +00:00
|
|
|
(minibuffer-message "Hit space to flush")
|
2009-10-22 15:17:48 +00:00
|
|
|
(let (event)
|
|
|
|
(prog1
|
|
|
|
(catch 'done
|
|
|
|
(while (with-current-buffer (get-buffer "*Completions*")
|
|
|
|
(setq event (pcomplete-read-event)))
|
|
|
|
(cond
|
|
|
|
((pcomplete-event-matches-key-specifier-p event ?\s)
|
|
|
|
(set-window-configuration pcomplete-last-window-config)
|
|
|
|
(setq pcomplete-last-window-config nil)
|
|
|
|
(throw 'done nil))
|
|
|
|
((or (pcomplete-event-matches-key-specifier-p event 'tab)
|
|
|
|
;; Needed on a terminal
|
|
|
|
(pcomplete-event-matches-key-specifier-p event 9))
|
|
|
|
(let ((win (or (get-buffer-window "*Completions*" 0)
|
|
|
|
(display-buffer "*Completions*"
|
|
|
|
'not-this-window))))
|
|
|
|
(with-selected-window win
|
|
|
|
(if (pos-visible-in-window-p (point-max))
|
|
|
|
(goto-char (point-min))
|
|
|
|
(scroll-up))))
|
|
|
|
(message ""))
|
|
|
|
(t
|
2015-07-25 16:54:42 +00:00
|
|
|
(push event unread-command-events)
|
2009-10-22 15:17:48 +00:00
|
|
|
(throw 'done nil)))))
|
|
|
|
(if (and pcomplete-last-window-config
|
|
|
|
pcomplete-restore-window-delay)
|
|
|
|
(setq pcomplete-window-restore-timer
|
|
|
|
(run-with-timer pcomplete-restore-window-delay nil
|
|
|
|
'pcomplete-restore-windows))))))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;; insert completion at point
|
|
|
|
|
|
|
|
(defun pcomplete-insert-entry (stub entry &optional addsuffix raw-p)
|
|
|
|
"Insert a completion entry at point.
|
|
|
|
Returns non-nil if a space was appended at the end."
|
|
|
|
(let ((here (point)))
|
|
|
|
(if (not pcomplete-ignore-case)
|
|
|
|
(insert-and-inherit (if raw-p
|
|
|
|
(substring entry (length stub))
|
2012-04-25 18:53:57 +00:00
|
|
|
(comint-quote-filename
|
2000-06-23 05:24:10 +00:00
|
|
|
(substring entry (length stub)))))
|
|
|
|
;; the stub is not quoted at this time, so to determine the
|
|
|
|
;; length of what should be in the buffer, we must quote it
|
2009-10-23 17:37:09 +00:00
|
|
|
;; FIXME: Here we presume that quoting `stub' gives us the exact
|
|
|
|
;; text in the buffer before point, which is not guaranteed;
|
|
|
|
;; e.g. it is not the case in eshell when completing ${FOO}tm[TAB].
|
2012-04-25 18:53:57 +00:00
|
|
|
(delete-char (- (length (comint-quote-filename stub))))
|
2000-06-23 05:24:10 +00:00
|
|
|
;; if there is already a backslash present to handle the first
|
|
|
|
;; character, don't bother quoting it
|
|
|
|
(when (eq (char-before) ?\\)
|
|
|
|
(insert-and-inherit (substring entry 0 1))
|
|
|
|
(setq entry (substring entry 1)))
|
|
|
|
(insert-and-inherit (if raw-p
|
|
|
|
entry
|
2012-04-25 18:53:57 +00:00
|
|
|
(comint-quote-filename entry))))
|
2000-06-23 05:24:10 +00:00
|
|
|
(let (space-added)
|
|
|
|
(when (and (not (memq (char-before) pcomplete-suffix-list))
|
|
|
|
addsuffix)
|
2003-01-10 07:01:14 +00:00
|
|
|
(insert-and-inherit pcomplete-termination-string)
|
2000-06-23 05:24:10 +00:00
|
|
|
(setq space-added t))
|
|
|
|
(setq pcomplete-last-completion-length (- (point) here)
|
|
|
|
pcomplete-last-completion-stub stub)
|
|
|
|
space-added)))
|
|
|
|
|
2012-04-25 18:53:57 +00:00
|
|
|
;; Selection of completions.
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(defun pcomplete-do-complete (stub completions)
|
|
|
|
"Dynamically complete at point using STUB and COMPLETIONS.
|
|
|
|
This is basically just a wrapper for `pcomplete-stub' which does some
|
|
|
|
extra checking, and munging of the COMPLETIONS list."
|
|
|
|
(unless (stringp stub)
|
|
|
|
(message "Cannot complete argument")
|
|
|
|
(throw 'pcompleted nil))
|
|
|
|
(if (null completions)
|
|
|
|
(ignore
|
|
|
|
(if (and stub (> (length stub) 0))
|
|
|
|
(message "No completions of %s" stub)
|
|
|
|
(message "No completions")))
|
|
|
|
;; pare it down, if applicable
|
2009-10-22 15:17:48 +00:00
|
|
|
(when (and pcomplete-use-paring pcomplete-seen)
|
|
|
|
(setq pcomplete-seen
|
|
|
|
(mapcar 'directory-file-name pcomplete-seen))
|
|
|
|
(dolist (p pcomplete-seen)
|
|
|
|
(add-to-list 'pcomplete-seen
|
|
|
|
(funcall pcomplete-norm-func p)))
|
|
|
|
(setq completions
|
|
|
|
(apply-partially 'completion-table-with-predicate
|
|
|
|
completions
|
2011-04-28 00:18:12 +00:00
|
|
|
(when pcomplete-seen
|
|
|
|
(lambda (f)
|
|
|
|
(not (member
|
|
|
|
(funcall pcomplete-norm-func
|
|
|
|
(directory-file-name f))
|
|
|
|
pcomplete-seen))))
|
2009-10-22 15:17:48 +00:00
|
|
|
'strict)))
|
2000-06-23 05:24:10 +00:00
|
|
|
;; OK, we've got a list of completions.
|
|
|
|
(if pcomplete-show-list
|
2009-10-22 15:17:48 +00:00
|
|
|
;; FIXME: pay attention to boundaries.
|
|
|
|
(pcomplete-show-completions (all-completions stub completions))
|
2000-06-23 05:24:10 +00:00
|
|
|
(pcomplete-stub stub completions))))
|
|
|
|
|
|
|
|
(defun pcomplete-stub (stub candidates &optional cycle-p)
|
|
|
|
"Dynamically complete STUB from CANDIDATES list.
|
|
|
|
This function inserts completion characters at point by completing
|
|
|
|
STUB from the strings in CANDIDATES. A completions listing may be
|
|
|
|
shown in a help buffer if completion is ambiguous.
|
|
|
|
|
|
|
|
Returns nil if no completion was inserted.
|
|
|
|
Returns `sole' if completed with the only completion match.
|
|
|
|
Returns `shortest' if completed with the shortest of the matches.
|
|
|
|
Returns `partial' if completed as far as possible with the matches.
|
|
|
|
Returns `listed' if a completion listing was shown.
|
|
|
|
|
|
|
|
See also `pcomplete-filename'."
|
|
|
|
(let* ((completion-ignore-case pcomplete-ignore-case)
|
2009-10-22 15:17:48 +00:00
|
|
|
(completions (all-completions stub candidates))
|
|
|
|
(entry (try-completion stub candidates))
|
|
|
|
result)
|
|
|
|
(cond
|
|
|
|
((null entry)
|
|
|
|
(if (and stub (> (length stub) 0))
|
|
|
|
(message "No completions of %s" stub)
|
|
|
|
(message "No completions")))
|
|
|
|
((eq entry t)
|
|
|
|
(setq entry stub)
|
|
|
|
(message "Sole completion")
|
|
|
|
(setq result 'sole))
|
|
|
|
((= 1 (length completions))
|
|
|
|
(setq result 'sole))
|
|
|
|
((and pcomplete-cycle-completions
|
|
|
|
(or cycle-p
|
|
|
|
(not pcomplete-cycle-cutoff-length)
|
|
|
|
(<= (length completions)
|
|
|
|
pcomplete-cycle-cutoff-length)))
|
|
|
|
(let ((bound (car (completion-boundaries stub candidates nil ""))))
|
|
|
|
(unless (zerop bound)
|
|
|
|
(setq completions (mapcar (lambda (c) (concat (substring stub 0 bound) c))
|
|
|
|
completions)))
|
|
|
|
(setq entry (car completions)
|
|
|
|
pcomplete-current-completions completions)))
|
|
|
|
((and pcomplete-recexact
|
|
|
|
(string-equal stub entry)
|
|
|
|
(member entry completions))
|
|
|
|
;; It's not unique, but user wants shortest match.
|
|
|
|
(message "Completed shortest")
|
|
|
|
(setq result 'shortest))
|
|
|
|
((or pcomplete-autolist
|
|
|
|
(string-equal stub entry))
|
|
|
|
;; It's not unique, list possible completions.
|
|
|
|
;; FIXME: pay attention to boundaries.
|
|
|
|
(pcomplete-show-completions completions)
|
|
|
|
(setq result 'listed))
|
|
|
|
(t
|
|
|
|
(message "Partially completed")
|
|
|
|
(setq result 'partial)))
|
|
|
|
(cons result entry)))
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;; context sensitive help
|
|
|
|
|
|
|
|
(defun pcomplete--help ()
|
|
|
|
"Produce context-sensitive help for the current argument.
|
2004-04-23 21:34:46 +00:00
|
|
|
If specific documentation can't be given, be generic."
|
2000-06-23 05:24:10 +00:00
|
|
|
(if (and pcomplete-help
|
|
|
|
(or (and (stringp pcomplete-help)
|
|
|
|
(fboundp 'Info-goto-node))
|
|
|
|
(listp pcomplete-help)))
|
|
|
|
(if (listp pcomplete-help)
|
2005-09-18 12:25:02 +00:00
|
|
|
(message "%s" (eval pcomplete-help))
|
2000-06-23 05:24:10 +00:00
|
|
|
(save-window-excursion (info))
|
|
|
|
(switch-to-buffer-other-window "*info*")
|
|
|
|
(funcall (symbol-function 'Info-goto-node) pcomplete-help))
|
|
|
|
(if pcomplete-man-function
|
|
|
|
(let ((cmd (funcall pcomplete-command-name-function)))
|
|
|
|
(if (and cmd (> (length cmd) 0))
|
|
|
|
(funcall pcomplete-man-function cmd)))
|
|
|
|
(message "No context-sensitive help available"))))
|
|
|
|
|
|
|
|
;; general utilities
|
|
|
|
|
2018-03-05 01:53:07 +00:00
|
|
|
(defun pcomplete-uniquify-list (l)
|
2000-06-23 05:24:10 +00:00
|
|
|
"Sort and remove multiples in L."
|
|
|
|
(setq l (sort l 'string-lessp))
|
|
|
|
(let ((m l))
|
|
|
|
(while m
|
|
|
|
(while (and (cdr m)
|
|
|
|
(string= (car m)
|
|
|
|
(cadr m)))
|
|
|
|
(setcdr m (cddr m)))
|
|
|
|
(setq m (cdr m))))
|
|
|
|
l)
|
2018-03-05 01:53:07 +00:00
|
|
|
(define-obsolete-function-alias
|
|
|
|
'pcomplete-uniqify-list
|
|
|
|
'pcomplete-uniquify-list "27.1")
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
(defun pcomplete-process-result (cmd &rest args)
|
|
|
|
"Call CMD using `call-process' and return the simplest result."
|
|
|
|
(with-temp-buffer
|
|
|
|
(apply 'call-process cmd nil t nil args)
|
|
|
|
(skip-chars-backward "\n")
|
|
|
|
(buffer-substring (point-min) (point))))
|
|
|
|
|
|
|
|
;; create a set of aliases which allow completion functions to be not
|
|
|
|
;; quite so verbose
|
|
|
|
|
2009-10-22 15:17:48 +00:00
|
|
|
;;; jww (1999-10-20): are these a good idea?
|
|
|
|
;; (defalias 'pc-here 'pcomplete-here)
|
|
|
|
;; (defalias 'pc-test 'pcomplete-test)
|
|
|
|
;; (defalias 'pc-opt 'pcomplete-opt)
|
|
|
|
;; (defalias 'pc-match 'pcomplete-match)
|
|
|
|
;; (defalias 'pc-match-string 'pcomplete-match-string)
|
|
|
|
;; (defalias 'pc-match-beginning 'pcomplete-match-beginning)
|
|
|
|
;; (defalias 'pc-match-end 'pcomplete-match-end)
|
|
|
|
|
|
|
|
(provide 'pcomplete)
|
2000-06-23 05:24:10 +00:00
|
|
|
|
|
|
|
;;; pcomplete.el ends here
|