1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-14 09:39:42 +00:00
emacs/lisp/pcmpl-gnu.el

434 lines
16 KiB
EmacsLisp
Raw Normal View History

;;; pcmpl-gnu.el --- completions for GNU project tools -*- lexical-binding: t -*-
2000-06-27 10:55:46 +00:00
2022-01-01 07:45:51 +00:00
;; Copyright (C) 1999-2022 Free Software Foundation, Inc.
2000-06-27 10:55:46 +00:00
;; Package: pcomplete
2000-06-27 10:55:46 +00:00
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
2000-06-27 10:55:46 +00:00
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
2000-06-27 10:55:46 +00:00
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
2000-06-27 10:55:46 +00:00
;;; Commentary:
2000-06-27 10:55:46 +00:00
;;; Code:
(provide 'pcmpl-gnu)
(require 'pcomplete)
(require 'pcmpl-unix)
(defgroup pcmpl-gnu nil
"Completions for GNU project tools."
:group 'pcomplete)
;; User Variables:
(defcustom pcmpl-gnu-makefile-regexps
'("\\`GNUmakefile" "\\`[Mm]akefile" "\\.ma?k\\'")
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"A list of regexps that will match Makefile names."
:type '(repeat regexp))
2000-06-27 10:55:46 +00:00
(defcustom pcmpl-gnu-makefile-includes t
"If non-nil, `pcomplete/make' completes on targets in included files."
:type 'boolean
:version "27.1"
:safe 'booleanp)
2000-06-27 10:55:46 +00:00
;; Functions:
;;;###autoload
(defun pcomplete/gzip ()
"Completion for `gzip'."
(let ((pcomplete-help "(gzip)"))
(pcomplete-opt "cdfhlLnNqrStvV123456789")
(while (pcomplete-here
(pcmpl-gnu-zipped-files
(catch 'has-d-flag
(let ((args pcomplete-args))
(while args
(if (string-match "\\`-.*[dt]" (car args))
(throw 'has-d-flag t))
(setq args (cdr args))))))))))
(defun pcmpl-gnu-zipped-files (unzip-p)
"Find all zipped or unzipped files: the inverse of UNZIP-P."
(pcomplete-entries
nil
(lambda (entry)
(or (file-directory-p entry)
(when (and (file-readable-p entry)
(file-regular-p entry))
(let ((zipped (string-match "\\.\\(t?gz\\|\\(ta\\)?Z\\)\\'"
entry)))
(or (and unzip-p zipped)
(and (not unzip-p) (not zipped)))))))))
2000-06-27 10:55:46 +00:00
;;;###autoload
(defun pcomplete/bzip2 ()
"Completion for `bzip2'."
(pcomplete-opt "hdzkftcqvLVs123456789")
(while (pcomplete-here
(pcmpl-gnu-bzipped-files
(catch 'has-d-flag
(let ((args pcomplete-args))
(while args
(if (string-match "\\`-.*[dt]" (car args))
(throw 'has-d-flag t))
(setq args (cdr args)))))))))
(defun pcmpl-gnu-bzipped-files (unzip-p)
"Find all zipped or unzipped files: the inverse of UNZIP-P."
(pcomplete-entries
nil
(lambda (entry)
(when (and (file-readable-p entry)
(file-regular-p entry))
(let ((zipped (string-match "\\.\\(t?z2\\|bz2\\)\\'" entry)))
(or (and unzip-p zipped)
(and (not unzip-p) (not zipped))))))))
2000-06-27 10:55:46 +00:00
;;;###autoload
(defun pcomplete/make ()
"Completion for GNU `make'."
(let ((pcomplete-help "(make)Top"))
(pcomplete-opt "bmC/def(pcmpl-gnu-makefile-names)hiI/j?kl?no.pqrsStvwW.")
(while (pcomplete-here (completion-table-in-turn
(pcmpl-gnu-make-rule-names)
(pcomplete-entries))
Use `declare` instead of `def-edebug-spec` in most places * lisp/speedbar.el: Use lexical-binding. (speedbar-with-writable): Use `declare`. * lisp/subr.el (def-edebug-spec): Use `declare`. * lisp/cedet/ede/base.el: Use lexical-binding. (ede-with-projectfile): Use `declare`. (recentf-exclude): Declare var. * lisp/cedet/ede/pmake.el: Use lexical-binding. (ede-pmake-insert-variable-shared, ede-pmake-insert-variable-once): Use `declare`. * lisp/cedet/ede/proj-comp.el: Use lexical-binding. (ede-compiler-begin-unique, ede-compiler-only-once) (ede-linker-begin-unique, ede-linker-only-once): Use `declare`. * lisp/cedet/semantic/ctxt.el: Use lexical-binding. (semantic-with-buffer-narrowed-to-context) (semantic-with-buffer-narrowed-to-command): Use `declare`. (semantic--progress-reporter): Declare var. (semantic-ctxt-end-of-symbol-default): Remove unused var `fieldsep`. * lisp/cedet/semantic/lex-spp.el: Use lexical-binding. (define-lex-spp-macro-declaration-analyzer) (define-lex-spp-include-analyzer, semantic-lex-with-macro-used) (define-lex-spp-macro-undeclaration-analyzer): Use `declare`. (semantic-lex-spp-symbol-remove): Rename arg to avoid colliding with dynamic variable `obarray`. (semantic-lex-spp-symbol-pop): Remove unused var `oldvalue`. (semantic-lex-spp-lex-text-string): Remove unused var `analyzer`. * lisp/cedet/semantic/lex.el (define-lex) (semantic-lex-unterminated-syntax-protection, define-lex-analyzer) (define-lex-regex-analyzer, define-lex-block-analyzer) (semantic-lex-catch-errors): Use `declare`. * lisp/cedet/semantic/tag.el: Use lexical-binding. (semantic-with-buffer-narrowed-to-current-tag) (semantic-with-buffer-narrowed-to-tag): Use `declare`. * lisp/cedet/semantic/wisent.el: Use lexical-binding. (define-wisent-lexer): Use `declare`. * lisp/emacs-lisp/cl-lib.el (cl-pushnew): The arg to :test can be any form not just function form. * lisp/org/ob-comint.el (org-babel-comint-in-buffer) (org-babel-comint-with-output): Use `declare`. * lisp/org/ob-core.el (org-babel-map-src-blocks): Use `declare`. (org-babel-result-cond): Simplify edebug spec. * lisp/org/org-clock.el (org-with-clock-position, org-with-clock): * lisp/org/org-agenda.el (org-agenda-with-point-at-orig-entry): * lisp/org/ob-tangle.el (org-babel-with-temp-filebuffer): Use `declare`. * lisp/textmodes/rst.el (push): Remove redundant edebug spec. * lisp/vc/pcvs-parse.el: Use lexical-binding. (cvs-parse-buffer): Rename arg to avoid dynbound conflict. (cvs-or): Use `declare`.
2021-02-12 21:08:01 +00:00
nil #'identity))))
2000-06-27 10:55:46 +00:00
(defun pcmpl-gnu-makefile-names ()
"Return a list of possible makefile names."
(pcomplete-entries (mapconcat 'identity pcmpl-gnu-makefile-regexps "\\|")))
2000-06-27 10:55:46 +00:00
(defun pcmpl-gnu-make-targets (targets)
"Add to TARGETS the list of makefile targets in the current buffer.
Return the new list."
(goto-char (point-min))
(while (re-search-forward
"^\\([^\t\n#%.$][^:=\n]*\\)\\s-*:[^=]" nil t)
(setq targets (nconc (split-string (match-string-no-properties 1))
targets)))
targets)
(defun pcmpl-gnu-make-includes ()
"Return a list of all included file names in the current buffer."
(let (filenames)
(goto-char (point-min))
(while (search-forward-regexp "^include +\\(.*\\)$" nil t)
(push (match-string-no-properties 1) filenames))
filenames))
(defun pcmpl-gnu-make-all-targets (makefile targets)
"Add to TARGETS the list of target names in MAKEFILE and files it includes.
Return the new list."
(with-temp-buffer
(with-demoted-errors "Error inserting makefile: %S"
(insert-file-contents makefile))
(let ((filenames (when pcmpl-gnu-makefile-includes (pcmpl-gnu-make-includes))))
(setq targets (pcmpl-gnu-make-targets targets))
(dolist (file filenames)
(when (file-readable-p file)
(setq targets (pcmpl-gnu-make-all-targets file targets))))
))
targets)
2000-06-27 10:55:46 +00:00
(defun pcmpl-gnu-make-rule-names ()
"Return a list of possible make targets in a makefile in the current directory."
2000-06-27 10:55:46 +00:00
(let* ((minus-f (member "-f" pcomplete-args))
2000-08-29 00:47:45 +00:00
(makefile (or (cadr minus-f)
(cond
((file-exists-p "GNUmakefile") "GNUmakefile")
((file-exists-p "makefile") "makefile")
(t "Makefile"))))
2000-06-27 10:55:46 +00:00
rules)
(if (not (file-readable-p makefile))
(unless minus-f (list "-f"))
(setq rules (pcmpl-gnu-make-all-targets makefile rules))
(pcomplete-uniquify-list rules))))
2000-06-27 10:55:46 +00:00
(defcustom pcmpl-gnu-tarfile-regexp
"\\.t\\(ar\\(\\.\\(gz\\|bz2\\|Z\\|xz\\)\\)?\\|gz\\|a[zZ]\\|z2\\)\\'"
* align.el: * allout.el: * apropos.el: * arc-mode.el: * autoinsert.el: * avoid.el: * battery.el: * bookmark.el: * buff-menu.el: * calculator.el: * chistory.el: * cmuscheme.el: * comint.el: * compare-w.el: * dabbrev.el: * delim-col.el: * desktop.el: * diff-mode.el: * diff.el: * dired-aux.el: * dired-x.el: * dired.el: * dos-vars.el: * ediff-diff.el: * ediff-help.el: * ediff-init.el: * ediff-merg.el: * ediff-mult.el: * ediff-ptch.el: * ediff-vers.el: * ediff-wind.el: * ediff.el: * emerge.el: * facemenu.el: * faces.el: * ffap.el: * filecache.el: * find-dired.el: * font-core.el: * font-lock.el: * forms.el: * fringe.el: * help-at-pt.el: * hippie-exp.el: * ido.el: * image-file.el: * imenu.el: * indent.el: * info.el: * isearchb.el: * iswitchb.el: * jit-lock.el: * jka-compr.el: * log-edit.el: * lpr.el: * ls-lisp.el: * man.el: * menu-bar.el: * midnight.el: * mouse-sel.el: * mouse.el: * msb.el: * outline.el: * paren.el: * pcmpl-cvs.el: * pcmpl-gnu.el: * pcomplete.el: * pcvs-info.el: * pcvs-parse.el: * printing.el: * ps-mule.el: * ps-print.el: * replace.el: * ruler-mode.el: * saveplace.el: * sb-image.el: * scroll-bar.el: * sha1.el: * shadowfile.el: * shell.el: * sort.el: * speedbar.el: * strokes.el: * tempo.el: * term.el: * terminal.el: * time-stamp.el: * time.el: * tree-widget.el: * type-break.el: * vc-cvs.el: * vc-hg.el: * vc-mcvs.el: * vc-rcs.el: * vc-sccs.el: * vc.el: * view.el: * w32-vars.el: * whitespace.el: * wid-edit.el: Remove leading * from docstrings of defcustoms, deffaces, defconsts and defuns.
2008-12-03 05:48:14 +00:00
"A regexp which matches any tar archive."
:version "24.3" ; added xz
:type 'regexp)
2000-06-27 10:55:46 +00:00
;; Only used in tar-mode buffers.
(defvar tar-parse-info)
(declare-function tar-header-name "tar-mode" t t)
(defmacro pcmpl-gnu-with-file-buffer (file &rest body)
"Run BODY inside a buffer visiting FILE."
(declare (debug t) (indent 1))
(let ((exist (make-symbol "exist"))
(filesym (make-symbol "file"))
(buf (make-symbol "buf")))
`(let* ((,filesym ,file)
(,exist (find-buffer-visiting ,filesym))
(,buf (or ,exist (find-file-noselect ,filesym))))
(unwind-protect
(with-current-buffer ,buf
,@body)
(when (and (not ,exist) (buffer-live-p ,buf))
(kill-buffer ,buf))))))
2000-06-27 10:55:46 +00:00
;;;###autoload
(defun pcomplete/tar ()
"Completion for the GNU tar utility."
;; options that end in an equal sign will want further completion...
(let (saw-option complete-within)
(while (pcomplete-match "^-" 0)
(setq saw-option t)
(if (pcomplete-match "^--" 0)
(if (pcomplete-match "^--\\([^= \t\n\f]*\\)\\'" 0)
;; FIXME: Extract this list from "tar --help".
(pcomplete-here*
'("--absolute-names"
"--after-date="
"--append"
"--atime-preserve"
"--backup"
"--block-number"
"--blocking-factor="
"--catenate"
"--checkpoint"
"--compare"
"--compress"
"--concatenate"
"--confirmation"
"--create"
"--delete"
"--dereference"
"--diff"
"--directory="
"--exclude="
"--exclude-from="
"--extract"
"--file="
"--files-from="
"--force-local"
"--get"
"--group="
"--gzip"
"--help"
"--ignore-failed-read"
"--ignore-zeros"
"--incremental"
"--info-script="
"--interactive"
"--keep-old-files"
"--label="
"--list"
"--listed-incremental"
"--mode="
"--modification-time"
"--multi-volume"
"--new-volume-script="
"--newer="
"--newer-mtime"
"--no-recursion"
"--null"
"--numeric-owner"
"--old-archive"
"--one-file-system"
"--owner="
"--portability"
"--posix"
"--preserve"
"--preserve-order"
"--preserve-permissions"
"--read-full-records"
"--record-size="
"--recursive-unlink"
"--remove-files"
"--rsh-command="
"--same-order"
"--same-owner"
"--same-permissions"
"--sparse"
"--starting-file="
"--suffix="
"--tape-length="
"--to-stdout"
"--totals"
"--uncompress"
"--ungzip"
"--unlink-first"
"--update"
"--use-compress-program="
"--verbose"
"--verify"
"--version"
"--volno-file=")))
(pcomplete-opt "01234567ABCFGKLMNOPRSTUVWXZbcdfghiklmoprstuvwxz"))
(cond
((pcomplete-match "\\`-\\'" 0)
(pcomplete-here*))
((pcomplete-match "\\`--after-date=" 0)
(pcomplete-here*))
((pcomplete-match "\\`--backup=" 0)
(pcomplete-here*))
((pcomplete-match "\\`--blocking-factor=" 0)
(pcomplete-here*))
((pcomplete-match "\\`--directory=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-dirs)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--exclude-from=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-entries)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--exclude=" 0)
(pcomplete-here*))
((pcomplete-match "\\`--\\(extract\\|list\\)\\'" 0)
(setq complete-within t))
((pcomplete-match "\\`--file=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-dirs-or-entries pcmpl-gnu-tarfile-regexp)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--files-from=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-entries)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--group=\\(.*\\)" 0)
(pcomplete-here* (pcmpl-unix-group-names)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--info-script=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-entries)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--label=" 0)
(pcomplete-here*))
((pcomplete-match "\\`--mode=" 0)
(pcomplete-here*))
((pcomplete-match "\\`--new-volume-script=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-entries)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--newer=" 0)
(pcomplete-here*))
((pcomplete-match "\\`--owner=\\(.*\\)" 0)
(pcomplete-here* (pcmpl-unix-user-names)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--record-size=" 0)
(pcomplete-here*))
((pcomplete-match "\\`--rsh-command=\\(.*\\)" 0)
(pcomplete-here* (funcall pcomplete-command-completion-function)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--starting-file=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-entries)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--suffix=" 0)
(pcomplete-here*))
((pcomplete-match "\\`--tape-length=" 0)
(pcomplete-here*))
((pcomplete-match "\\`--use-compress-program=\\(.*\\)" 0)
(pcomplete-here* (funcall pcomplete-command-completion-function)
(pcomplete-match-string 1 0)))
((pcomplete-match "\\`--volno-file=\\(.*\\)" 0)
(pcomplete-here* (pcomplete-entries)
(pcomplete-match-string 1 0)))))
2000-06-27 10:55:46 +00:00
(unless saw-option
(pcomplete-here
Use `declare` instead of `def-edebug-spec` in most places * lisp/speedbar.el: Use lexical-binding. (speedbar-with-writable): Use `declare`. * lisp/subr.el (def-edebug-spec): Use `declare`. * lisp/cedet/ede/base.el: Use lexical-binding. (ede-with-projectfile): Use `declare`. (recentf-exclude): Declare var. * lisp/cedet/ede/pmake.el: Use lexical-binding. (ede-pmake-insert-variable-shared, ede-pmake-insert-variable-once): Use `declare`. * lisp/cedet/ede/proj-comp.el: Use lexical-binding. (ede-compiler-begin-unique, ede-compiler-only-once) (ede-linker-begin-unique, ede-linker-only-once): Use `declare`. * lisp/cedet/semantic/ctxt.el: Use lexical-binding. (semantic-with-buffer-narrowed-to-context) (semantic-with-buffer-narrowed-to-command): Use `declare`. (semantic--progress-reporter): Declare var. (semantic-ctxt-end-of-symbol-default): Remove unused var `fieldsep`. * lisp/cedet/semantic/lex-spp.el: Use lexical-binding. (define-lex-spp-macro-declaration-analyzer) (define-lex-spp-include-analyzer, semantic-lex-with-macro-used) (define-lex-spp-macro-undeclaration-analyzer): Use `declare`. (semantic-lex-spp-symbol-remove): Rename arg to avoid colliding with dynamic variable `obarray`. (semantic-lex-spp-symbol-pop): Remove unused var `oldvalue`. (semantic-lex-spp-lex-text-string): Remove unused var `analyzer`. * lisp/cedet/semantic/lex.el (define-lex) (semantic-lex-unterminated-syntax-protection, define-lex-analyzer) (define-lex-regex-analyzer, define-lex-block-analyzer) (semantic-lex-catch-errors): Use `declare`. * lisp/cedet/semantic/tag.el: Use lexical-binding. (semantic-with-buffer-narrowed-to-current-tag) (semantic-with-buffer-narrowed-to-tag): Use `declare`. * lisp/cedet/semantic/wisent.el: Use lexical-binding. (define-wisent-lexer): Use `declare`. * lisp/emacs-lisp/cl-lib.el (cl-pushnew): The arg to :test can be any form not just function form. * lisp/org/ob-comint.el (org-babel-comint-in-buffer) (org-babel-comint-with-output): Use `declare`. * lisp/org/ob-core.el (org-babel-map-src-blocks): Use `declare`. (org-babel-result-cond): Simplify edebug spec. * lisp/org/org-clock.el (org-with-clock-position, org-with-clock): * lisp/org/org-agenda.el (org-agenda-with-point-at-orig-entry): * lisp/org/ob-tangle.el (org-babel-with-temp-filebuffer): Use `declare`. * lisp/textmodes/rst.el (push): Remove redundant edebug spec. * lisp/vc/pcvs-parse.el: Use lexical-binding. (cvs-parse-buffer): Rename arg to avoid dynbound conflict. (cvs-or): Use `declare`.
2021-02-12 21:08:01 +00:00
(mapcar #'char-to-string
2000-06-27 10:55:46 +00:00
(string-to-list
"01234567ABCFGIKLMNOPRSTUVWXZbcdfghiklmoprstuvwxz")))
(if (pcomplete-match "[xt]" 'first 1)
(setq complete-within t)))
(pcomplete-here (pcomplete-dirs-or-entries pcmpl-gnu-tarfile-regexp))
(while (pcomplete-here
(if (and complete-within
(let* ((fa (file-attributes (pcomplete-arg 1)))
file-attributes cleanup Mostly, this replaces magic-number calls like (nth 4 A) with more-informative calls like (file-attribute-access-time A). It also fixes some documentation and minor timestamp coding issues that I noticed while looking into this. * doc/lispref/files.texi (File Attributes): * lisp/files.el (file-attribute-size) (file-attribute-inode-number, file-attribute-device-number): * src/dired.c (Fdirectory_files_and_attributes) (Ffile_attributes): Mention which attributes must be integers, or nonnegative integers, as opposed to merely being numbers. Remove no-longer-correct talk about representing large integers as conses of integers. * doc/lispref/files.texi (Magic File Names): * doc/misc/gnus.texi (Low-level interface to the spam-stat dictionary): * lisp/autorevert.el (auto-revert-find-file-function) (auto-revert-tail-mode, auto-revert-handler): * lisp/auth-source.el (auth-source-netrc-parse): * lisp/cedet/ede/files.el (ede--inode-for-dir): * lisp/cedet/semantic/db-file.el (object-write): * lisp/cedet/semantic/db-mode.el (semanticdb-kill-hook): * lisp/cedet/semantic/db.el (semanticdb-needs-refresh-p) (semanticdb-synchronize): * lisp/cedet/srecode/table.el (srecode-mode-table-new): * lisp/desktop.el (desktop-save, desktop-read): * lisp/dired-aux.el (dired-file-set-difference) (dired-do-chxxx, dired-do-chmod, dired-copy-file-recursive) (dired-create-files): * lisp/dired.el (dired-directory-changed-p, dired-readin): * lisp/dos-w32.el (w32-direct-print-region-helper): * lisp/emacs-lisp/autoload.el (autoload-generate-file-autoloads) (autoload-find-destination, update-directory-autoloads): * lisp/emacs-lisp/shadow.el (load-path-shadows-same-file-or-nonexistent): * lisp/epg.el (epg--start, epg-wait-for-completion): * lisp/eshell/em-ls.el (eshell-ls-filetype-p) (eshell-ls-applicable, eshell-ls-size-string) (eshell-ls-file, eshell-ls-dir, eshell-ls-files) (eshell-ls-entries): * lisp/eshell/em-pred.el (eshell-predicate-alist) (eshell-pred-file-type, eshell-pred-file-links) (eshell-pred-file-size): * lisp/eshell/em-unix.el (eshell-shuffle-files, eshell/cat) (eshell-du-sum-directory, eshell/du): * lisp/eshell/esh-util.el (eshell-read-passwd) (eshell-read-hosts): * lisp/files.el (remote-file-name-inhibit-cache) (find-file-noselect, insert-file-1, dir-locals-find-file) (dir-locals-read-from-dir, backup-buffer) (file-ownership-preserved-p, copy-directory) (read-file-modes): * lisp/find-lisp.el (find-lisp-format): * lisp/gnus/gnus-agent.el (gnus-agent-unfetch-articles) (gnus-agent-read-agentview, gnus-agent-expire-group-1) (gnus-agent-request-article, gnus-agent-regenerate-group) (gnus-agent-update-files-total-fetched-for) (gnus-agent-update-view-total-fetched-for): * lisp/gnus/gnus-cache.el (gnus-cache-read-active) (gnus-cache-update-file-total-fetched-for) (gnus-cache-update-overview-total-fetched-for): * lisp/gnus/gnus-cloud.el (gnus-cloud-file-new-p): * lisp/gnus/gnus-score.el (gnus-score-score-files): * lisp/gnus/gnus-start.el (gnus-save-newsrc-file) (gnus-master-read-slave-newsrc): * lisp/gnus/gnus-sum.el (gnus-summary-import-article): * lisp/gnus/gnus-util.el (gnus-file-newer-than) (gnus-cache-file-contents): * lisp/gnus/mail-source.el (mail-source-delete-old-incoming) (mail-source-callback, mail-source-movemail): * lisp/gnus/nneething.el (nneething-create-mapping) (nneething-make-head): * lisp/gnus/nnfolder.el (nnfolder-read-folder): * lisp/gnus/nnheader.el (nnheader-file-size) (nnheader-insert-nov-file): * lisp/gnus/nnmail.el (nnmail-activate): * lisp/gnus/nnmaildir.el (nnmaildir--group-maxnum) (nnmaildir--new-number, nnmaildir--update-nov) (nnmaildir--scan, nnmaildir-request-scan) (nnmaildir-request-update-info) (nnmaildir-request-expire-articles): * lisp/gnus/nnmh.el (nnmh-request-list-1) (nnmh-request-expire-articles, nnmh-update-gnus-unreads): * lisp/gnus/nnml.el (nnml-request-expire-articles): * lisp/gnus/spam-stat.el (spam-stat-save, spam-stat-load) (spam-stat-process-directory, spam-stat-test-directory): * lisp/ido.el (ido-directory-too-big-p) (ido-file-name-all-completions): * lisp/image-dired.el (image-dired-get-thumbnail-image) (image-dired-create-thumb-1): * lisp/info.el (info-insert-file-contents): * lisp/ls-lisp.el (ls-lisp-insert-directory) (ls-lisp-handle-switches, ls-lisp-classify-file) (ls-lisp-format): * lisp/mail/blessmail.el: * lisp/mail/feedmail.el (feedmail-default-date-generator) (feedmail-default-message-id-generator): * lisp/mail/mailabbrev.el (mail-abbrevs-sync-aliases) (mail-abbrevs-setup): * lisp/mail/mspools.el (mspools-size-folder): * lisp/mail/rmail.el (rmail-insert-inbox-text): * lisp/mail/sendmail.el (sendmail-sync-aliases): * lisp/mh-e/mh-alias.el (mh-alias-tstamp): * lisp/net/ange-ftp.el (ange-ftp-parse-netrc) (ange-ftp-write-region, ange-ftp-file-newer-than-file-p) (ange-ftp-cf1): * lisp/net/eudcb-mab.el (eudc-mab-query-internal): * lisp/net/eww.el (eww-read-bookmarks): * lisp/net/netrc.el (netrc-parse): * lisp/net/newst-backend.el (newsticker--image-get): * lisp/nxml/rng-loc.el (rng-get-parsed-schema-locating-file): * lisp/obsolete/fast-lock.el (fast-lock-save-cache): * lisp/obsolete/vc-arch.el (vc-arch-state) (vc-arch-diff3-rej-p): * lisp/org/ob-eval.el (org-babel--shell-command-on-region): * lisp/org/org-attach.el (org-attach-commit): * lisp/org/org-macro.el (org-macro-initialize-templates): * lisp/org/org.el (org-babel-load-file) (org-file-newer-than-p): * lisp/org/ox-html.el (org-html-format-spec): * lisp/org/ox-publish.el (org-publish-find-date) (org-publish-cache-ctime-of-src): * lisp/pcmpl-gnu.el (pcomplete/tar): * lisp/pcmpl-rpm.el (pcmpl-rpm-packages): * lisp/play/cookie1.el (cookie-snarf): * lisp/progmodes/cmacexp.el (c-macro-expansion): * lisp/ps-bdf.el (bdf-file-mod-time): * lisp/server.el (server-ensure-safe-dir): * lisp/simple.el (shell-command-on-region): * lisp/speedbar.el (speedbar-item-info-file-helper) (speedbar-check-obj-this-line): * lisp/thumbs.el (thumbs-cleanup-thumbsdir): * lisp/time.el (display-time-mail-check-directory) (display-time-file-nonempty-p): * lisp/url/url-cache.el (url-is-cached): * lisp/url/url-file.el (url-file-asynch-callback): * lisp/vc/diff-mode.el (diff-delete-if-empty): * lisp/vc/pcvs-info.el (cvs-fileinfo-from-entries): * lisp/vc/vc-bzr.el (vc-bzr-state-heuristic): * lisp/vc/vc-cvs.el (vc-cvs-checkout-model) (vc-cvs-state-heuristic, vc-cvs-merge-news) (vc-cvs-retrieve-tag, vc-cvs-parse-status, vc-cvs-parse-entry): * lisp/vc/vc-hg.el (vc-hg--slurp-hgignore-1) (vc-hg--ignore-patterns-valid-p) (vc-hg--cached-dirstate-search, vc-hg-state-fast): * lisp/vc/vc-hooks.el (vc-after-save): * lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer): * lisp/vc/vc-svn.el (vc-svn-merge-news, vc-svn-parse-status): * lisp/vc/vc.el (vc-checkout, vc-checkin, vc-revert-file): * lisp/xdg.el (xdg-mime-apps): Prefer (file-attribute-size A) to (nth 7 A), and similarly for other file attributes accessors. * doc/lispref/files.texi (File Attributes): * doc/lispref/intro.texi (Version Info): * doc/lispref/os.texi (Idle Timers): * lisp/erc/erc.el (erc-string-to-emacs-time): * lisp/files.el (file-attribute-access-time) (file-attribute-modification-time) (file-attribute-status-change-time): * lisp/net/tramp-compat.el: (tramp-compat-file-attribute-modification-time) (tramp-compat-file-attribute-size): * src/buffer.c (syms_of_buffer): * src/editfns.c (Fget_internal_run_time): * src/fileio.c (Fvisited_file_modtime) (Fset_visited_file_modtime): * src/keyboard.c (Fcurrent_idle_time): * src/process.c (Fprocess_attributes): Defer implementation details about timestamp format to the section that talks about timestamp format, to make it easier to change the documentation later if timestamp formats are extended. * lisp/gnus/gnus-util.el (gnus-file-newer-than): * lisp/speedbar.el (speedbar-check-obj-this-line): * lisp/vc/vc-rcs.el (vc-rcs-workfile-is-newer): Prefer time-less-p to doing it by hand. * lisp/ls-lisp.el (ls-lisp-format): Inode numbers are no longer conses. * lisp/vc/vc-bzr.el (vc-bzr-state-heuristic): Use eql, not eq, to compare integers that might be bignums. * lisp/org/ox-publish.el (org-publish-cache-ctime-of-src): Prefer float-time to doing time arithmetic by hand.
2018-09-24 01:30:46 +00:00
(size (file-attribute-size fa)))
(and (numberp size)
(or (null large-file-warning-threshold)
(< size large-file-warning-threshold)))))
(let ((file (pcomplete-arg 1)))
(completion-table-dynamic
(lambda (_string)
(pcmpl-gnu-with-file-buffer
file (mapcar #'tar-header-name tar-parse-info)))))
2000-06-27 10:55:46 +00:00
(pcomplete-entries))
Use `declare` instead of `def-edebug-spec` in most places * lisp/speedbar.el: Use lexical-binding. (speedbar-with-writable): Use `declare`. * lisp/subr.el (def-edebug-spec): Use `declare`. * lisp/cedet/ede/base.el: Use lexical-binding. (ede-with-projectfile): Use `declare`. (recentf-exclude): Declare var. * lisp/cedet/ede/pmake.el: Use lexical-binding. (ede-pmake-insert-variable-shared, ede-pmake-insert-variable-once): Use `declare`. * lisp/cedet/ede/proj-comp.el: Use lexical-binding. (ede-compiler-begin-unique, ede-compiler-only-once) (ede-linker-begin-unique, ede-linker-only-once): Use `declare`. * lisp/cedet/semantic/ctxt.el: Use lexical-binding. (semantic-with-buffer-narrowed-to-context) (semantic-with-buffer-narrowed-to-command): Use `declare`. (semantic--progress-reporter): Declare var. (semantic-ctxt-end-of-symbol-default): Remove unused var `fieldsep`. * lisp/cedet/semantic/lex-spp.el: Use lexical-binding. (define-lex-spp-macro-declaration-analyzer) (define-lex-spp-include-analyzer, semantic-lex-with-macro-used) (define-lex-spp-macro-undeclaration-analyzer): Use `declare`. (semantic-lex-spp-symbol-remove): Rename arg to avoid colliding with dynamic variable `obarray`. (semantic-lex-spp-symbol-pop): Remove unused var `oldvalue`. (semantic-lex-spp-lex-text-string): Remove unused var `analyzer`. * lisp/cedet/semantic/lex.el (define-lex) (semantic-lex-unterminated-syntax-protection, define-lex-analyzer) (define-lex-regex-analyzer, define-lex-block-analyzer) (semantic-lex-catch-errors): Use `declare`. * lisp/cedet/semantic/tag.el: Use lexical-binding. (semantic-with-buffer-narrowed-to-current-tag) (semantic-with-buffer-narrowed-to-tag): Use `declare`. * lisp/cedet/semantic/wisent.el: Use lexical-binding. (define-wisent-lexer): Use `declare`. * lisp/emacs-lisp/cl-lib.el (cl-pushnew): The arg to :test can be any form not just function form. * lisp/org/ob-comint.el (org-babel-comint-in-buffer) (org-babel-comint-with-output): Use `declare`. * lisp/org/ob-core.el (org-babel-map-src-blocks): Use `declare`. (org-babel-result-cond): Simplify edebug spec. * lisp/org/org-clock.el (org-with-clock-position, org-with-clock): * lisp/org/org-agenda.el (org-agenda-with-point-at-orig-entry): * lisp/org/ob-tangle.el (org-babel-with-temp-filebuffer): Use `declare`. * lisp/textmodes/rst.el (push): Remove redundant edebug spec. * lisp/vc/pcvs-parse.el: Use lexical-binding. (cvs-parse-buffer): Rename arg to avoid dynbound conflict. (cvs-or): Use `declare`.
2021-02-12 21:08:01 +00:00
nil #'identity))))
2000-06-27 10:55:46 +00:00
;;;###autoload
(defun pcomplete/find ()
"Completion for the GNU find utility."
(let ((prec (pcomplete-arg 'last -1)))
(cond ((and (pcomplete-match "^-" 'last)
(string= "find" prec))
(pcomplete-opt "HLPDO"))
((pcomplete-match "^-" 'last)
(while (pcomplete-here
'("-amin" "-anewer" "-atime" "-cmin" "-cnewer" "-context"
"-ctime" "-daystart" "-delete" "-depth" "-empty" "-exec"
"-execdir" "-executable" "-false" "-fls" "-follow"
"-fprint" "-fprint0" "-fprintf" "-fstype" "-gid" "-group"
"-help" "-ignore_readdir_race" "-ilname" "-iname"
"-inum" "-ipath" "-iregex" "-iwholename"
"-links" "-lname" "-ls" "-maxdepth"
"-mindepth" "-mmin" "-mount" "-mtime"
"-name" "-newer" "-nogroup" "-noignore_readdir_race"
"-noleaf" "-nouser" "-nowarn" "-ok"
"-okdir" "-path" "-perm" "-print"
"-print0" "-printf" "-prune" "-quit"
"-readable" "-regex" "-regextype" "-samefile"
"-size" "-true" "-type" "-uid"
"-used" "-user" "-version" "-warn"
"-wholename" "-writable" "-xdev" "-xtype"))))
((string= "-type" prec)
(while (pcomplete-here (list "b" "c" "d" "p" "f" "l" "s" "D"))))
((string= "-xtype" prec)
(while (pcomplete-here (list "b" "c" "d" "p" "f" "l" "s"))))
((or (string= prec "-exec")
(string= prec "-execdir"))
(while (pcomplete-here* (funcall pcomplete-command-completion-function)
(pcomplete-arg 'last) t))))
Use `declare` instead of `def-edebug-spec` in most places * lisp/speedbar.el: Use lexical-binding. (speedbar-with-writable): Use `declare`. * lisp/subr.el (def-edebug-spec): Use `declare`. * lisp/cedet/ede/base.el: Use lexical-binding. (ede-with-projectfile): Use `declare`. (recentf-exclude): Declare var. * lisp/cedet/ede/pmake.el: Use lexical-binding. (ede-pmake-insert-variable-shared, ede-pmake-insert-variable-once): Use `declare`. * lisp/cedet/ede/proj-comp.el: Use lexical-binding. (ede-compiler-begin-unique, ede-compiler-only-once) (ede-linker-begin-unique, ede-linker-only-once): Use `declare`. * lisp/cedet/semantic/ctxt.el: Use lexical-binding. (semantic-with-buffer-narrowed-to-context) (semantic-with-buffer-narrowed-to-command): Use `declare`. (semantic--progress-reporter): Declare var. (semantic-ctxt-end-of-symbol-default): Remove unused var `fieldsep`. * lisp/cedet/semantic/lex-spp.el: Use lexical-binding. (define-lex-spp-macro-declaration-analyzer) (define-lex-spp-include-analyzer, semantic-lex-with-macro-used) (define-lex-spp-macro-undeclaration-analyzer): Use `declare`. (semantic-lex-spp-symbol-remove): Rename arg to avoid colliding with dynamic variable `obarray`. (semantic-lex-spp-symbol-pop): Remove unused var `oldvalue`. (semantic-lex-spp-lex-text-string): Remove unused var `analyzer`. * lisp/cedet/semantic/lex.el (define-lex) (semantic-lex-unterminated-syntax-protection, define-lex-analyzer) (define-lex-regex-analyzer, define-lex-block-analyzer) (semantic-lex-catch-errors): Use `declare`. * lisp/cedet/semantic/tag.el: Use lexical-binding. (semantic-with-buffer-narrowed-to-current-tag) (semantic-with-buffer-narrowed-to-tag): Use `declare`. * lisp/cedet/semantic/wisent.el: Use lexical-binding. (define-wisent-lexer): Use `declare`. * lisp/emacs-lisp/cl-lib.el (cl-pushnew): The arg to :test can be any form not just function form. * lisp/org/ob-comint.el (org-babel-comint-in-buffer) (org-babel-comint-with-output): Use `declare`. * lisp/org/ob-core.el (org-babel-map-src-blocks): Use `declare`. (org-babel-result-cond): Simplify edebug spec. * lisp/org/org-clock.el (org-with-clock-position, org-with-clock): * lisp/org/org-agenda.el (org-agenda-with-point-at-orig-entry): * lisp/org/ob-tangle.el (org-babel-with-temp-filebuffer): Use `declare`. * lisp/textmodes/rst.el (push): Remove redundant edebug spec. * lisp/vc/pcvs-parse.el: Use lexical-binding. (cvs-parse-buffer): Rename arg to avoid dynbound conflict. (cvs-or): Use `declare`.
2021-02-12 21:08:01 +00:00
(while (pcomplete-here (pcomplete-dirs) nil #'identity))))
2000-06-27 10:55:46 +00:00
;;;###autoload
(defun pcomplete/awk ()
"Completion for the `awk' command."
(pcomplete-here-using-help "awk --help"
:margin "\t"
:separator " +"
:description "\0"
:metavar "[=a-z]+"))
;;;###autoload
(defun pcomplete/gpg ()
"Completion for the `gpg` command."
(pcomplete-here-using-help "gpg --help" :narrow-end "^ -se"))
;;;###autoload
(defun pcomplete/gdb ()
"Completion for the `gdb' command."
(while
(cond
((string= "--args" (pcomplete-arg 1))
(funcall pcomplete-command-completion-function)
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
pcomplete-default-completion-function)))
((string-prefix-p "-" (pcomplete-arg 0))
(pcomplete-here (pcomplete-from-help "gdb --help")))
(t (pcomplete-here (pcomplete-entries))))))
;;;###autoload
(defun pcomplete/emacs ()
"Completion for the `emacs' command."
(pcomplete-here-using-help "emacs --help" :margin "^\\(\\)-"))
;;;###autoload
(defun pcomplete/emacsclient ()
"Completion for the `emacsclient' command."
(pcomplete-here-using-help "emacsclient --help" :margin "^\\(\\)-"))
2000-06-27 10:55:46 +00:00
;;; pcmpl-gnu.el ends here