Move lisp/emacs-lisp/authors.el to admin/
[bpt/emacs.git] / lisp / pcmpl-gnu.el
index b2c8de6..bcab1f7 100644 (file)
@@ -1,6 +1,6 @@
 ;;; pcmpl-gnu.el --- completions for GNU project tools -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999-2011 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2014 Free Software Foundation, Inc.
 
 ;; Package: pcomplete
 
@@ -35,7 +35,7 @@
 ;; User Variables:
 
 (defcustom pcmpl-gnu-makefile-regexps
-  '("\\`GNUmakefile" "\\`Makefile" "\\.mak\\'")
+  '("\\`GNUmakefile" "\\`[Mm]akefile" "\\.ma?k\\'")
   "A list of regexps that will match Makefile names."
   :type '(repeat regexp)
   :group 'pcmpl-gnu)
   "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 (pcmpl-gnu-make-rule-names) nil 'identity))))
+    (while (pcomplete-here (completion-table-in-turn
+                            (pcmpl-gnu-make-rule-names)
+                            (pcomplete-entries))
+                           nil 'identity))))
 
 (defun pcmpl-gnu-makefile-names ()
   "Return a list of possible makefile names."
   "Return a list of possible make rule names in MAKEFILE."
   (let* ((minus-f (member "-f" pcomplete-args))
         (makefile (or (cadr minus-f)
-                      (if (file-exists-p "GNUmakefile")
-                          "GNUmakefile"
-                        "Makefile")))
+                      (cond
+                        ((file-exists-p "GNUmakefile") "GNUmakefile")
+                        ((file-exists-p "makefile") "makefile")
+                        (t "Makefile"))))
         rules)
     (if (not (file-readable-p makefile))
        (unless minus-f (list "-f"))
       (with-temp-buffer
-       (insert-file-contents-literally makefile)
+       (ignore-errors                  ;Could be a directory or something.
+         (insert-file-contents makefile))
        (while (re-search-forward
                (concat "^\\s-*\\([^\n#%.$][^:=\n]*\\)\\s-*:[^=]") nil t)
          (setq rules (append (split-string (match-string 1)) rules))))
       (pcomplete-uniqify-list rules))))
 
 (defcustom pcmpl-gnu-tarfile-regexp
-  "\\.t\\(ar\\(\\.\\(gz\\|bz2\\|Z\\)\\)?\\|gz\\|a[zZ]\\|z2\\)\\'"
+  "\\.t\\(ar\\(\\.\\(gz\\|bz2\\|Z\\|xz\\)\\)?\\|gz\\|a[zZ]\\|z2\\)\\'"
   "A regexp which matches any tar archive."
+  :version "24.3"                       ; added xz
   :type 'regexp
   :group 'pcmpl-gnu)
 
   "Completion for the GNU tar utility."
   ;; options that end in an equal sign will want further completion...
   (let (saw-option complete-within)
-    (let ((pcomplete-suffix-list (cons ?= pcomplete-suffix-list)))
+    (let ((pcomplete-suffix-list (if (boundp 'pcomplete-suffix-list)
+                                     (cons ?= pcomplete-suffix-list))))
       (while (pcomplete-match "^-" 0)
         (setq saw-option t)
         (if (pcomplete-match "^--" 0)
                    "--volno-file=")))
           (pcomplete-opt "01234567ABCFGKLMNOPRSTUVWXZbcdfghiklmoprstuvwxz"))
         (cond
+         ((pcomplete-match "\\`-\\'" 0)
+          (pcomplete-here*))
          ((pcomplete-match "\\`--after-date=" 0)
           (pcomplete-here*))
          ((pcomplete-match "\\`--backup=" 0)
                      (let* ((fa (file-attributes (pcomplete-arg 1)))
                             (size (nth 7 fa)))
                        (and (numberp size)
-                            (< size large-file-warning-threshold))))
+                            (or (null large-file-warning-threshold)
+                                (< size large-file-warning-threshold)))))
                 (let ((file (pcomplete-arg 1)))
                   (completion-table-dynamic
                    (lambda (_string)