diff options
| author | Stefan Monnier | 2011-12-08 08:20:20 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2011-12-08 08:20:20 -0500 |
| commit | 39c9faef2f2027336f7235d5521269714cc370c8 (patch) | |
| tree | a646929106cad0f65d2823c5ed1aa0e6dca8d0a1 /lisp | |
| parent | 8b8059decd84744f886aed505b856a4052a0a99e (diff) | |
| download | emacs-39c9faef2f2027336f7235d5521269714cc370c8.tar.gz emacs-39c9faef2f2027336f7235d5521269714cc370c8.zip | |
* 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')
| -rw-r--r-- | lisp/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/pcmpl-gnu.el | 12 |
2 files changed, 15 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 443ca2d5c34..f27ed2abb65 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2011-12-08 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * pcmpl-gnu.el: Don't fail when there is no Makefile nor -f arg. | ||
| 4 | (pcmpl-gnu-makefile-regexps): Accept "makefile" as well as files that | ||
| 5 | end in ".mk". | ||
| 6 | (pcmpl-gnu-make-rule-names): Check "makefile" and ignore errors | ||
| 7 | when reading the makefile (bug#10116). | ||
| 8 | |||
| 1 | 2011-12-06 Stefan Monnier <monnier@iro.umontreal.ca> | 9 | 2011-12-06 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 10 | ||
| 3 | * pcmpl-gnu.el (pcomplete/make): Also allow filename arguments | 11 | * pcmpl-gnu.el (pcomplete/make): Also allow filename arguments |
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 @@ | |||
| 35 | ;; User Variables: | 35 | ;; User Variables: |
| 36 | 36 | ||
| 37 | (defcustom pcmpl-gnu-makefile-regexps | 37 | (defcustom pcmpl-gnu-makefile-regexps |
| 38 | '("\\`GNUmakefile" "\\`Makefile" "\\.mak\\'") | 38 | '("\\`GNUmakefile" "\\`[Mm]akefile" "\\.ma?k\\'") |
| 39 | "A list of regexps that will match Makefile names." | 39 | "A list of regexps that will match Makefile names." |
| 40 | :type '(repeat regexp) | 40 | :type '(repeat regexp) |
| 41 | :group 'pcmpl-gnu) | 41 | :group 'pcmpl-gnu) |
| @@ -112,14 +112,16 @@ | |||
| 112 | "Return a list of possible make rule names in MAKEFILE." | 112 | "Return a list of possible make rule names in MAKEFILE." |
| 113 | (let* ((minus-f (member "-f" pcomplete-args)) | 113 | (let* ((minus-f (member "-f" pcomplete-args)) |
| 114 | (makefile (or (cadr minus-f) | 114 | (makefile (or (cadr minus-f) |
| 115 | (if (file-exists-p "GNUmakefile") | 115 | (cond |
| 116 | "GNUmakefile" | 116 | ((file-exists-p "GNUmakefile") "GNUmakefile") |
| 117 | "Makefile"))) | 117 | ((file-exists-p "makefile") "makefile") |
| 118 | (t "Makefile")))) | ||
| 118 | rules) | 119 | rules) |
| 119 | (if (not (file-readable-p makefile)) | 120 | (if (not (file-readable-p makefile)) |
| 120 | (unless minus-f (list "-f")) | 121 | (unless minus-f (list "-f")) |
| 121 | (with-temp-buffer | 122 | (with-temp-buffer |
| 122 | (insert-file-contents-literally makefile) | 123 | (ignore-errors ;Could be a directory or something. |
| 124 | (insert-file-contents makefile)) | ||
| 123 | (while (re-search-forward | 125 | (while (re-search-forward |
| 124 | (concat "^\\s-*\\([^\n#%.$][^:=\n]*\\)\\s-*:[^=]") nil t) | 126 | (concat "^\\s-*\\([^\n#%.$][^:=\n]*\\)\\s-*:[^=]") nil t) |
| 125 | (setq rules (append (split-string (match-string 1)) rules)))) | 127 | (setq rules (append (split-string (match-string 1)) rules)))) |