summaryrefslogtreecommitdiff
path: root/lisp/pcmpl-gnu.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/pcmpl-gnu.el')
-rw-r--r--lisp/pcmpl-gnu.el17
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/pcmpl-gnu.el b/lisp/pcmpl-gnu.el
index 608a9dc2e88..3b2a944f5bb 100644
--- a/lisp/pcmpl-gnu.el
+++ b/lisp/pcmpl-gnu.el
@@ -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)
@@ -99,7 +99,10 @@
"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."
@@ -109,14 +112,16 @@
"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))))