1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-20 20:50:53 -08:00

* lisp/pcomplete.el: Mark 'pcomplete' command as obsolete

Remove redundant ':group's.
(pcomplete, pcomplete-help): Mark as obsolete.
This commit is contained in:
Stefan Monnier 2019-10-03 10:36:00 -04:00
parent c164f74979
commit 44dfa7a834
3 changed files with 56 additions and 63 deletions

View file

@ -1532,6 +1532,11 @@ available for output of asynchronous shell commands.
** Pcomplete ** Pcomplete
*** The 'pcomplete' command is now obsolete
The Pcomplete functionality can be obtained via completion-at-point
instead, by adding pcomplete-completions-at-point to
completion-at-point-functions.
*** The function 'pcomplete-uniquify-list' has been renamed from *** The function 'pcomplete-uniquify-list' has been renamed from
'pcomplete-uniqify-list'. 'pcomplete-uniqify-list'.

View file

@ -409,7 +409,7 @@ to writing a completion function."
(let ((filename (pcomplete-arg)) glob-name) (let ((filename (pcomplete-arg)) glob-name)
(if (file-name-directory filename) (if (file-name-directory filename)
(if eshell-force-execution (if eshell-force-execution
(pcomplete-dirs-or-entries nil 'file-readable-p) (pcomplete-dirs-or-entries nil #'file-readable-p)
(pcomplete-executables)) (pcomplete-executables))
(if (and (> (length filename) 0) (if (and (> (length filename) 0)
(eq (aref filename 0) eshell-explicit-command-char)) (eq (aref filename 0) eshell-explicit-command-char))

View file

@ -30,7 +30,7 @@
;; To use pcomplete with shell-mode, for example, you will need the ;; To use pcomplete with shell-mode, for example, you will need the
;; following in your init file: ;; following in your init file:
;; ;;
;; (add-hook 'shell-mode-hook 'pcomplete-shell-setup) ;; (add-hook 'shell-mode-hook #'pcomplete-shell-setup)
;; ;;
;; Most of the code below simply provides support mechanisms for ;; Most of the code below simply provides support mechanisms for
;; writing completion functions. Completion functions themselves are ;; writing completion functions. Completion functions themselves are
@ -105,7 +105,7 @@
;; ;;
;; (defun pcomplete/example () ;; (defun pcomplete/example ()
;; (pcomplete-here (pcomplete-entries)) ;; (pcomplete-here (pcomplete-entries))
;; (if (pcomplete-test 'file-directory-p) ;; (if (pcomplete-test #'file-directory-p)
;; (pcomplete-here (pcomplete-dirs)) ;; (pcomplete-here (pcomplete-dirs))
;; (pcomplete-here (pcomplete-entries)))) ;; (pcomplete-here (pcomplete-entries))))
;; ;;
@ -129,31 +129,26 @@
(defcustom pcomplete-file-ignore nil (defcustom pcomplete-file-ignore nil
"A regexp of filenames to be disregarded during file completion." "A regexp of filenames to be disregarded during file completion."
:type '(choice regexp (const :tag "None" nil)) :type '(choice regexp (const :tag "None" nil)))
:group 'pcomplete)
(defcustom pcomplete-dir-ignore nil (defcustom pcomplete-dir-ignore nil
"A regexp of names to be disregarded during directory completion." "A regexp of names to be disregarded during directory completion."
:type '(choice regexp (const :tag "None" nil)) :type '(choice regexp (const :tag "None" nil)))
:group 'pcomplete)
(defcustom pcomplete-ignore-case (memq system-type '(ms-dos windows-nt cygwin)) (defcustom pcomplete-ignore-case (memq system-type '(ms-dos windows-nt cygwin))
;; FIXME: the doc mentions file-name completion, but the code ;; FIXME: the doc mentions file-name completion, but the code
;; seems to apply it to all completions. ;; seems to apply it to all completions.
"If non-nil, ignore case when doing filename completion." "If non-nil, ignore case when doing filename completion."
:type 'boolean :type 'boolean)
:group 'pcomplete)
(defcustom pcomplete-autolist nil (defcustom pcomplete-autolist nil
"If non-nil, automatically list possibilities on partial completion. "If non-nil, automatically list possibilities on partial completion.
This mirrors the optional behavior of tcsh." This mirrors the optional behavior of tcsh."
:type 'boolean :type 'boolean)
:group 'pcomplete)
(defcustom pcomplete-suffix-list (list ?/ ?:) (defcustom pcomplete-suffix-list (list ?/ ?:)
"A list of characters which constitute a proper suffix." "A list of characters which constitute a proper suffix."
:type '(repeat character) :type '(repeat character))
:group 'pcomplete)
(make-obsolete-variable 'pcomplete-suffix-list nil "24.1") (make-obsolete-variable 'pcomplete-suffix-list nil "24.1")
(defcustom pcomplete-recexact nil (defcustom pcomplete-recexact nil
@ -161,25 +156,22 @@ This mirrors the optional behavior of tcsh."
This mirrors the optional behavior of tcsh. This mirrors the optional behavior of tcsh.
A non-nil value is useful if `pcomplete-autolist' is non-nil too." A non-nil value is useful if `pcomplete-autolist' is non-nil too."
:type 'boolean :type 'boolean)
:group 'pcomplete)
(define-obsolete-variable-alias (define-obsolete-variable-alias
'pcomplete-arg-quote-list 'comint-file-name-quote-list "24.3") 'pcomplete-arg-quote-list 'comint-file-name-quote-list "24.3")
(defcustom pcomplete-man-function 'man (defcustom pcomplete-man-function #'man
"A function to that will be called to display a manual page. "A function to that will be called to display a manual page.
It will be passed the name of the command to document." It will be passed the name of the command to document."
:type 'function :type 'function)
:group 'pcomplete)
(defcustom pcomplete-compare-entry-function 'string-lessp (defcustom pcomplete-compare-entry-function #'string-lessp
"This function is used to order file entries for completion. "This function is used to order file entries for completion.
The behavior of most all shells is to sort alphabetically." The behavior of most all shells is to sort alphabetically."
:type '(radio (function-item string-lessp) :type '(radio (function-item string-lessp)
(function-item file-newer-than-file-p) (function-item file-newer-than-file-p)
(function :tag "Other")) (function :tag "Other")))
:group 'pcomplete)
(defcustom pcomplete-help nil (defcustom pcomplete-help nil
"A string or function (or nil) used for context-sensitive help. "A string or function (or nil) used for context-sensitive help.
@ -188,8 +180,7 @@ If non-nil, it must a sexp that will be evaluated, and whose
result will be shown in the minibuffer. result will be shown in the minibuffer.
If nil, the function `pcomplete-man-function' will be called with the If nil, the function `pcomplete-man-function' will be called with the
current command argument." current command argument."
:type '(choice string sexp (const :tag "Use man page" nil)) :type '(choice string sexp (const :tag "Use man page" nil)))
:group 'pcomplete)
(defcustom pcomplete-expand-before-complete nil (defcustom pcomplete-expand-before-complete nil
"If non-nil, expand the current argument before completing it. "If non-nil, expand the current argument before completing it.
@ -199,11 +190,10 @@ resolved first, and the resultant value that will be completed against
to be inserted in the buffer. Note that exactly what gets expanded to be inserted in the buffer. Note that exactly what gets expanded
and how is entirely up to the behavior of the and how is entirely up to the behavior of the
`pcomplete-parse-arguments-function'." `pcomplete-parse-arguments-function'."
:type 'boolean :type 'boolean)
:group 'pcomplete)
(defcustom pcomplete-parse-arguments-function (defcustom pcomplete-parse-arguments-function
'pcomplete-parse-buffer-arguments #'pcomplete-parse-buffer-arguments
"A function to call to parse the current line's arguments. "A function to call to parse the current line's arguments.
It should be called with no parameters, and with point at the position It should be called with no parameters, and with point at the position
of the argument that is to be completed. of the argument that is to be completed.
@ -218,8 +208,7 @@ representation of that argument), and BEG-POS gives the beginning
position of each argument, as it is seen by the user. The establishes position of each argument, as it is seen by the user. The establishes
a relationship between the fully resolved value of the argument, and a relationship between the fully resolved value of the argument, and
the textual representation of the argument." the textual representation of the argument."
:type 'function :type 'function)
:group 'pcomplete)
(defcustom pcomplete-cycle-completions t (defcustom pcomplete-cycle-completions t
"If non-nil, hitting the TAB key cycles through the completion list. "If non-nil, hitting the TAB key cycles through the completion list.
@ -230,8 +219,7 @@ 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 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 key. \\[pcomplete-list] is the key to press if the user wants to see
the list of possible completions." the list of possible completions."
:type 'boolean :type 'boolean)
:group 'pcomplete)
(defcustom pcomplete-cycle-cutoff-length 5 (defcustom pcomplete-cycle-cutoff-length 5
"If the number of completions is greater than this, don't cycle. "If the number of completions is greater than this, don't cycle.
@ -246,8 +234,7 @@ has already entered enough input to disambiguate most of the
possibilities, and therefore they are probably most interested in possibilities, and therefore they are probably most interested in
cycling through the candidates. Set this value to nil if you want cycling through the candidates. Set this value to nil if you want
cycling to always be enabled." cycling to always be enabled."
:type '(choice integer (const :tag "Always cycle" nil)) :type '(choice integer (const :tag "Always cycle" nil)))
:group 'pcomplete)
(defcustom pcomplete-restore-window-delay 1 (defcustom pcomplete-restore-window-delay 1
"The number of seconds to wait before restoring completion windows. "The number of seconds to wait before restoring completion windows.
@ -258,19 +245,17 @@ 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 set to nil, completion windows will be left on second until the user
removes them manually. If set to 0, they will disappear immediately removes them manually. If set to 0, they will disappear immediately
after the user enters a key other than TAB." after the user enters a key other than TAB."
:type '(choice integer (const :tag "Never restore" nil)) :type '(choice integer (const :tag "Never restore" nil)))
:group 'pcomplete)
(defcustom pcomplete-try-first-hook nil (defcustom pcomplete-try-first-hook nil
"A list of functions which are called before completing an argument. "A list of functions which are called before completing an argument.
This can be used, for example, for completing things which might apply This can be used, for example, for completing things which might apply
to all arguments, such as variable names after a $." to all arguments, such as variable names after a $."
:type 'hook :type 'hook)
:group 'pcomplete)
(defsubst pcomplete-executables (&optional regexp) (defsubst pcomplete-executables (&optional regexp)
"Complete amongst a list of directories and executables." "Complete amongst a list of directories and executables."
(pcomplete-entries regexp 'file-executable-p)) (pcomplete-entries regexp #'file-executable-p))
(defmacro pcomplete-here (&optional form stub paring form-only) (defmacro pcomplete-here (&optional form stub paring form-only)
"Complete against the current argument, if at the end. "Complete against the current argument, if at the end.
@ -310,13 +295,11 @@ generate the completions list. This means that the hook
(lambda () (lambda ()
(pcomplete-here (pcomplete-executables)))) (pcomplete-here (pcomplete-executables))))
"Function called for completing the initial command argument." "Function called for completing the initial command argument."
:type 'function :type 'function)
:group 'pcomplete)
(defcustom pcomplete-command-name-function 'pcomplete-command-name (defcustom pcomplete-command-name-function #'pcomplete-command-name
"Function called for determining the current command name." "Function called for determining the current command name."
:type 'function :type 'function)
:group 'pcomplete)
(defcustom pcomplete-default-completion-function (defcustom pcomplete-default-completion-function
(function (function
@ -324,16 +307,14 @@ generate the completions list. This means that the hook
(while (pcomplete-here (pcomplete-entries))))) (while (pcomplete-here (pcomplete-entries)))))
"Function called when no completion rule can be found. "Function called when no completion rule can be found.
This function is used to generate completions for every argument." This function is used to generate completions for every argument."
:type 'function :type 'function)
:group 'pcomplete)
(defcustom pcomplete-use-paring t (defcustom pcomplete-use-paring t
"If t, pare alternatives that have already been used. "If t, pare alternatives that have already been used.
If nil, you will always see the completion set of possible options, no If nil, you will always see the completion set of possible options, no
matter which of those options have already been used in previous matter which of those options have already been used in previous
command arguments." command arguments."
:type 'boolean :type 'boolean)
:group 'pcomplete)
(defcustom pcomplete-termination-string " " (defcustom pcomplete-termination-string " "
"A string that is inserted after any completion or expansion. "A string that is inserted after any completion or expansion.
@ -342,8 +323,7 @@ words separated by spaces. However, if your list uses a different
separator character, or if the completion occurs in a word that is separator character, or if the completion occurs in a word that is
already terminated by a character, this variable should be locally already terminated by a character, this variable should be locally
modified to be an empty string, or the desired separation string." modified to be an empty string, or the desired separation string."
:type 'string :type 'string)
:group 'pcomplete)
;;; Internal Variables: ;;; Internal Variables:
@ -528,6 +508,7 @@ Same as `pcomplete' but using the standard completion UI."
"Support extensible programmable completion. "Support extensible programmable completion.
To use this function, just bind the TAB key to it, or add it to your 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)." completion functions list (it should occur fairly early in the list)."
(declare (obsolete "use completion-at-point and pcomplete-completions-at-point" "27.1"))
(interactive "p") (interactive "p")
(if (and interactively (if (and interactively
pcomplete-cycle-completions pcomplete-cycle-completions
@ -579,7 +560,8 @@ completion functions list (it should occur fairly early in the list)."
This will modify the current buffer." This will modify the current buffer."
(interactive) (interactive)
(let ((pcomplete-expand-before-complete t)) (let ((pcomplete-expand-before-complete t))
(pcomplete))) (with-suppressed-warnings ((obsolete pcomplete))
(pcomplete))))
;;;###autoload ;;;###autoload
(defun pcomplete-continue () (defun pcomplete-continue ()
@ -596,7 +578,8 @@ This will modify the current buffer."
(interactive) (interactive)
(let ((pcomplete-expand-before-complete t) (let ((pcomplete-expand-before-complete t)
(pcomplete-expand-only-p t)) (pcomplete-expand-only-p t))
(pcomplete) (with-suppressed-warnings ((obsolete pcomplete))
(pcomplete))
(when (and pcomplete-current-completions (when (and pcomplete-current-completions
(> (length pcomplete-current-completions) 0)) ;?? (> (length pcomplete-current-completions) 0)) ;??
(delete-char (- pcomplete-last-completion-length)) (delete-char (- pcomplete-last-completion-length))
@ -611,9 +594,11 @@ This will modify the current buffer."
;;;###autoload ;;;###autoload
(defun pcomplete-help () (defun pcomplete-help ()
"Display any help information relative to the current argument." "Display any help information relative to the current argument."
(declare (obsolete "use completion-help-at-point and pcomplete-completions-at-point" "27.1"))
(interactive) (interactive)
(let ((pcomplete-show-help t)) (let ((pcomplete-show-help t))
(pcomplete))) (with-suppressed-warnings ((obsolete pcomplete))
(pcomplete))))
;;;###autoload ;;;###autoload
(defun pcomplete-list () (defun pcomplete-list ()
@ -626,7 +611,8 @@ This will modify the current buffer."
(setq pcomplete-current-completions nil (setq pcomplete-current-completions nil
pcomplete-last-completion-raw nil)) pcomplete-last-completion-raw nil))
(let ((pcomplete-show-list t)) (let ((pcomplete-show-list t))
(pcomplete))) (with-suppressed-warnings ((obsolete pcomplete))
(pcomplete))))
;;; Internal Functions: ;;; Internal Functions:
@ -751,9 +737,9 @@ COMPLETEF-SYM should be the symbol where the
dynamic-complete-functions are kept. For comint mode itself, dynamic-complete-functions are kept. For comint mode itself,
this is `comint-dynamic-complete-functions'." this is `comint-dynamic-complete-functions'."
(set (make-local-variable 'pcomplete-parse-arguments-function) (set (make-local-variable 'pcomplete-parse-arguments-function)
'pcomplete-parse-comint-arguments) #'pcomplete-parse-comint-arguments)
(add-hook 'completion-at-point-functions (add-hook 'completion-at-point-functions
'pcomplete-completions-at-point nil 'local) #'pcomplete-completions-at-point nil 'local)
(set (make-local-variable completef-sym) (set (make-local-variable completef-sym)
(copy-sequence (symbol-value completef-sym))) (copy-sequence (symbol-value completef-sym)))
(let* ((funs (symbol-value completef-sym)) (let* ((funs (symbol-value completef-sym))
@ -915,12 +901,12 @@ component, `default-directory' is used as the basis for completion."
(or (eq action t) (or (eq action t)
(eq (car-safe action) 'boundaries)))) (eq (car-safe action) 'boundaries))))
(let ((newstring (let ((newstring
(mapconcat 'identity (nreverse (cons string strings)) ""))) (mapconcat #'identity (nreverse (cons string strings)) "")))
;; FIXME: We could also try to return unexpanded envvars. ;; FIXME: We could also try to return unexpanded envvars.
(complete-with-action action table newstring pred)) (complete-with-action action table newstring pred))
(let* ((envpos (apply #'+ (mapcar #' length strings))) (let* ((envpos (apply #'+ (mapcar #' length strings)))
(newstring (newstring
(mapconcat 'identity (nreverse (cons string strings)) "")) (mapconcat #'identity (nreverse (cons string strings)) ""))
(bounds (completion-boundaries newstring table pred (bounds (completion-boundaries newstring table pred
(or (cdr-safe action) "")))) (or (cdr-safe action) ""))))
(if (>= (car bounds) envpos) (if (>= (car bounds) envpos)
@ -950,7 +936,7 @@ component, `default-directory' is used as the basis for completion."
(defsubst pcomplete-dirs (&optional regexp) (defsubst pcomplete-dirs (&optional regexp)
"Complete amongst a list of directories." "Complete amongst a list of directories."
(pcomplete-entries regexp 'file-directory-p)) (pcomplete-entries regexp #'file-directory-p))
;; generation of completion lists ;; generation of completion lists
@ -1055,7 +1041,7 @@ See the documentation for `pcomplete-here'."
(setq pcomplete-stub stub)) (setq pcomplete-stub stub))
(if (or (eq paring t) (eq paring 0)) (if (or (eq paring t) (eq paring 0))
(setq pcomplete-seen nil) (setq pcomplete-seen nil)
(setq pcomplete-norm-func (or paring 'file-truename))) (setq pcomplete-norm-func (or paring #'file-truename)))
(unless form-only (unless form-only
(run-hooks 'pcomplete-try-first-hook)) (run-hooks 'pcomplete-try-first-hook))
(throw 'pcomplete-completions (throw 'pcomplete-completions
@ -1128,7 +1114,7 @@ Typing SPC flushes the help buffer."
pcomplete-restore-window-delay) pcomplete-restore-window-delay)
(setq pcomplete-window-restore-timer (setq pcomplete-window-restore-timer
(run-with-timer pcomplete-restore-window-delay nil (run-with-timer pcomplete-restore-window-delay nil
'pcomplete-restore-windows)))))) #'pcomplete-restore-windows))))))
;; insert completion at point ;; insert completion at point
@ -1181,12 +1167,12 @@ extra checking, and munging of the COMPLETIONS list."
;; pare it down, if applicable ;; pare it down, if applicable
(when (and pcomplete-use-paring pcomplete-seen) (when (and pcomplete-use-paring pcomplete-seen)
(setq pcomplete-seen (setq pcomplete-seen
(mapcar 'directory-file-name pcomplete-seen)) (mapcar #'directory-file-name pcomplete-seen))
(dolist (p pcomplete-seen) (dolist (p pcomplete-seen)
(add-to-list 'pcomplete-seen (add-to-list 'pcomplete-seen
(funcall pcomplete-norm-func p))) (funcall pcomplete-norm-func p)))
(setq completions (setq completions
(apply-partially 'completion-table-with-predicate (apply-partially #'completion-table-with-predicate
completions completions
(when pcomplete-seen (when pcomplete-seen
(lambda (f) (lambda (f)
@ -1269,8 +1255,10 @@ If specific documentation can't be given, be generic."
(if (listp pcomplete-help) (if (listp pcomplete-help)
(message "%s" (eval pcomplete-help)) (message "%s" (eval pcomplete-help))
(save-window-excursion (info)) (save-window-excursion (info))
(declare-function Info-goto-node
"info" (nodename &optional fork strict-case))
(switch-to-buffer-other-window "*info*") (switch-to-buffer-other-window "*info*")
(funcall (symbol-function 'Info-goto-node) pcomplete-help)) (funcall #'Info-goto-node pcomplete-help))
(if pcomplete-man-function (if pcomplete-man-function
(let ((cmd (funcall pcomplete-command-name-function))) (let ((cmd (funcall pcomplete-command-name-function)))
(if (and cmd (> (length cmd) 0)) (if (and cmd (> (length cmd) 0))
@ -1297,7 +1285,7 @@ If specific documentation can't be given, be generic."
(defun pcomplete-process-result (cmd &rest args) (defun pcomplete-process-result (cmd &rest args)
"Call CMD using `call-process' and return the simplest result." "Call CMD using `call-process' and return the simplest result."
(with-temp-buffer (with-temp-buffer
(apply 'call-process cmd nil t nil args) (apply #'call-process cmd nil t nil args)
(skip-chars-backward "\n") (skip-chars-backward "\n")
(buffer-substring (point-min) (point)))) (buffer-substring (point-min) (point))))