diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-12-08 08:20:20 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2011-12-08 08:20:20 -0500 |
commit | 39c9faef2f2027336f7235d5521269714cc370c8 (patch) | |
tree | a646929106cad0f65d2823c5ed1aa0e6dca8d0a1 /lisp/pcmpl-gnu.el | |
parent | 8b8059decd84744f886aed505b856a4052a0a99e (diff) | |
download | emacs-39c9faef2f2027336f7235d5521269714cc370c8.tar.gz |
* lisp/pcmpl-gnu.el: Don't fail when there is no Makefile nor -f arg.
(pcmpl-gnu-makefile-regexps): Accept "makefile" as well as files that
end in ".mk".
(pcmpl-gnu-make-rule-names): Check "makefile" and ignore errors
when reading the makefile.
Fixes: debbugs:10116
Diffstat (limited to 'lisp/pcmpl-gnu.el')
-rw-r--r-- | lisp/pcmpl-gnu.el | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/pcmpl-gnu.el b/lisp/pcmpl-gnu.el index 72332b723db..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) @@ -112,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)))) |