Mercurial > emacs
annotate lisp/progmodes/make-mode.el @ 5521:d1d144ed5b76
Don't declare sys_errlist; declare strerror instead.
(fatal_unexec): Call strerror instead of using sys_errlist.
author | Roland McGrath <roland@gnu.org> |
---|---|
date | Sat, 08 Jan 1994 21:42:04 +0000 |
parents | 4823e14b1314 |
children | 3443820118a0 |
rev | line source |
---|---|
809 | 1 ;;; makefile.el --- makefile editing commands for Emacs |
2 | |
841 | 3 ;; Copyright (C) 1992 Free Software Foundation, Inc. |
4 | |
809 | 5 ;; Author: Thomas Neumann <tom@smart.bo.open.de> |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
6 ;; Eric S. Raymond <esr@snark.thyrsus.com> |
809 | 7 ;; Adapted-By: ESR |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
809
diff
changeset
|
8 ;; Keywords: unix, tools |
809 | 9 |
2671 | 10 ;; RMS: |
11 ;; This needs work. The electric characters are too obnoxious. | |
12 ;; It should not define C-c LETTER. | |
13 ;; It should support knowing the list of existing macros and targets | |
14 ;; via M-TAB completion, not by preempting insertion of references. | |
15 ;; Also, the doc strings need fixing: the first line doesn't stand alone, | |
16 ;; and other usage is not high quality. Symbol names don't have `...'. | |
17 ;; The Mode names is written as makefile-mode instead of Makefile mode. | |
18 | |
19 ;; So, for the meantime, this is not the default mode for makefiles. | |
20 | |
5464
4823e14b1314
(makefile-mode): Make comment-start, comment-end,
Richard M. Stallman <rms@gnu.org>
parents:
5312
diff
changeset
|
21 ;; $Id: makefile.el,v 1.10 1993/12/23 04:57:18 rms Exp rms $ |
809 | 22 |
23 ;; This file is part of GNU Emacs. | |
24 | |
25 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
26 ;; it under the terms of the GNU General Public License as published by | |
27 ;; the Free Software Foundation; either version 1, or (at your option) | |
28 ;; any later version. | |
29 | |
30 ;; GNU Emacs is distributed in the hope that it will be useful, | |
31 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
32 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
33 ;; GNU General Public License for more details. | |
34 | |
35 ;; You should have received a copy of the GNU General Public License | |
36 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
37 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
38 | |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
841
diff
changeset
|
39 ;;; Commentary: |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
841
diff
changeset
|
40 |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
41 ;; A major mode for editing makefiles. The mode knows about Makefile |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
42 ;; syntax and defines M-n and M-p to move to next and previous productions. |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
43 ;; |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
44 ;; The keys $, =, : and . are electric; they try to help you fill in a |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
45 ;; macro reference, macro definition, ordinary target name, or special |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
46 ;; target name, respectively. Such names are completed using a list of |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
47 ;; targets and macro names parsed out of the makefile. This list is |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
48 ;; automatically updated, if necessary, whenever you invoke one of |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
49 ;; these commands. You can force it to be updated with C-c C-p. |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
50 ;; |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
51 ;; The command C-c f adds certain filenames in the current directory |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
52 ;; as targets. You can filter out filenames by setting the variable |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
53 ;; makefile-ignored-files-in-pickup-regex. |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
54 ;; |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
55 ;; The command C-c C-u grinds for a bit, then pops up a report buffer |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
56 ;; showing which target names are up-to-date with respect to their |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
57 ;; prerequisites, which targets are out-of-date, and which have no |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
58 ;; prerequisites. |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
59 ;; |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
60 ;; The command C-c b pops up a browser window listing all target and |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
61 ;; macro names. You can mark or unmark items wit C-c SPC, and insert |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
62 ;; all marked items back in the Makefile with C-c TAB. |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
63 ;; |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
64 ;; The command C-c TAB in the makefile buffer inserts a GNU make builtin. |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
65 ;; You will be prompted for the builtin's args. |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
66 ;; |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
67 ;; There are numerous other customization variables. |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
841
diff
changeset
|
68 |
809 | 69 ;;; Code: |
70 | |
71 (provide 'makefile) | |
72 | |
73 ;;; ------------------------------------------------------------ | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
2671
diff
changeset
|
74 ;;; Configurable stuff |
809 | 75 ;;; ------------------------------------------------------------ |
76 | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
77 (defconst makefile-mode-name "makefile" |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
78 "The \"pretty name\" of makefile-mode, as it appears in the modeline.") |
809 | 79 |
80 (defvar makefile-browser-buffer-name "*Macros and Targets*" | |
81 "Name of the macro- and target browser buffer.") | |
82 | |
83 (defvar makefile-target-colon ":" | |
84 "The string that gets appended to all target names | |
85 inserted by makefile-insert-target. | |
86 \":\" or \"::\" are quite common values.") | |
87 | |
88 (defvar makefile-macro-assign " = " | |
89 "The string that gets appended to all macro names | |
90 inserted by makefile-insert-macro. | |
91 The normal value should be \" = \", since this is what | |
92 standard make expects. However, newer makes such as dmake | |
93 allow a larger variety of different macro assignments, so you | |
94 might prefer to use \" += \" or \" := \" .") | |
95 | |
96 (defvar makefile-use-curly-braces-for-macros-p nil | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
97 "Controls the style of generated macro references. |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
98 Set this variable to a non-nil value if you prefer curly braces |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
99 in macro-references, so it looks like ${this}. A value of nil |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
2671
diff
changeset
|
100 will cause makefile-mode to use parentheses, making macro references |
809 | 101 look like $(this) .") |
102 | |
103 (defvar makefile-tab-after-target-colon t | |
104 "If you want a TAB (instead of a space) to be appended after the | |
105 target colon, then set this to a non-nil value.") | |
106 | |
107 (defvar makefile-browser-leftmost-column 10 | |
108 "Number of blanks to the left of the browser selection mark.") | |
109 | |
110 (defvar makefile-browser-cursor-column 10 | |
111 "Column in which the cursor is positioned when it moves | |
112 up or down in the browser.") | |
113 | |
114 (defvar makefile-browser-selected-mark "+ " | |
115 "String used to mark selected entries in the browser.") | |
116 | |
117 (defvar makefile-browser-unselected-mark " " | |
118 "String used to mark unselected entries in the browser.") | |
119 | |
120 (defvar makefile-browser-auto-advance-after-selection-p t | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
121 "If non-nil, the cursor will automagically advance to the next line after |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
122 an item has been selected in the browser.") |
809 | 123 |
124 (defvar makefile-pickup-everything-picks-up-filenames-p nil | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
125 "If non-nil, makefile-pickup-everything also picks up filenames as targets |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
126 (i.e. it calls makefile-find-filenames-as-targets), otherwise filenames are |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
127 omitted.") |
809 | 128 |
129 (defvar makefile-cleanup-continuations-p t | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
130 "If non-nil, makefile-mode will assure that no line in the file ends with a |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
131 backslash (the continuation character) followed by any whitespace. This is |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
132 done by silently removing the trailing whitespace, leaving the backslash itself |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
133 intact. IMPORTANT: Please note that enabling this option causes makefile-mode |
809 | 134 to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \'it seems necessary\'.") |
135 | |
136 (defvar makefile-browser-hook '() | |
137 "A function or list of functions to be called just before the | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
138 browser is entered. This is executed in the makefile buffer.") |
809 | 139 |
140 ;; | |
141 ;; Special targets for DMake, Sun's make ... | |
142 ;; | |
143 (defvar makefile-special-targets-list | |
144 '(("DEFAULT") ("DONE") ("ERROR") ("EXPORT") | |
145 ("FAILED") ("GROUPEPILOG") ("GROUPPROLOG") ("IGNORE") | |
146 ("IMPORT") ("INCLUDE") ("INCLUDEDIRS") ("INIT") | |
147 ("KEEP_STATE") ("MAKEFILES") ("MAKE_VERSION") ("NO_PARALLEL") | |
148 ("PARALLEL") ("PHONY") ("PRECIOUS") ("REMOVE") | |
149 ("SCCS_GET") ("SILENT") ("SOURCE") ("SUFFIXES") | |
150 ("WAIT") ("c.o") ("C.o") ("m.o") | |
151 ("el.elc") ("y.c") ("s.o")) | |
152 "List of special targets. You will be offered to complete | |
153 on one of those in the minibuffer whenever you enter a \".\" | |
154 at the beginning of a line in makefile-mode.") | |
155 | |
156 (defvar makefile-runtime-macros-list | |
157 '(("@") ("&") (">") ("<") ("*") ("^") ("?") ("%")) | |
158 "List of macros that are resolved by make at runtime. | |
159 If you insert a macro reference using makefile-insert-macro-ref, the name | |
160 of the macro is checked against this list. If it can be found its name will | |
161 not be enclosed in { } or ( ).") | |
162 | |
163 (defconst makefile-dependency-regex | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
164 "^[^ \t#:]+\\([ \t]+[^ \t#:]+\\)*[ \t]*:\\([ \t]*$\\|\\([^=\n].*$\\)\\)" |
809 | 165 "Regex used to find dependency lines in a makefile.") |
166 | |
167 (defconst makefile-macroassign-regex | |
168 "^[^ \t][^:#=]*[\\*:\\+]?:?=.*$" | |
169 "Regex used to find macro assignment lines in a makefile.") | |
170 | |
171 (defconst makefile-ignored-files-in-pickup-regex | |
5312
aad805608eec
(makefile-ignored-files-in-pickup-regex): Supply missing \\.
Richard M. Stallman <rms@gnu.org>
parents:
3591
diff
changeset
|
172 "\\(^\\..*\\)\\|\\(.*~$\\)\\|\\(.*,v$\\)\\|\\(\\.[chy]\\)" |
809 | 173 "Regex for filenames that will NOT be included in the target list.") |
174 | |
175 ;;; ------------------------------------------------------------ | |
176 ;;; The following configurable variables are used in the | |
177 ;;; up-to-date overview . | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
2671
diff
changeset
|
178 ;;; The standard configuration assumes that your `make' program |
809 | 179 ;;; can be run in question/query mode using the `-q' option, this |
180 ;;; means that the command | |
181 ;;; | |
182 ;;; make -q foo | |
183 ;;; | |
184 ;;; should return an exit status of zero if the target `foo' is | |
185 ;;; up to date and a nonzero exit status otherwise. | |
186 ;;; Many makes can do this although the docs/manpages do not mention | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
187 ;;; it. Try it with your favourite one. GNU make, System V make, and |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
188 ;;; Dennis Vadura's DMake have no problems. |
809 | 189 ;;; Set the variable `makefile-brave-make' to the name of the |
190 ;;; make utility that does this on your system. | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
2671
diff
changeset
|
191 ;;; To understand what this is all about see the function definition |
809 | 192 ;;; of `makefile-query-by-make-minus-q' . |
193 ;;; ------------------------------------------------------------ | |
194 | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
195 (defvar makefile-brave-make "make" |
809 | 196 "A make that can handle the \'-q\' option.") |
197 | |
198 (defvar makefile-query-one-target-method 'makefile-query-by-make-minus-q | |
199 "A function symbol [one that can be used as the first argument to | |
200 funcall] that provides a function that must conform to the following | |
201 interface: | |
202 | |
203 * As its first argument, it must accept the name of the target to | |
204 be checked, as a string. | |
205 | |
206 * As its second argument, it may accept the name of a makefile | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
207 as a string. Depending on what you're going to do you may |
809 | 208 not need this. |
209 | |
210 * It must return the integer value 0 (zero) if the given target | |
211 should be considered up-to-date in the context of the given | |
212 makefile, any nonzero integer value otherwise.") | |
213 | |
214 (defvar makefile-up-to-date-buffer-name "*Makefile Up-to-date overview*" | |
215 "Name of the Up-to-date overview buffer.") | |
216 | |
217 ;;; --- end of up-to-date-overview configuration ------------------ | |
218 | |
219 (defvar makefile-mode-map nil | |
220 "The keymap that is used in makefile-mode.") | |
221 (if makefile-mode-map | |
222 () | |
223 (setq makefile-mode-map (make-sparse-keymap)) | |
224 ;; set up the keymap | |
225 (define-key makefile-mode-map "$" 'makefile-insert-macro-ref) | |
226 (define-key makefile-mode-map "\C-c:" 'makefile-insert-target-ref) | |
227 (define-key makefile-mode-map ":" 'makefile-electric-colon) | |
228 (define-key makefile-mode-map "=" 'makefile-electric-equal) | |
229 (define-key makefile-mode-map "." 'makefile-electric-dot) | |
230 (define-key makefile-mode-map "\C-c\C-f" 'makefile-pickup-filenames-as-targets) | |
231 (define-key makefile-mode-map "\C-c\C-b" 'makefile-switch-to-browser) | |
232 (define-key makefile-mode-map "\C-c\C-p" 'makefile-pickup-everything) | |
233 (define-key makefile-mode-map "\C-c\C-u" 'makefile-create-up-to-date-overview) | |
234 (define-key makefile-mode-map "\C-c\C-i" 'makefile-insert-gmake-function) | |
235 (define-key makefile-mode-map "\M-p" 'makefile-previous-dependency) | |
236 (define-key makefile-mode-map "\M-n" 'makefile-next-dependency)) | |
237 | |
238 (defvar makefile-browser-map nil | |
239 "The keymap that is used in the macro- and target browser.") | |
240 (if makefile-browser-map | |
241 () | |
242 (setq makefile-browser-map (make-sparse-keymap)) | |
243 (define-key makefile-browser-map "n" 'makefile-browser-next-line) | |
244 (define-key makefile-browser-map "\C-n" 'makefile-browser-next-line) | |
245 (define-key makefile-browser-map "p" 'makefile-browser-previous-line) | |
246 (define-key makefile-browser-map "\C-p" 'makefile-browser-previous-line) | |
247 (define-key makefile-browser-map " " 'makefile-browser-toggle) | |
248 (define-key makefile-browser-map "i" 'makefile-browser-insert-selection) | |
249 (define-key makefile-browser-map "I" 'makefile-browser-insert-selection-and-quit) | |
250 (define-key makefile-browser-map "\C-c\C-m" 'makefile-browser-insert-continuation) | |
251 (define-key makefile-browser-map "q" 'makefile-browser-quit) | |
252 ;; disable horizontal movement | |
253 (define-key makefile-browser-map "\C-b" 'undefined) | |
254 (define-key makefile-browser-map "\C-f" 'undefined)) | |
255 | |
256 | |
257 (defvar makefile-mode-syntax-table nil | |
258 "The syntax-table used in makefile mode.") | |
259 (if makefile-mode-syntax-table | |
260 () | |
261 (setq makefile-mode-syntax-table (make-syntax-table)) | |
262 (modify-syntax-entry ?\( "() " makefile-mode-syntax-table) | |
263 (modify-syntax-entry ?\) ")( " makefile-mode-syntax-table) | |
264 (modify-syntax-entry ?\[ "(] " makefile-mode-syntax-table) | |
265 (modify-syntax-entry ?\] "([ " makefile-mode-syntax-table) | |
266 (modify-syntax-entry ?\{ "(} " makefile-mode-syntax-table) | |
267 (modify-syntax-entry ?\} "){ " makefile-mode-syntax-table) | |
268 (modify-syntax-entry ?# "< " makefile-mode-syntax-table) | |
269 (modify-syntax-entry ?\n "> " makefile-mode-syntax-table)) | |
270 | |
271 | |
272 ;;; ------------------------------------------------------------ | |
273 ;;; Internal variables. | |
274 ;;; You don't need to configure below this line. | |
275 ;;; ------------------------------------------------------------ | |
276 | |
277 (defvar makefile-target-table nil | |
278 "Table of all targets that have been inserted in | |
279 this Makefile buffer using makefile-insert-target or picked up | |
280 using makefile-pickup-targets.") | |
281 | |
282 (defvar makefile-macro-table nil | |
283 "Table of all macros that have been iserted in | |
284 this Makefile buffer using makefile-insert-macro or picked up | |
285 using makefile-pickup-macros.") | |
286 | |
287 (defvar makefile-browser-client | |
288 "A buffer in makefile-mode that is currently using the browser.") | |
289 | |
290 (defvar makefile-browser-selection-vector nil) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
291 (defvar makefile-has-prereqs nil) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
292 (defvar makefile-need-target-pickup t) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
293 (defvar makefile-need-macro-pickup t) |
809 | 294 |
295 (defvar makefile-mode-hook '()) | |
296 | |
297 (defconst makefile-gnumake-functions-alist | |
298 '( | |
299 ;; Text functions | |
300 ("subst" "From" "To" "In") | |
301 ("patsubst" "Pattern" "Replacement" "In") | |
302 ("strip" "Text") | |
303 ("findstring" "Find what" "In") | |
304 ("filter" "Pattern" "Text") | |
305 ("filter-out" "Pattern" "Text") | |
306 ("sort" "List") | |
307 ;; Filename functions | |
308 ("dir" "Names") | |
309 ("notdir" "Names") | |
310 ("suffix" "Names") | |
311 ("basename" "Names") | |
312 ("addsuffix" "Suffix" "Names") | |
313 ("join" "List 1" "List 2") | |
314 ("word" "Index" "Text") | |
315 ("words" "Text") | |
316 ("firstword" "Text") | |
317 ("wildcard" "Pattern") | |
318 ;; Misc functions | |
319 ("foreach" "Variable" "List" "Text") | |
320 ("origin" "Variable") | |
321 ("shell" "Command")) | |
322 "A list of GNU make 3.62 function names associated with | |
323 the prompts for each function. | |
324 This is used in the function makefile-insert-gmake-function .") | |
325 | |
326 | |
327 ;;; ------------------------------------------------------------ | |
328 ;;; The mode function itself. | |
329 ;;; ------------------------------------------------------------ | |
330 | |
2534
0099d6be2b11
(makefile-mode): Fix typo in autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
2400
diff
changeset
|
331 ;;;###autoload |
809 | 332 (defun makefile-mode () |
333 "Major mode for editing Makefiles. | |
334 Calling this function invokes the function(s) \"makefile-mode-hook\" before | |
335 doing anything else. | |
336 | |
337 \\{makefile-mode-map} | |
338 | |
339 In the browser, use the following keys: | |
340 | |
341 \\{makefile-browser-map} | |
342 | |
343 makefile-mode can be configured by modifying the following | |
344 variables: | |
345 | |
346 makefile-mode-name: | |
347 The \"pretty name\" of makefile-mode, as it | |
348 appears in the modeline. | |
349 | |
350 makefile-browser-buffer-name: | |
351 Name of the macro- and target browser buffer. | |
352 | |
353 makefile-target-colon: | |
354 The string that gets appended to all target names | |
355 inserted by makefile-insert-target. | |
356 \":\" or \"::\" are quite common values. | |
357 | |
358 makefile-macro-assign: | |
359 The string that gets appended to all macro names | |
360 inserted by makefile-insert-macro. | |
361 The normal value should be \" = \", since this is what | |
362 standard make expects. However, newer makes such as dmake | |
363 allow a larger variety of different macro assignments, so you | |
364 might prefer to use \" += \" or \" := \" . | |
365 | |
366 makefile-tab-after-target-colon: | |
367 If you want a TAB (instead of a space) to be appended after the | |
368 target colon, then set this to a non-nil value. | |
369 | |
370 makefile-browser-leftmost-column: | |
371 Number of blanks to the left of the browser selection mark. | |
372 | |
373 makefile-browser-cursor-column: | |
374 Column in which the cursor is positioned when it moves | |
375 up or down in the browser. | |
376 | |
377 makefile-browser-selected-mark: | |
378 String used to mark selected entries in the browser. | |
379 | |
380 makefile-browser-unselected-mark: | |
381 String used to mark unselected entries in the browser. | |
382 | |
383 makefile-browser-auto-advance-after-selection-p: | |
384 If this variable is set to a non-nil value the cursor | |
385 will automagically advance to the next line after an item | |
386 has been selected in the browser. | |
387 | |
388 makefile-pickup-everything-picks-up-filenames-p: | |
389 If this variable is set to a non-nil value then | |
390 makefile-pickup-everything also picks up filenames as targets | |
391 (i.e. it calls makefile-find-filenames-as-targets), otherwise | |
392 filenames are omitted. | |
393 | |
394 makefile-cleanup-continuations-p: | |
395 If this variable is set to a non-nil value then makefile-mode | |
396 will assure that no line in the file ends with a backslash | |
397 (the continuation character) followed by any whitespace. | |
398 This is done by silently removing the trailing whitespace, leaving | |
399 the backslash itself intact. | |
400 IMPORTANT: Please note that enabling this option causes makefile-mode | |
401 to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \'it seems necessary\'. | |
402 | |
403 makefile-browser-hook: | |
404 A function or list of functions to be called just before the | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
405 browser is entered. This is executed in the makefile buffer. |
809 | 406 |
407 makefile-special-targets-list: | |
408 List of special targets. You will be offered to complete | |
409 on one of those in the minibuffer whenever you enter a \".\" | |
410 at the beginning of a line in makefile-mode." | |
411 (interactive) | |
412 (kill-all-local-variables) | |
413 (if (not (memq 'makefile-cleanup-continuations write-file-hooks)) | |
414 (setq write-file-hooks | |
415 (append write-file-hooks (list 'makefile-cleanup-continuations)))) | |
416 (make-variable-buffer-local 'makefile-target-table) | |
417 (make-variable-buffer-local 'makefile-macro-table) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
418 (make-variable-buffer-local 'makefile-has-prereqs) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
419 (make-variable-buffer-local 'makefile-need-target-pickup) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
420 (make-variable-buffer-local 'makefile-need-macro-pickup) |
5464
4823e14b1314
(makefile-mode): Make comment-start, comment-end,
Richard M. Stallman <rms@gnu.org>
parents:
5312
diff
changeset
|
421 (make-local-variable 'comment-start) |
4823e14b1314
(makefile-mode): Make comment-start, comment-end,
Richard M. Stallman <rms@gnu.org>
parents:
5312
diff
changeset
|
422 (make-local-variable 'comment-end) |
4823e14b1314
(makefile-mode): Make comment-start, comment-end,
Richard M. Stallman <rms@gnu.org>
parents:
5312
diff
changeset
|
423 (make-local-variable 'comment-start-skip) |
809 | 424 (setq comment-start "#") |
425 (setq comment-end "") | |
426 (setq comment-start-skip "#[ \t]*") | |
427 ;; become the current major mode | |
428 (setq major-mode 'makefile-mode) | |
429 (setq mode-name makefile-mode-name) | |
430 ;; activate keymap | |
431 (use-local-map makefile-mode-map) | |
432 (set-syntax-table makefile-mode-syntax-table) | |
433 (run-hooks 'makefile-mode-hook)) | |
434 | |
435 (defun makefile-next-dependency () | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
436 "Move (point) to the beginning of the next dependency line below (point)." |
809 | 437 (interactive) |
438 (let ((here (point))) | |
439 (end-of-line) | |
440 (if (re-search-forward makefile-dependency-regex (point-max) t) | |
441 (progn (beginning-of-line) t) ; indicate success | |
442 (goto-char here) nil))) | |
443 | |
444 (defun makefile-previous-dependency () | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
445 "Move (point) to the beginning of the next dependency line above (point)." |
809 | 446 (interactive) |
447 (let ((here (point))) | |
448 (beginning-of-line) | |
449 (if (re-search-backward makefile-dependency-regex (point-min) t) | |
450 (progn (beginning-of-line) t) ; indicate success | |
451 (goto-char here) nil))) | |
452 | |
453 | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
454 ;;; Stuff below here depends on the pickup state |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
455 |
809 | 456 (defun makefile-electric-dot () |
457 "At (bol), offer completion on makefile-special-targets-list. | |
458 Anywhere else just insert a dot." | |
459 (interactive) | |
460 (if (bolp) | |
461 (makefile-insert-special-target) | |
462 (insert "."))) | |
463 | |
464 (defun makefile-insert-special-target () | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
465 "Complete on makefile-special-targets-list, insert result at (point)." |
809 | 466 (interactive) |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
467 (makefile-pickup-targets) |
809 | 468 (let |
469 ((special-target | |
470 (completing-read "Special target: " | |
471 makefile-special-targets-list nil nil nil))) | |
472 (if (zerop (length special-target)) | |
473 () | |
474 (insert (format ".%s:" special-target)) | |
475 (makefile-forward-after-target-colon)))) | |
476 | |
477 (defun makefile-electric-equal () | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
478 "At (bol) do makefile-insert-macro. Anywhere else just self-insert." |
809 | 479 (interactive) |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
480 (makefile-pickup-macros) |
809 | 481 (if (bolp) |
482 (call-interactively 'makefile-insert-macro) | |
483 (insert "="))) | |
484 | |
485 (defun makefile-insert-macro (macro-name) | |
486 "Prepare definition of a new macro." | |
487 (interactive "sMacro Name: ") | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
488 (makefile-pickup-macros) |
809 | 489 (if (not (zerop (length macro-name))) |
490 (progn | |
491 (beginning-of-line) | |
492 (insert (format "%s%s" macro-name makefile-macro-assign)) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
493 (setq makefile-need-macro-pickup t) |
809 | 494 (makefile-remember-macro macro-name)))) |
495 | |
496 (defun makefile-insert-macro-ref (macro-name) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
497 "Complete on a list of known macros, then insert complete ref at (point)." |
809 | 498 (interactive |
499 (list | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
500 (progn |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
501 (makefile-pickup-macros) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
502 (completing-read "Refer to macro: " makefile-macro-table nil nil nil)))) |
809 | 503 (if (not (zerop (length macro-name))) |
504 (if (assoc macro-name makefile-runtime-macros-list) | |
505 (insert (format "$%s " macro-name)) | |
506 (insert (makefile-format-macro-ref macro-name) " ")))) | |
507 | |
508 (defun makefile-insert-target (target-name) | |
509 "Prepare definition of a new target (dependency line)." | |
510 (interactive "sTarget: ") | |
511 (if (not (zerop (length target-name))) | |
512 (progn | |
513 (beginning-of-line) | |
514 (insert (format "%s%s" target-name makefile-target-colon)) | |
515 (makefile-forward-after-target-colon) | |
516 (end-of-line) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
517 (setq makefile-need-target-pickup t) |
809 | 518 (makefile-remember-target target-name)))) |
519 | |
520 (defun makefile-insert-target-ref (target-name) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
521 "Complete on a list of known targets, then insert target-ref at (point) ." |
809 | 522 (interactive |
523 (list | |
5312
aad805608eec
(makefile-ignored-files-in-pickup-regex): Supply missing \\.
Richard M. Stallman <rms@gnu.org>
parents:
3591
diff
changeset
|
524 (progn |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
525 (makefile-pickup-targets) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
526 (completing-read "Refer to target: " makefile-target-table nil nil nil)))) |
809 | 527 (if (not (zerop (length target-name))) |
528 (progn | |
529 (insert (format "%s " target-name))))) | |
530 | |
531 (defun makefile-electric-colon () | |
532 "At (bol) defines a new target, anywhere else just self-insert ." | |
533 (interactive) | |
534 (if (bolp) | |
535 (call-interactively 'makefile-insert-target) | |
536 (insert ":"))) | |
537 | |
538 ;;; ------------------------------------------------------------ | |
539 ;;; Extracting targets and macros from an existing makefile | |
540 ;;; ------------------------------------------------------------ | |
541 | |
542 (defun makefile-pickup-targets () | |
543 "Scan a buffer that contains a makefile for target definitions (dependencies) | |
544 and add them to the list of known targets." | |
545 (interactive) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
546 (if (not makefile-need-target-pickup) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
547 nil |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
548 (setq makefile-need-target-pickup nil) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
549 (setq makefile-target-table nil) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
550 (setq makefile-has-prereqs nil) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
551 (save-excursion |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
552 (goto-char (point-min)) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
553 (while (re-search-forward makefile-dependency-regex (point-max) t) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
554 (makefile-add-this-line-targets))) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
555 (message "Read targets OK."))) |
809 | 556 |
557 (defun makefile-add-this-line-targets () | |
558 (save-excursion | |
559 (beginning-of-line) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
560 (let ((done-with-line nil) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
561 (line-number (1+ (count-lines (point-min) (point))))) |
809 | 562 (while (not done-with-line) |
563 (skip-chars-forward " \t") | |
564 (if (not (setq done-with-line (or (eolp) | |
565 (char-equal (char-after (point)) ?:)))) | |
566 (progn | |
567 (let* ((start-of-target-name (point)) | |
568 (target-name | |
569 (progn | |
570 (skip-chars-forward "^ \t:#") | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
571 (buffer-substring start-of-target-name (point)))) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
572 (has-prereqs |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
573 (not (looking-at ":[ \t]*$")))) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
574 (if (makefile-remember-target target-name has-prereqs) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
575 (message "Picked up target \"%s\" from line %d" |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
576 target-name line-number))))))))) |
809 | 577 |
578 | |
579 (defun makefile-pickup-macros () | |
580 "Scan a buffer that contains a makefile for macro definitions | |
581 and add them to the list of known macros." | |
582 (interactive) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
583 (if (not makefile-need-macro-pickup) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
584 nil |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
585 (setq makefile-need-macro-pickup nil) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
586 (setq makefile-macro-table nil) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
587 (save-excursion |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
588 (goto-char (point-min)) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
589 (while (re-search-forward makefile-macroassign-regex (point-max) t) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
590 (makefile-add-this-line-macro) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
591 (forward-line 1))) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
592 (message "Read macros OK."))) |
809 | 593 |
594 (defun makefile-add-this-line-macro () | |
595 (save-excursion | |
596 (beginning-of-line) | |
597 (skip-chars-forward " \t") | |
598 (if (not (eolp)) | |
599 (let* ((start-of-macro-name (point)) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
600 (line-number (1+ (count-lines (point-min) (point)))) |
809 | 601 (macro-name (progn |
602 (skip-chars-forward "^ \t:#=*") | |
603 (buffer-substring start-of-macro-name (point))))) | |
604 (if (makefile-remember-macro macro-name) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
605 (message "Picked up macro \"%s\" from line %d" |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
606 macro-name line-number)))))) |
809 | 607 |
608 (defun makefile-pickup-everything () | |
609 "Calls makefile-pickup-targets and makefile-pickup-macros. | |
610 See their documentation for what they do." | |
611 (interactive) | |
612 (makefile-pickup-macros) | |
613 (makefile-pickup-targets) | |
614 (if makefile-pickup-everything-picks-up-filenames-p | |
615 (makefile-pickup-filenames-as-targets))) | |
616 | |
617 | |
618 (defun makefile-pickup-filenames-as-targets () | |
619 "Scan the current directory for filenames, check each filename | |
620 against makefile-ignored-files-in-pickup-regex and add all qualifying | |
621 names to the list of known targets." | |
622 (interactive) | |
623 (let* ((dir (file-name-directory (buffer-file-name))) | |
624 (raw-filename-list (if dir | |
625 (file-name-all-completions "" dir) | |
626 (file-name-all-completions "" "")))) | |
627 (mapcar '(lambda (name) | |
628 (if (and (not (file-directory-p name)) | |
629 (not (string-match makefile-ignored-files-in-pickup-regex | |
630 name))) | |
631 (if (makefile-remember-target name) | |
632 (message "Picked up file \"%s\" as target" name)))) | |
633 raw-filename-list))) | |
634 | |
635 ;;; ------------------------------------------------------------ | |
636 ;;; The browser window | |
637 ;;; ------------------------------------------------------------ | |
638 | |
639 (defun makefile-browser-format-target-line (target selected) | |
640 (format | |
641 (concat (make-string makefile-browser-leftmost-column ?\ ) | |
642 (if selected | |
643 makefile-browser-selected-mark | |
644 makefile-browser-unselected-mark) | |
645 "%s%s") | |
646 target makefile-target-colon)) | |
647 | |
648 (defun makefile-browser-format-macro-line (macro selected) | |
649 (format | |
650 (concat (make-string makefile-browser-leftmost-column ?\ ) | |
651 (if selected | |
652 makefile-browser-selected-mark | |
653 makefile-browser-unselected-mark) | |
654 (makefile-format-macro-ref macro)))) | |
655 | |
656 (defun makefile-browser-fill (targets macros) | |
657 (setq buffer-read-only nil) | |
658 (goto-char (point-min)) | |
659 (erase-buffer) | |
660 (mapconcat | |
661 (function | |
662 (lambda (item) (insert (makefile-browser-format-target-line (car item) nil) "\n"))) | |
663 targets | |
664 "") | |
665 (mapconcat | |
666 (function | |
667 (lambda (item) (insert (makefile-browser-format-macro-line (car item) nil) "\n"))) | |
668 macros | |
669 "") | |
670 (sort-lines nil (point-min) (point-max)) | |
671 (goto-char (1- (point-max))) | |
672 (delete-char 1) ; remove unnecessary newline at eob | |
673 (goto-char (point-min)) | |
674 (forward-char makefile-browser-cursor-column) | |
675 (setq buffer-read-only t)) | |
676 | |
677 ;;; | |
678 ;;; Moving up and down in the browser | |
679 ;;; | |
680 | |
681 (defun makefile-browser-next-line () | |
682 "Move the browser selection cursor to the next line." | |
683 (interactive) | |
684 (if (not (makefile-last-line-p)) | |
685 (progn | |
686 (forward-line 1) | |
687 (forward-char makefile-browser-cursor-column)))) | |
688 | |
689 (defun makefile-browser-previous-line () | |
690 "Move the browser selection cursor to the previous line." | |
691 (interactive) | |
692 (if (not (makefile-first-line-p)) | |
693 (progn | |
694 (forward-line -1) | |
695 (forward-char makefile-browser-cursor-column)))) | |
696 | |
697 ;;; | |
698 ;;; Quitting the browser (returns to client buffer) | |
699 ;;; | |
700 | |
701 (defun makefile-browser-quit () | |
702 "Leave the makefile-browser-buffer and return to the buffer | |
703 from that it has been entered." | |
704 (interactive) | |
705 (let ((my-client makefile-browser-client)) | |
706 (setq makefile-browser-client nil) ; we quitted, so NO client! | |
707 (set-buffer-modified-p nil) | |
708 (kill-buffer (current-buffer)) | |
709 (pop-to-buffer my-client))) | |
710 | |
711 ;;; | |
712 ;;; Toggle state of a browser item | |
713 ;;; | |
714 | |
715 (defun makefile-browser-toggle () | |
716 "Toggle the selection state of the browser item at the cursor position." | |
717 (interactive) | |
718 (let ((this-line (count-lines (point-min) (point)))) | |
719 (setq this-line (max 1 this-line)) | |
720 (makefile-browser-toggle-state-for-line this-line) | |
721 (goto-line this-line) | |
722 (setq buffer-read-only nil) | |
723 (beginning-of-line) | |
724 (if (makefile-browser-on-macro-line-p) | |
725 (let ((macro-name (makefile-browser-this-line-macro-name))) | |
726 (kill-line) | |
727 (insert | |
728 (makefile-browser-format-macro-line | |
729 macro-name | |
730 (makefile-browser-get-state-for-line this-line)))) | |
731 (let ((target-name (makefile-browser-this-line-target-name))) | |
732 (kill-line) | |
733 (insert | |
734 (makefile-browser-format-target-line | |
735 target-name | |
736 (makefile-browser-get-state-for-line this-line))))) | |
737 (setq buffer-read-only t) | |
738 (beginning-of-line) | |
739 (forward-char makefile-browser-cursor-column) | |
740 (if makefile-browser-auto-advance-after-selection-p | |
741 (makefile-browser-next-line)))) | |
742 | |
743 ;;; | |
744 ;;; Making insertions into the client buffer | |
745 ;;; | |
746 | |
747 (defun makefile-browser-insert-continuation () | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
748 "Insert a makefile continuation. |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
749 In the browser\'s client buffer, go to (end-of-line), insert a \'\\\' |
809 | 750 character, insert a new blank line, go to that line and indent by one TAB. |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
751 This is most useful in the process of creating continued lines when copying |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
752 large dependencies from the browser to the client buffer. |
809 | 753 (point) advances accordingly in the client buffer." |
754 (interactive) | |
755 (save-excursion | |
756 (set-buffer makefile-browser-client) | |
757 (end-of-line) | |
758 (insert "\\\n\t"))) | |
759 | |
760 (defun makefile-browser-insert-selection () | |
761 "Insert all browser-selected targets and/or macros in the browser\'s | |
762 client buffer. | |
763 Insertion takes place at (point)." | |
764 (interactive) | |
765 (save-excursion | |
766 (goto-line 1) | |
767 (let ((current-line 1)) | |
768 (while (not (eobp)) | |
769 (if (makefile-browser-get-state-for-line current-line) | |
770 (makefile-browser-send-this-line-item)) | |
771 (forward-line 1) | |
772 (setq current-line (1+ current-line)))))) | |
773 | |
774 (defun makefile-browser-insert-selection-and-quit () | |
775 (interactive) | |
776 (makefile-browser-insert-selection) | |
777 (makefile-browser-quit)) | |
778 | |
779 (defun makefile-browser-send-this-line-item () | |
780 (if (makefile-browser-on-macro-line-p) | |
781 (save-excursion | |
782 (let ((macro-name (makefile-browser-this-line-macro-name))) | |
783 (set-buffer makefile-browser-client) | |
784 (insert (makefile-format-macro-ref macro-name) " "))) | |
785 (save-excursion | |
786 (let ((target-name (makefile-browser-this-line-target-name))) | |
787 (set-buffer makefile-browser-client) | |
788 (insert target-name " "))))) | |
789 | |
790 (defun makefile-browser-start-interaction () | |
791 (use-local-map makefile-browser-map) | |
792 (setq buffer-read-only t)) | |
793 | |
794 (defun makefile-browse (targets macros) | |
795 (interactive) | |
796 (if (zerop (+ (length targets) (length macros))) | |
797 (progn | |
798 (beep) | |
799 (message "No macros or targets to browse! Consider running 'makefile-pickup-everything\'")) | |
800 (let ((browser-buffer (get-buffer-create makefile-browser-buffer-name))) | |
801 (pop-to-buffer browser-buffer) | |
802 (make-variable-buffer-local 'makefile-browser-selection-vector) | |
803 (makefile-browser-fill targets macros) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
804 (shrink-window-if-larger-than-buffer) |
809 | 805 (setq makefile-browser-selection-vector |
806 (make-vector (+ (length targets) (length macros)) nil)) | |
807 (makefile-browser-start-interaction)))) | |
808 | |
809 (defun makefile-switch-to-browser () | |
810 (interactive) | |
811 (run-hooks 'makefile-browser-hook) | |
812 (setq makefile-browser-client (current-buffer)) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
813 (makefile-pickup-targets) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
814 (makefile-pickup-macros) |
809 | 815 (makefile-browse makefile-target-table makefile-macro-table)) |
816 | |
817 | |
818 ;;; ------------------------------------------------------------ | |
819 ;;; Up-to-date overview buffer | |
820 ;;; ------------------------------------------------------------ | |
821 | |
822 (defun makefile-create-up-to-date-overview () | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
823 "Create a buffer containing an overview of the state of all known targets. |
809 | 824 Known targets are targets that are explicitly defined in that makefile; |
825 in other words, all targets that appear on the left hand side of a | |
826 dependency in the makefile." | |
827 (interactive) | |
828 (if (y-or-n-p "Are you sure that the makefile being edited is consistent? ") | |
829 ;; | |
830 ;; The rest of this function operates on a temporary makefile, created by | |
831 ;; writing the current contents of the makefile buffer. | |
832 ;; | |
833 (let ((saved-target-table makefile-target-table) | |
834 (this-buffer (current-buffer)) | |
835 (makefile-up-to-date-buffer | |
836 (get-buffer-create makefile-up-to-date-buffer-name)) | |
837 (filename (makefile-save-temporary)) | |
838 ;; | |
839 ;; Forget the target table because it may contain picked-up filenames | |
840 ;; that are not really targets in the current makefile. | |
841 ;; We don't want to query these, so get a new target-table with just the | |
842 ;; targets that can be found in the makefile buffer. | |
843 ;; The 'old' target table will be restored later. | |
844 ;; | |
845 (real-targets (progn | |
846 (makefile-pickup-targets) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
847 makefile-target-table)) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
848 (prereqs makefile-has-prereqs) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
849 ) |
809 | 850 |
851 (set-buffer makefile-up-to-date-buffer) | |
852 (setq buffer-read-only nil) | |
853 (erase-buffer) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
854 (makefile-query-targets filename real-targets prereqs) |
809 | 855 (if (zerop (buffer-size)) ; if it did not get us anything |
856 (progn | |
857 (kill-buffer (current-buffer)) | |
858 (message "No overview created!"))) | |
859 (set-buffer this-buffer) | |
860 (setq makefile-target-table saved-target-table) | |
861 (if (get-buffer makefile-up-to-date-buffer-name) | |
862 (progn | |
863 (pop-to-buffer (get-buffer makefile-up-to-date-buffer-name)) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
864 (shrink-window-if-larger-than-buffer) |
809 | 865 (sort-lines nil (point-min) (point-max)) |
866 (setq buffer-read-only t)))))) | |
867 | |
868 (defun makefile-save-temporary () | |
869 "Create a temporary file from the current makefile buffer." | |
870 (let ((filename (makefile-generate-temporary-filename))) | |
871 (write-region (point-min) (point-max) filename nil 0) | |
872 filename)) ; return the filename | |
873 | |
874 (defun makefile-generate-temporary-filename () | |
875 "Create a filename suitable for use in makefile-save-temporary. | |
876 Be careful to allow brain-dead file systems (DOS, SYSV ...) to cope | |
877 with the generated name !" | |
878 (let ((my-name (user-login-name)) | |
879 (my-uid (int-to-string (user-uid)))) | |
880 (concat "mktmp" | |
881 (if (> (length my-name) 3) | |
882 (substring my-name 0 3) | |
883 my-name) | |
884 "." | |
885 (if (> (length my-uid) 3) | |
886 (substring my-uid 0 3) | |
887 my-uid)))) | |
888 | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
889 (defun makefile-query-targets (filename target-table prereq-list) |
809 | 890 "This function fills the up-to-date-overview-buffer. |
891 It checks each target in target-table using makefile-query-one-target-method | |
892 and generates the overview, one line per target name." | |
893 (insert | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
894 (mapconcat |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
895 (function (lambda (item) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
896 (let* ((target-name (car item)) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
897 (no-prereqs (not (member target-name prereq-list))) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
898 (needs-rebuild (or no-prereqs |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
899 (funcall |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
900 makefile-query-one-target-method |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
901 target-name |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
902 filename)))) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
903 (format "\t%s%s" |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
904 target-name |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
905 (cond (no-prereqs " .. has no prerequisites") |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
906 (needs-rebuild " .. NEEDS REBUILD") |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
907 (t " .. is up to date")))) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
908 )) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
909 target-table "\n")) |
809 | 910 (goto-char (point-min)) |
911 (delete-file filename)) ; remove the tmpfile | |
912 | |
913 (defun makefile-query-by-make-minus-q (target &optional filename) | |
914 (not (zerop (call-process makefile-brave-make nil nil nil "-f" filename "-q" target)))) | |
915 | |
916 ;;; ------------------------------------------------------------ | |
917 ;;; Continuation cleanup | |
918 ;;; ------------------------------------------------------------ | |
919 | |
920 (defun makefile-cleanup-continuations () | |
921 (if (eq major-mode 'makefile-mode) | |
922 (if (and makefile-cleanup-continuations-p | |
923 (not buffer-read-only)) | |
924 (save-excursion | |
925 (goto-char (point-min)) | |
926 (while (re-search-forward "\\\\[ \t]+$" (point-max) t) | |
927 (replace-match "\\" t t)))))) | |
928 | |
929 ;;; ------------------------------------------------------------ | |
930 ;;; GNU make function support | |
931 ;;; ------------------------------------------------------------ | |
932 | |
933 (defun makefile-insert-gmake-function () | |
934 "This function is intended to help you using the numerous | |
935 macro-like \'function calls\' of GNU make. | |
936 It will ask you for the name of the function you wish to | |
937 use (with completion), then, after you selected the function, | |
938 it will prompt you for all required parameters. | |
939 This function \'knows\' about the required parameters of every | |
940 GNU make function and will use meaningfull prompts for the | |
941 various args, making it much easier to take advantage of this | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
2671
diff
changeset
|
942 powerful GNU make feature." |
809 | 943 (interactive) |
944 (let* ((gm-function-name (completing-read | |
945 "Function: " | |
946 makefile-gnumake-functions-alist | |
947 nil t nil)) | |
948 (gm-function-prompts | |
949 (cdr (assoc gm-function-name makefile-gnumake-functions-alist)))) | |
950 (if (not (zerop (length gm-function-name))) | |
951 (insert (makefile-format-macro-ref | |
952 (concat gm-function-name " " | |
953 (makefile-prompt-for-gmake-funargs | |
954 gm-function-name gm-function-prompts))) | |
955 " ")))) | |
956 | |
957 (defun makefile-prompt-for-gmake-funargs (function-name prompt-list) | |
958 (mapconcat | |
959 (function (lambda (one-prompt) | |
960 (read-string (format "[%s] %s: " function-name one-prompt) nil))) | |
961 prompt-list | |
962 ",")) | |
963 | |
964 | |
965 | |
966 ;;; ------------------------------------------------------------ | |
967 ;;; Utility functions | |
968 ;;; ------------------------------------------------------------ | |
969 | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
970 (defun makefile-remember-target (target-name &optional has-prereqs) |
809 | 971 "Remember a given target if it is not already remembered for this buffer." |
972 (if (not (zerop (length target-name))) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
973 (progn |
809 | 974 (if (not (assoc target-name makefile-target-table)) |
975 (setq makefile-target-table | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
976 (cons (list target-name) makefile-target-table))) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
977 (if has-prereqs |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
978 (setq makefile-has-prereqs |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
979 (cons target-name makefile-has-prereqs)))))) |
809 | 980 |
981 (defun makefile-remember-macro (macro-name) | |
982 "Remember a given macro if it is not already remembered for this buffer." | |
983 (if (not (zerop (length macro-name))) | |
984 (if (not (assoc macro-name makefile-macro-table)) | |
985 (setq makefile-macro-table | |
986 (cons (list macro-name) makefile-macro-table))))) | |
987 | |
988 (defun makefile-forward-after-target-colon () | |
989 "Move point forward after the terminating colon | |
990 of a target has been inserted. | |
991 This accts according to the value of makefile-tab-after-target-colon ." | |
992 (if makefile-tab-after-target-colon | |
993 (insert "\t") | |
994 (insert " "))) | |
995 | |
996 (defun makefile-browser-on-macro-line-p () | |
997 "Determine if point is on a macro line in the browser." | |
998 (save-excursion | |
999 (beginning-of-line) | |
1000 (re-search-forward "\\$[{(]" (makefile-end-of-line-point) t))) | |
1001 | |
1002 (defun makefile-browser-this-line-target-name () | |
1003 "Extract the target name from a line in the browser." | |
1004 (save-excursion | |
1005 (end-of-line) | |
1006 (skip-chars-backward "^ \t") | |
1007 (buffer-substring (point) (1- (makefile-end-of-line-point))))) | |
1008 | |
1009 (defun makefile-browser-this-line-macro-name () | |
1010 "Extract the macro name from a line in the browser." | |
1011 (save-excursion | |
1012 (beginning-of-line) | |
1013 (re-search-forward "\\$[{(]" (makefile-end-of-line-point) t) | |
1014 (let ((macro-start (point))) | |
1015 (skip-chars-forward "^})") | |
1016 (buffer-substring macro-start (point))))) | |
1017 | |
1018 (defun makefile-format-macro-ref (macro-name) | |
1019 "Format a macro reference according to the value of the | |
1020 configuration variable makefile-use-curly-braces-for-macros-p ." | |
1021 (if makefile-use-curly-braces-for-macros-p | |
1022 (format "${%s}" macro-name) | |
1023 (format "$(%s)" macro-name))) | |
1024 | |
1025 (defun makefile-browser-get-state-for-line (n) | |
1026 (aref makefile-browser-selection-vector (1- n))) | |
1027 | |
1028 (defun makefile-browser-set-state-for-line (n to-state) | |
1029 (aset makefile-browser-selection-vector (1- n) to-state)) | |
1030 | |
1031 (defun makefile-browser-toggle-state-for-line (n) | |
1032 (makefile-browser-set-state-for-line n (not (makefile-browser-get-state-for-line n)))) | |
1033 | |
1034 (defun makefile-beginning-of-line-point () | |
1035 (save-excursion | |
1036 (beginning-of-line) | |
1037 (point))) | |
1038 | |
1039 (defun makefile-end-of-line-point () | |
1040 (save-excursion | |
1041 (end-of-line) | |
1042 (point))) | |
1043 | |
1044 (defun makefile-last-line-p () | |
1045 (= (makefile-end-of-line-point) (point-max))) | |
1046 | |
1047 (defun makefile-first-line-p () | |
1048 (= (makefile-beginning-of-line-point) (point-min))) | |
1049 | |
1050 ;; makefile.el ends here |