2011-10-02 01:04:01 +00:00
|
|
|
;;; 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
|
|
|
|
2010-08-29 16:17:13 +00:00
|
|
|
;; Package: pcomplete
|
|
|
|
|
2000-06-27 10:55:46 +00:00
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2000-06-27 10:55:46 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2000-06-27 10:55:46 +00:00
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2000-06-27 10:55:46 +00:00
|
|
|
|
2001-07-15 19:53:53 +00:00
|
|
|
;;; Commentary:
|
|
|
|
|
2000-06-27 10:55:46 +00:00
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(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
|
2011-12-08 13:20:20 +00:00
|
|
|
'("\\`GNUmakefile" "\\`[Mm]akefile" "\\.ma?k\\'")
|
2008-12-03 05:48:14 +00:00
|
|
|
"A list of regexps that will match Makefile names."
|
2019-09-19 12:39:34 +00:00
|
|
|
:type '(repeat regexp))
|
2000-06-27 10:55:46 +00:00
|
|
|
|
2019-09-19 00:42:30 +00:00
|
|
|
(defcustom pcmpl-gnu-makefile-includes t
|
|
|
|
"If non-nil, `pcomplete/make' completes on targets in included files."
|
|
|
|
:type 'boolean
|
2019-09-19 12:39:34 +00:00
|
|
|
:version "27.1"
|
2019-09-19 00:42:30 +00:00
|
|
|
: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
|
2020-11-17 17:42:38 +00:00
|
|
|
(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
|
2020-11-17 17:42:38 +00:00
|
|
|
(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.")
|
2011-12-06 22:14:32 +00:00
|
|
|
(while (pcomplete-here (completion-table-in-turn
|
|
|
|
(pcmpl-gnu-make-rule-names)
|
|
|
|
(pcomplete-entries))
|
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."
|
2009-10-22 03:25:54 +00:00
|
|
|
(pcomplete-entries (mapconcat 'identity pcmpl-gnu-makefile-regexps "\\|")))
|
2000-06-27 10:55:46 +00:00
|
|
|
|
2019-09-19 00:42:30 +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
|
2020-08-21 10:44:52 +00:00
|
|
|
"^\\([^\t\n#%.$][^:=\n]*\\)\\s-*:[^=]" nil t)
|
2019-09-19 00:42:30 +00:00
|
|
|
(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
|
2022-02-05 00:39:53 +00:00
|
|
|
(with-demoted-errors "Error inserting makefile: %S"
|
2019-09-19 00:42:30 +00:00
|
|
|
(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 ()
|
2019-09-19 00:42:30 +00:00
|
|
|
"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)
|
2011-12-08 13:20:20 +00:00
|
|
|
(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"))
|
2019-09-19 00:42:30 +00:00
|
|
|
(setq rules (pcmpl-gnu-make-all-targets makefile rules))
|
2018-03-05 01:53:07 +00:00
|
|
|
(pcomplete-uniquify-list rules))))
|
2000-06-27 10:55:46 +00:00
|
|
|
|
|
|
|
(defcustom pcmpl-gnu-tarfile-regexp
|
2012-09-08 00:59:04 +00:00
|
|
|
"\\.t\\(ar\\(\\.\\(gz\\|bz2\\|Z\\|xz\\)\\)?\\|gz\\|a[zZ]\\|z2\\)\\'"
|
2008-12-03 05:48:14 +00:00
|
|
|
"A regexp which matches any tar archive."
|
2012-09-08 00:59:04 +00:00
|
|
|
:version "24.3" ; added xz
|
2019-09-19 12:39:34 +00:00
|
|
|
:type 'regexp)
|
2000-06-27 10:55:46 +00:00
|
|
|
|
2009-10-31 02:15:09 +00:00
|
|
|
;; Only used in tar-mode buffers.
|
|
|
|
(defvar tar-parse-info)
|
|
|
|
(declare-function tar-header-name "tar-mode" t t)
|
|
|
|
|
2011-10-02 01:00:17 +00:00
|
|
|
(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)
|
2019-06-19 13:30:22 +00:00
|
|
|
(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
|
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
|
2011-10-02 01:00:17 +00:00
|
|
|
(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)))
|
2011-10-02 01:00:17 +00:00
|
|
|
(and (numberp size)
|
2011-12-02 14:44:19 +00:00
|
|
|
(or (null large-file-warning-threshold)
|
|
|
|
(< size large-file-warning-threshold)))))
|
2011-10-02 01:04:01 +00:00
|
|
|
(let ((file (pcomplete-arg 1)))
|
|
|
|
(completion-table-dynamic
|
|
|
|
(lambda (_string)
|
2014-12-03 18:42:20 +00:00
|
|
|
(pcmpl-gnu-with-file-buffer
|
|
|
|
file (mapcar #'tar-header-name tar-parse-info)))))
|
2000-06-27 10:55:46 +00:00
|
|
|
(pcomplete-entries))
|
2021-02-12 21:08:01 +00:00
|
|
|
nil #'identity))))
|
2000-06-27 10:55:46 +00:00
|
|
|
|
2016-02-25 06:13:52 +00:00
|
|
|
;;;###autoload
|
2016-02-26 05:31:46 +00:00
|
|
|
|
2016-02-25 06:13:52 +00:00
|
|
|
(defun pcomplete/find ()
|
2016-02-26 05:31:46 +00:00
|
|
|
"Completion for the GNU find utility."
|
2016-02-25 06:13:52 +00:00
|
|
|
(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))))
|
2021-02-12 21:08:01 +00:00
|
|
|
(while (pcomplete-here (pcomplete-dirs) nil #'identity))))
|
2016-02-25 06:13:52 +00:00
|
|
|
|
2000-06-27 10:55:46 +00:00
|
|
|
;;;###autoload
|
2022-09-08 09:09:42 +00:00
|
|
|
(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
|