annotate lisp/progmodes/make-mode.el @ 9691:eea337e3af4e

(Fx_selection_exists_p): Fix backwards if.
author Richard M. Stallman <rms@gnu.org>
date Tue, 25 Oct 1994 10:34:49 +0000
parents 7a8a379513e4
children b9084912762f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1 ;;; makefile.el --- makefile editing commands for Emacs
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
2
6146
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
3 ;; Copyright (C) 1992, 1994 Free Software Foundation, Inc.
841
2cdce064065f entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 811
diff changeset
4
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
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
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
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
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
9
2671
09647458cad9 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 2559
diff changeset
10 ;; RMS:
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
11 ;; This needs work.
2671
09647458cad9 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 2559
diff changeset
12 ;; Also, the doc strings need fixing: the first line doesn't stand alone,
09647458cad9 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 2559
diff changeset
13 ;; and other usage is not high quality. Symbol names don't have `...'.
09647458cad9 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 2559
diff changeset
14
09647458cad9 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 2559
diff changeset
15 ;; So, for the meantime, this is not the default mode for makefiles.
09647458cad9 Comment changes.
Richard M. Stallman <rms@gnu.org>
parents: 2559
diff changeset
16
9477
7a8a379513e4 * makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents: 9454
diff changeset
17 ;; $Id: makefile.el,v 1.17 1994/10/11 20:42:23 rms Exp simon $
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
18
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
19 ;; This file is part of GNU Emacs.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
20
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
21 ;; GNU Emacs is free software; you can redistribute it and/or modify
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
22 ;; it under the terms of the GNU General Public License as published by
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
23 ;; the Free Software Foundation; either version 1, or (at your option)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
24 ;; any later version.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
25
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
26 ;; GNU Emacs is distributed in the hope that it will be useful,
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
27 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
28 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
29 ;; GNU General Public License for more details.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
30
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
31 ;; You should have received a copy of the GNU General Public License
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
32 ;; along with GNU Emacs; see the file COPYING. If not, write to
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
33 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
34
2307
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 841
diff changeset
35 ;;; Commentary:
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 841
diff changeset
36
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
37 ;; 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
38 ;; 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
39 ;;
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
40 ;; 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
41 ;; 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
42 ;; 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
43 ;; 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
44 ;; 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
45 ;; 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
46 ;;
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
47 ;; The command C-c C-f adds certain filenames in the current directory
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
48 ;; 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
49 ;; 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
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 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
52 ;; 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
53 ;; 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
54 ;; prerequisites.
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
55 ;;
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
56 ;; The command C-c C-b pops up a browser window listing all target and
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
57 ;; 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
58 ;; 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
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 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
61 ;; 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
62 ;;
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
63 ;; There are numerous other customization variables.
2307
10e417efb12a Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 841
diff changeset
64
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
65 ;;
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
66 ;; To Do:
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
67 ;;
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
68 ;; * Eliminate electric stuff entirely.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
69 ;; * It might be nice to highlight targets differently depending on
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
70 ;; whether they are up-to-date or not. Not sure how this would
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
71 ;; interact with font-lock.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
72 ;; * Would be nice to edit the commands in ksh-mode and have
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
73 ;; indentation and slashification done automatically. Hard.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
74 ;; * Consider removing browser mode. It seems useless.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
75 ;; * ":" should notice when a new target is made and add it to the
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
76 ;; list (or at least set makefile-need-target-pickup).
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
77 ;; * Make browser into a mode.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
78 ;; * Clean up macro insertion stuff. It is a mess.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
79 ;; * Browser entry and exit is weird. Normalize.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
80 ;; * Browser needs to be rewritten. Right now it is kind of a crock.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
81 ;; Should at least:
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
82 ;; * Act more like dired/buffer menu/whatever.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
83 ;; * Highlight as mouse traverses.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
84 ;; * B2 inserts.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
85 ;; * Update documentation above.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
86 ;; * Update texinfo manual.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
87 ;; * Update files.el.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
88
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
89
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
90
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
91 ;;; Code:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
92
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
93 (provide 'makefile)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
94
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
95 ;; Sadly we need this for a macro.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
96 (eval-when-compile
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
97 (require 'imenu))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
98
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
99 ;;; ------------------------------------------------------------
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2671
diff changeset
100 ;;; Configurable stuff
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
101 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
102
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
103 (defvar makefile-browser-buffer-name "*Macros and Targets*"
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
104 "Name of the macro- and target browser buffer.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
105
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
106 (defvar makefile-target-colon ":"
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
107 "The string that gets appended to all target names
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
108 inserted by makefile-insert-target.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
109 \":\" or \"::\" are quite common values.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
110
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
111 (defvar makefile-macro-assign " = "
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
112 "The string that gets appended to all macro names
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
113 inserted by makefile-insert-macro.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
114 The normal value should be \" = \", since this is what
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
115 standard make expects. However, newer makes such as dmake
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
116 allow a larger variety of different macro assignments, so you
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
117 might prefer to use \" += \" or \" := \" .")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
118
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
119 (defvar makefile-electric-keys nil
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
120 "If non-nil, install electric keybindings.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
121 Default is nil.")
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
122
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
123 (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
124 "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
125 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
126 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
127 will cause makefile-mode to use parentheses, making macro references
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
128 look like $(this) .")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
129
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
130 (defvar makefile-tab-after-target-colon t
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
131 "If you want a TAB (instead of a space) to be appended after the
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
132 target colon, then set this to a non-nil value.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
133
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
134 (defvar makefile-browser-leftmost-column 10
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
135 "Number of blanks to the left of the browser selection mark.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
136
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
137 (defvar makefile-browser-cursor-column 10
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
138 "Column in which the cursor is positioned when it moves
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
139 up or down in the browser.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
140
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
141 (defvar makefile-browser-selected-mark "+ "
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
142 "String used to mark selected entries in the browser.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
143
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
144 (defvar makefile-browser-unselected-mark " "
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
145 "String used to mark unselected entries in the browser.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
146
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
147 (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
148 "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
149 an item has been selected in the browser.")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
150
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
151 (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
152 "If non-nil, makefile-pickup-everything also picks up filenames as targets
7639
67b7d1ea7b2e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 7024
diff changeset
153 \(i.e. it calls makefile-find-filenames-as-targets), otherwise filenames are
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
154 omitted.")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
155
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
156 (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
157 "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
158 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
159 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
160 intact. IMPORTANT: Please note that enabling this option causes makefile-mode
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
161 to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \'it seems necessary\'.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
162
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
163 (defvar makefile-browser-hook '()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
164 "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
165 browser is entered. This is executed in the makefile buffer.")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
166
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
167 ;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
168 ;; Special targets for DMake, Sun's make ...
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
169 ;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
170 (defvar makefile-special-targets-list
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
171 '(("DEFAULT") ("DONE") ("ERROR") ("EXPORT")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
172 ("FAILED") ("GROUPEPILOG") ("GROUPPROLOG") ("IGNORE")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
173 ("IMPORT") ("INCLUDE") ("INCLUDEDIRS") ("INIT")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
174 ("KEEP_STATE") ("MAKEFILES") ("MAKE_VERSION") ("NO_PARALLEL")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
175 ("PARALLEL") ("PHONY") ("PRECIOUS") ("REMOVE")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
176 ("SCCS_GET") ("SILENT") ("SOURCE") ("SUFFIXES")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
177 ("WAIT") ("c.o") ("C.o") ("m.o")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
178 ("el.elc") ("y.c") ("s.o"))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
179 "List of special targets. You will be offered to complete
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
180 on one of those in the minibuffer whenever you enter a \".\"
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
181 at the beginning of a line in makefile-mode.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
182
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
183 (defvar makefile-runtime-macros-list
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
184 '(("@") ("&") (">") ("<") ("*") ("^") ("?") ("%") ("$"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
185 "List of macros that are resolved by make at runtime.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
186 If you insert a macro reference using makefile-insert-macro-ref, the name
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
187 of the macro is checked against this list. If it can be found its name will
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
188 not be enclosed in { } or ( ).")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
189
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
190 ;; Note that the first big subexpression is used by font lock. Note
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
191 ;; that if you change this regexp you must fix the imenu index
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
192 ;; function defined at the end of the file.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
193 (defconst makefile-dependency-regex
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
194 "^\\([^ \n\t#:]+\\([ \t]+[^ \t\n#:]+\\)*\\)[ \t]*:\\([ \t]*$\\|\\([^=\n].*$\\)\\)"
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
195 "Regex used to find dependency lines in a makefile.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
196
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
197 ;; Note that the first subexpression is used by font lock. Note that
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
198 ;; if you change this regexp you must fix the imenu index function
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
199 ;; defined at the end of the file.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
200 (defconst makefile-macroassign-regex
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
201 "^\\([^ \n\t][^:#=\n]*\\)[ \t]*[*:+]?:?="
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
202 "Regex used to find macro assignment lines in a makefile.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
203
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
204 (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
205 "\\(^\\..*\\)\\|\\(.*~$\\)\\|\\(.*,v$\\)\\|\\(\\.[chy]\\)"
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
206 "Regex for filenames that will NOT be included in the target list.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
207
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
208 (defconst makefile-font-lock-keywords
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
209 (list
9477
7a8a379513e4 * makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents: 9454
diff changeset
210 ;; Do macro assignments. These get the "variable-name" face rather
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
211 ;; arbitrarily.
9477
7a8a379513e4 * makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents: 9454
diff changeset
212 (list makefile-macroassign-regex 1 'font-lock-variable-name-face)
7a8a379513e4 * makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents: 9454
diff changeset
213 ;;
7a8a379513e4 * makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents: 9454
diff changeset
214 ;; Variable references even in targets/strings/comments:
7a8a379513e4 * makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents: 9454
diff changeset
215 '("\\$[({]\\([a-zA-Z0-9_]+\\)[})]" 1 font-lock-reference-face t)
7a8a379513e4 * makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents: 9454
diff changeset
216 ;;
7a8a379513e4 * makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents: 9454
diff changeset
217 ;; Do dependencies. These get the function name face.
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
218 (list makefile-dependency-regex 1 'font-lock-function-name-face)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
219
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
220 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
221 ;;; The following configurable variables are used in the
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
222 ;;; up-to-date overview .
3591
507f64624555 Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents: 2671
diff changeset
223 ;;; The standard configuration assumes that your `make' program
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
224 ;;; can be run in question/query mode using the `-q' option, this
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
225 ;;; means that the command
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
226 ;;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
227 ;;; make -q foo
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
228 ;;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
229 ;;; should return an exit status of zero if the target `foo' is
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
230 ;;; up to date and a nonzero exit status otherwise.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
231 ;;; 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
232 ;;; 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
233 ;;; Dennis Vadura's DMake have no problems.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
234 ;;; Set the variable `makefile-brave-make' to the name of the
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
235 ;;; 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
236 ;;; To understand what this is all about see the function definition
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
237 ;;; of `makefile-query-by-make-minus-q' .
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
238 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
239
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
240 (defvar makefile-brave-make "make"
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
241 "A make that can handle the \'-q\' option.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
242
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
243 (defvar makefile-query-one-target-method 'makefile-query-by-make-minus-q
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
244 "A function symbol [one that can be used as the first argument to
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
245 funcall] that provides a function that must conform to the following
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
246 interface:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
247
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
248 * As its first argument, it must accept the name of the target to
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
249 be checked, as a string.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
250
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
251 * 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
252 as a string. Depending on what you're going to do you may
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
253 not need this.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
254
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
255 * It must return the integer value 0 (zero) if the given target
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
256 should be considered up-to-date in the context of the given
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
257 makefile, any nonzero integer value otherwise.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
258
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
259 (defvar makefile-up-to-date-buffer-name "*Makefile Up-to-date overview*"
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
260 "Name of the Up-to-date overview buffer.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
261
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
262 ;;; --- end of up-to-date-overview configuration ------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
263
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
264 (defvar makefile-mode-map nil
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
265 "The keymap that is used in makefile-mode.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
266 (if makefile-mode-map
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
267 ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
268 (setq makefile-mode-map (make-sparse-keymap))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
269 ;; set up the keymap
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
270 (define-key makefile-mode-map "\C-c:" 'makefile-insert-target-ref)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
271 (if makefile-electric-keys
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
272 (progn
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
273 (define-key makefile-mode-map "$" 'makefile-insert-macro-ref)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
274 (define-key makefile-mode-map ":" 'makefile-electric-colon)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
275 (define-key makefile-mode-map "=" 'makefile-electric-equal)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
276 (define-key makefile-mode-map "." 'makefile-electric-dot)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
277 (define-key makefile-mode-map "\C-c\C-f" 'makefile-pickup-filenames-as-targets)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
278 (define-key makefile-mode-map "\C-c\C-b" 'makefile-switch-to-browser)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
279 (define-key makefile-mode-map "\C-c\C-p" 'makefile-pickup-everything)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
280 (define-key makefile-mode-map "\C-c\C-u" 'makefile-create-up-to-date-overview)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
281 (define-key makefile-mode-map "\C-c\C-i" 'makefile-insert-gmake-function)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
282 (define-key makefile-mode-map "\M-p" 'makefile-previous-dependency)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
283 (define-key makefile-mode-map "\M-n" 'makefile-next-dependency)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
284 (define-key makefile-mode-map "\e\t" 'makefile-complete)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
285
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
286 ;; Make menus.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
287 (define-key makefile-mode-map [menu-bar makefile-mode]
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
288 (cons "Makefile" (make-sparse-keymap "Makefile")))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
289
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
290 (define-key makefile-mode-map [menu-bar makefile-mode browse]
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
291 '("Pop up Makefile browser" . makefile-switch-to-browser))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
292 (define-key makefile-mode-map [menu-bar makefile-mode complete]
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
293 '("Complete target or macro" . makefile-complete))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
294 (define-key makefile-mode-map [menu-bar makefile-mode pickup]
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
295 '("Find targets and macros" . makefile-pickup-everything))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
296
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
297 (define-key makefile-mode-map [menu-bar makefile-mode prev]
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
298 '("Move to previous dependency" . makefile-previous-dependency))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
299 (define-key makefile-mode-map [menu-bar makefile-mode next]
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
300 '("Move to next dependency" . makefile-next-dependency)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
301
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
302 (defvar makefile-browser-map nil
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
303 "The keymap that is used in the macro- and target browser.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
304 (if makefile-browser-map
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
305 ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
306 (setq makefile-browser-map (make-sparse-keymap))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
307 (define-key makefile-browser-map "n" 'makefile-browser-next-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
308 (define-key makefile-browser-map "\C-n" 'makefile-browser-next-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
309 (define-key makefile-browser-map "p" 'makefile-browser-previous-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
310 (define-key makefile-browser-map "\C-p" 'makefile-browser-previous-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
311 (define-key makefile-browser-map " " 'makefile-browser-toggle)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
312 (define-key makefile-browser-map "i" 'makefile-browser-insert-selection)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
313 (define-key makefile-browser-map "I" 'makefile-browser-insert-selection-and-quit)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
314 (define-key makefile-browser-map "\C-c\C-m" 'makefile-browser-insert-continuation)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
315 (define-key makefile-browser-map "q" 'makefile-browser-quit)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
316 ;; disable horizontal movement
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
317 (define-key makefile-browser-map "\C-b" 'undefined)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
318 (define-key makefile-browser-map "\C-f" 'undefined))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
319
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
320
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
321 (defvar makefile-mode-syntax-table nil
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
322 "The syntax-table used in makefile mode.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
323 (if makefile-mode-syntax-table
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
324 ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
325 (setq makefile-mode-syntax-table (make-syntax-table))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
326 (modify-syntax-entry ?\( "() " makefile-mode-syntax-table)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
327 (modify-syntax-entry ?\) ")( " makefile-mode-syntax-table)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
328 (modify-syntax-entry ?\[ "(] " makefile-mode-syntax-table)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
329 (modify-syntax-entry ?\] "([ " makefile-mode-syntax-table)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
330 (modify-syntax-entry ?\{ "(} " makefile-mode-syntax-table)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
331 (modify-syntax-entry ?\} "){ " makefile-mode-syntax-table)
9477
7a8a379513e4 * makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents: 9454
diff changeset
332 (modify-syntax-entry ?\' "\" " makefile-mode-syntax-table)
7a8a379513e4 * makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents: 9454
diff changeset
333 (modify-syntax-entry ?\` "\" " makefile-mode-syntax-table)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
334 (modify-syntax-entry ?# "< " makefile-mode-syntax-table)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
335 (modify-syntax-entry ?\n "> " makefile-mode-syntax-table))
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
336
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
337
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
338 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
339 ;;; Internal variables.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
340 ;;; You don't need to configure below this line.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
341 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
342
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
343 (defvar makefile-target-table nil
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
344 "Table of all targets that have been inserted in
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
345 this Makefile buffer using makefile-insert-target or picked up
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
346 using makefile-pickup-targets.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
347
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
348 (defvar makefile-macro-table nil
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
349 "Table of all macros that have been iserted in
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
350 this Makefile buffer using makefile-insert-macro or picked up
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
351 using makefile-pickup-macros.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
352
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
353 (defvar makefile-browser-client
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
354 "A buffer in makefile-mode that is currently using the browser.")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
355
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
356 (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
357 (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
358 (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
359 (defvar makefile-need-macro-pickup t)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
360
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
361 (defvar makefile-mode-hook '())
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
362
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
363 (defconst makefile-gnumake-functions-alist
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
364 '(
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
365 ;; Text functions
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
366 ("subst" "From" "To" "In")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
367 ("patsubst" "Pattern" "Replacement" "In")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
368 ("strip" "Text")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
369 ("findstring" "Find what" "In")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
370 ("filter" "Pattern" "Text")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
371 ("filter-out" "Pattern" "Text")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
372 ("sort" "List")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
373 ;; Filename functions
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
374 ("dir" "Names")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
375 ("notdir" "Names")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
376 ("suffix" "Names")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
377 ("basename" "Names")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
378 ("addsuffix" "Suffix" "Names")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
379 ("join" "List 1" "List 2")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
380 ("word" "Index" "Text")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
381 ("words" "Text")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
382 ("firstword" "Text")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
383 ("wildcard" "Pattern")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
384 ;; Misc functions
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
385 ("foreach" "Variable" "List" "Text")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
386 ("origin" "Variable")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
387 ("shell" "Command"))
6146
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
388 "A list of GNU make function names associated with
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
389 the prompts for each function.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
390 This is used in the function makefile-insert-gmake-function .")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
391
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
392
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
393 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
394 ;;; The mode function itself.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
395 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
396
2534
0099d6be2b11 (makefile-mode): Fix typo in autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents: 2400
diff changeset
397 ;;;###autoload
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
398 (defun makefile-mode ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
399 "Major mode for editing Makefiles.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
400 Calling this function invokes the function(s) \"makefile-mode-hook\" before
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
401 doing anything else.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
402
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
403 \\{makefile-mode-map}
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
404
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
405 In the browser, use the following keys:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
406
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
407 \\{makefile-browser-map}
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
408
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
409 makefile-mode can be configured by modifying the following
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
410 variables:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
411
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
412 makefile-browser-buffer-name:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
413 Name of the macro- and target browser buffer.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
414
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
415 makefile-target-colon:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
416 The string that gets appended to all target names
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
417 inserted by makefile-insert-target.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
418 \":\" or \"::\" are quite common values.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
419
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
420 makefile-macro-assign:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
421 The string that gets appended to all macro names
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
422 inserted by makefile-insert-macro.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
423 The normal value should be \" = \", since this is what
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
424 standard make expects. However, newer makes such as dmake
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
425 allow a larger variety of different macro assignments, so you
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
426 might prefer to use \" += \" or \" := \" .
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
427
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
428 makefile-tab-after-target-colon:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
429 If you want a TAB (instead of a space) to be appended after the
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
430 target colon, then set this to a non-nil value.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
431
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
432 makefile-browser-leftmost-column:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
433 Number of blanks to the left of the browser selection mark.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
434
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
435 makefile-browser-cursor-column:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
436 Column in which the cursor is positioned when it moves
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
437 up or down in the browser.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
438
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
439 makefile-browser-selected-mark:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
440 String used to mark selected entries in the browser.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
441
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
442 makefile-browser-unselected-mark:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
443 String used to mark unselected entries in the browser.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
444
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
445 makefile-browser-auto-advance-after-selection-p:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
446 If this variable is set to a non-nil value the cursor
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
447 will automagically advance to the next line after an item
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
448 has been selected in the browser.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
449
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
450 makefile-pickup-everything-picks-up-filenames-p:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
451 If this variable is set to a non-nil value then
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
452 makefile-pickup-everything also picks up filenames as targets
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
453 (i.e. it calls makefile-find-filenames-as-targets), otherwise
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
454 filenames are omitted.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
455
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
456 makefile-cleanup-continuations-p:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
457 If this variable is set to a non-nil value then makefile-mode
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
458 will assure that no line in the file ends with a backslash
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
459 (the continuation character) followed by any whitespace.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
460 This is done by silently removing the trailing whitespace, leaving
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
461 the backslash itself intact.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
462 IMPORTANT: Please note that enabling this option causes makefile-mode
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
463 to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \'it seems necessary\'.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
464
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
465 makefile-browser-hook:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
466 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
467 browser is entered. This is executed in the makefile buffer.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
468
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
469 makefile-special-targets-list:
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
470 List of special targets. You will be offered to complete
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
471 on one of those in the minibuffer whenever you enter a \".\"
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
472 at the beginning of a line in makefile-mode."
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
473
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
474 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
475 (kill-all-local-variables)
6798
2594f541e694 (makefile-mode): make-local-variable misspelled as make-local-file.
Karl Heuer <kwzh@gnu.org>
parents: 6146
diff changeset
476 (make-local-variable 'local-write-file-hooks)
6146
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
477 (setq local-write-file-hooks
7024
f00ad05e91b0 (makefile-mode): Removed extra quote before makefile-warn-suspicious-lines.
Richard M. Stallman <rms@gnu.org>
parents: 6798
diff changeset
478 '(makefile-cleanup-continuations makefile-warn-suspicious-lines))
6146
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
479 (make-local-variable 'makefile-target-table)
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
480 (make-local-variable 'makefile-macro-table)
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
481 (make-local-variable 'makefile-has-prereqs)
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
482 (make-local-variable 'makefile-need-target-pickup)
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
483 (make-local-variable 'makefile-need-macro-pickup)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
484
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
485 ;; Font lock.
9477
7a8a379513e4 * makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents: 9454
diff changeset
486 (make-local-variable 'font-lock-defaults)
7a8a379513e4 * makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents: 9454
diff changeset
487 (setq font-lock-defaults '(makefile-font-lock-keywords))
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
488
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
489 ;; Add-log.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
490 (make-local-variable 'add-log-current-defun-function)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
491 (setq add-log-current-defun-function 'makefile-add-log-defun)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
492
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
493 ;; Imenu.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
494 (make-local-variable 'imenu-create-index-function)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
495 (setq imenu-create-index-function 'makefile-menu-index-function)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
496
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
497 ;; Comment stuff.
5464
4823e14b1314 (makefile-mode): Make comment-start, comment-end,
Richard M. Stallman <rms@gnu.org>
parents: 5312
diff changeset
498 (make-local-variable 'comment-start)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
499 (setq comment-start "#")
5464
4823e14b1314 (makefile-mode): Make comment-start, comment-end,
Richard M. Stallman <rms@gnu.org>
parents: 5312
diff changeset
500 (make-local-variable 'comment-end)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
501 (setq comment-end "")
5464
4823e14b1314 (makefile-mode): Make comment-start, comment-end,
Richard M. Stallman <rms@gnu.org>
parents: 5312
diff changeset
502 (make-local-variable 'comment-start-skip)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
503 (setq comment-start-skip "#+[ \t]*")
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
504
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
505 ;; become the current major mode
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
506 (setq major-mode 'makefile-mode)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
507 (setq mode-name "Makefile")
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
508
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
509 ;; Activate keymap and syntax table.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
510 (use-local-map makefile-mode-map)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
511 (set-syntax-table makefile-mode-syntax-table)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
512
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
513 ;; Real TABs are important in makefiles
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
514 (setq indent-tabs-mode t)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
515 (run-hooks 'makefile-mode-hook))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
516
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
517
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
518
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
519 ;;; Motion code.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
520
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
521 (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
522 "Move (point) to the beginning of the next dependency line below (point)."
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
523 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
524 (let ((here (point)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
525 (end-of-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
526 (if (re-search-forward makefile-dependency-regex (point-max) t)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
527 (progn (beginning-of-line) t) ; indicate success
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
528 (goto-char here) nil)))
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
529
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
530 (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
531 "Move (point) to the beginning of the next dependency line above (point)."
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
532 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
533 (let ((here (point)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
534 (beginning-of-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
535 (if (re-search-backward makefile-dependency-regex (point-min) t)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
536 (progn (beginning-of-line) t) ; indicate success
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
537 (goto-char here) nil)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
538
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
539
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
540
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
541 ;;; Electric keys. Blech.
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
542
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
543 (defun makefile-electric-dot (arg)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
544 "Prompt for the name of a special target to insert.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
545 Only does electric insertion at beginning of line.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
546 Anywhere else just self-inserts."
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
547 (interactive "p")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
548 (if (bolp)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
549 (makefile-insert-special-target)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
550 (self-insert-command arg)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
551
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
552 (defun makefile-insert-special-target ()
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
553 "Propmt for and insert a special target name.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
554 Uses `makefile-special-targets' list."
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
555 (interactive)
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
556 (makefile-pickup-targets)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
557 (let ((special-target
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
558 (completing-read "Special target: "
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
559 makefile-special-targets-list nil nil nil)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
560 (if (zerop (length special-target))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
561 ()
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
562 (insert "." special-target ":")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
563 (makefile-forward-after-target-colon))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
564
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
565 (defun makefile-electric-equal (arg)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
566 "Prompt for name of a macro to insert.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
567 Only does prompting if point is at beginning of line.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
568 Anywhere else just self-inserts."
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
569 (interactive "p")
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
570 (makefile-pickup-macros)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
571 (if (bolp)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
572 (call-interactively 'makefile-insert-macro)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
573 (self-insert-command arg)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
574
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
575 (defun makefile-insert-macro (macro-name)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
576 "Prepare definition of a new macro."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
577 (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
578 (makefile-pickup-macros)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
579 (if (not (zerop (length macro-name)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
580 (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
581 (beginning-of-line)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
582 (insert 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
583 (setq makefile-need-macro-pickup t)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
584 (makefile-remember-macro macro-name))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
585
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
586 (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
587 "Complete on a list of known macros, then insert complete ref at (point)."
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
588 (interactive
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
589 (list
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
590 (progn
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
591 (makefile-pickup-macros)
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
592 (completing-read "Refer to macro: " makefile-macro-table nil nil nil))))
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
593 (makefile-do-macro-insertion macro-name))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
594
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
595 (defun makefile-insert-target (target-name)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
596 "Prepare definition of a new target (dependency line)."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
597 (interactive "sTarget: ")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
598 (if (not (zerop (length target-name)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
599 (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
600 (beginning-of-line)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
601 (insert target-name makefile-target-colon)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
602 (makefile-forward-after-target-colon)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
603 (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
604 (setq makefile-need-target-pickup t)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
605 (makefile-remember-target target-name))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
606
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
607 (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
608 "Complete on a list of known targets, then insert target-ref at (point) ."
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
609 (interactive
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
610 (list
5312
aad805608eec (makefile-ignored-files-in-pickup-regex): Supply missing \\.
Richard M. Stallman <rms@gnu.org>
parents: 3591
diff changeset
611 (progn
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
612 (makefile-pickup-targets)
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
613 (completing-read "Refer to target: " makefile-target-table nil nil nil))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
614 (if (not (zerop (length target-name)))
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
615 (insert target-name " ")))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
616
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
617 (defun makefile-electric-colon (arg)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
618 "Prompt for name of new target.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
619 Prompting only happens at beginning of line.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
620 Anywhere else just self-inserts."
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
621 (interactive "p")
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
622 (if (bolp)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
623 (call-interactively 'makefile-insert-target)
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
624 (self-insert-command arg)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
625
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
626
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
627
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
628 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
629 ;;; Extracting targets and macros from an existing makefile
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
630 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
631
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
632 (defun makefile-pickup-targets ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
633 "Scan a buffer that contains a makefile for target definitions (dependencies)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
634 and add them to the list of known targets."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
635 (interactive)
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
636 (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
637 nil
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
638 (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
639 (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
640 (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
641 (save-excursion
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
642 (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
643 (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
644 (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
645 (message "Read targets OK.")))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
646
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
647 (defun makefile-add-this-line-targets ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
648 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
649 (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
650 (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
651 (line-number (1+ (count-lines (point-min) (point)))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
652 (while (not done-with-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
653 (skip-chars-forward " \t")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
654 (if (not (setq done-with-line (or (eolp)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
655 (char-equal (char-after (point)) ?:))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
656 (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
657 (let* ((start-of-target-name (point))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
658 (target-name
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
659 (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
660 (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
661 (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
662 (has-prereqs
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
663 (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
664 (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
665 (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
666 target-name line-number)))))))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
667
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
668
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
669 (defun makefile-pickup-macros ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
670 "Scan a buffer that contains a makefile for macro definitions
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
671 and add them to the list of known macros."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
672 (interactive)
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
673 (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
674 nil
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
675 (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
676 (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
677 (save-excursion
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
678 (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
679 (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
680 (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
681 (forward-line 1)))
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
682 (message "Read macros OK.")))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
683
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
684 (defun makefile-add-this-line-macro ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
685 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
686 (beginning-of-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
687 (skip-chars-forward " \t")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
688 (if (not (eolp))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
689 (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
690 (line-number (1+ (count-lines (point-min) (point))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
691 (macro-name (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
692 (skip-chars-forward "^ \t:#=*")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
693 (buffer-substring start-of-macro-name (point)))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
694 (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
695 (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
696 macro-name line-number))))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
697
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
698 (defun makefile-pickup-everything (arg)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
699 "Calls makefile-pickup-targets and makefile-pickup-macros.
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
700 See their documentation for what they do.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
701 Prefix arg means force pickups to be redone."
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
702 (interactive "P")
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
703 (if arg
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
704 (progn
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
705 (setq makefile-need-target-pickup t)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
706 (setq makefile-need-macro-pickup t)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
707 (makefile-pickup-macros)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
708 (makefile-pickup-targets)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
709 (if makefile-pickup-everything-picks-up-filenames-p
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
710 (makefile-pickup-filenames-as-targets)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
711
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
712 (defun makefile-pickup-filenames-as-targets ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
713 "Scan the current directory for filenames, check each filename
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
714 against makefile-ignored-files-in-pickup-regex and add all qualifying
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
715 names to the list of known targets."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
716 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
717 (let* ((dir (file-name-directory (buffer-file-name)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
718 (raw-filename-list (if dir
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
719 (file-name-all-completions "" dir)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
720 (file-name-all-completions "" ""))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
721 (mapcar '(lambda (name)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
722 (if (and (not (file-directory-p name))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
723 (not (string-match makefile-ignored-files-in-pickup-regex
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
724 name)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
725 (if (makefile-remember-target name)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
726 (message "Picked up file \"%s\" as target" name))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
727 raw-filename-list)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
728
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
729
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
730
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
731 ;;; Completion.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
732
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
733 (defun makefile-complete ()
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
734 "Perform completion on Makefile construct preceding point.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
735 Can complete variable and target names.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
736 The context determines which are considered."
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
737 (interactive)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
738 (let* ((beg (save-excursion
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
739 (skip-chars-backward "^$(){}:#= \t\n")
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
740 (point)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
741 (try (buffer-substring beg (point)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
742 (do-macros nil)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
743 (paren nil))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
744
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
745 (save-excursion
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
746 (goto-char beg)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
747 (let ((pc (preceding-char)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
748 (cond
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
749 ;; Beginning of line means anything.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
750 ((bolp)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
751 ())
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
752
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
753 ;; Preceding "$" means macros only.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
754 ((= pc ?$)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
755 (setq do-macros t))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
756
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
757 ;; Preceding "$(" or "${" means macros only.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
758 ((and (or (= pc ?{)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
759 (= pc ?\())
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
760 (progn
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
761 (setq paren pc)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
762 (backward-char)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
763 (and (not (bolp))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
764 (= (preceding-char) ?$))))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
765 (setq do-macros t)))))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
766
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
767 ;; Try completion.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
768 (let* ((table (append (if do-macros
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
769 '()
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
770 makefile-target-table)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
771 makefile-macro-table))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
772 (completion (try-completion try table)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
773 (cond
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
774 ;; Exact match, so insert closing paren or colon.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
775 ((eq completion t)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
776 (insert (if do-macros
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
777 (if (eq paren ?{)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
778 ?}
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
779 ?\))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
780 (if (save-excursion
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
781 (goto-char beg)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
782 (bolp))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
783 ":"
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
784 " "))))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
785
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
786 ;; No match.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
787 ((null completion)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
788 (message "Can't find completion for \"%s\"" try)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
789 (ding))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
790
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
791 ;; Partial completion.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
792 ((not (string= try completion))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
793 ;; FIXME it would be nice to supply the closing paren if an
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
794 ;; exact, unambiguous match were found. That is not possible
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
795 ;; right now. Ditto closing ":" for targets.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
796 (delete-region beg (point))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
797
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
798 ;; DO-MACROS means doing macros only. If not that, then check
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
799 ;; to see if this completion is a macro. Special insertion
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
800 ;; must be done for macros.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
801 (if (or do-macros
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
802 (assoc completion makefile-macro-table))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
803 (let ((makefile-use-curly-braces-for-macros-p
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
804 (or (eq paren ?{)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
805 makefile-use-curly-braces-for-macros-p)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
806 (delete-backward-char 2)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
807 (makefile-do-macro-insertion completion)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
808 (delete-backward-char 1))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
809
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
810 ;; Just insert targets.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
811 (insert completion)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
812
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
813 ;; Can't complete any more, so make completion list. FIXME
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
814 ;; this doesn't do the right thing when the completion is
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
815 ;; actually inserted. I don't think there is an easy way to do
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
816 ;; that.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
817 (t
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
818 (message "Making completion list...")
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
819 (let ((list (all-completions try table)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
820 (with-output-to-temp-buffer "*Completions*"
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
821 (display-completion-list list)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
822 (message "Making completion list...done"))))))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
823
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
824
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
825
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
826 ;;; ------------------------------------------------------------
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
827 ;;; Browser mode.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
828 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
829
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
830 (defun makefile-browser-format-target-line (target selected)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
831 (format
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
832 (concat (make-string makefile-browser-leftmost-column ?\ )
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
833 (if selected
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
834 makefile-browser-selected-mark
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
835 makefile-browser-unselected-mark)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
836 "%s%s")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
837 target makefile-target-colon))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
838
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
839 (defun makefile-browser-format-macro-line (macro selected)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
840 (format
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
841 (concat (make-string makefile-browser-leftmost-column ?\ )
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
842 (if selected
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
843 makefile-browser-selected-mark
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
844 makefile-browser-unselected-mark)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
845 (makefile-format-macro-ref macro))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
846
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
847 (defun makefile-browser-fill (targets macros)
5820
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
848 (let ((inhibit-read-only t))
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
849 (goto-char (point-min))
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
850 (erase-buffer)
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
851 (mapconcat
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
852 (function
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
853 (lambda (item) (insert (makefile-browser-format-target-line (car item) nil) "\n")))
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
854 targets
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
855 "")
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
856 (mapconcat
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
857 (function
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
858 (lambda (item) (insert (makefile-browser-format-macro-line (car item) nil) "\n")))
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
859 macros
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
860 "")
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
861 (sort-lines nil (point-min) (point-max))
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
862 (goto-char (1- (point-max)))
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
863 (delete-char 1) ; remove unnecessary newline at eob
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
864 (goto-char (point-min))
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
865 (forward-char makefile-browser-cursor-column)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
866
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
867 ;;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
868 ;;; Moving up and down in the browser
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
869 ;;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
870
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
871 (defun makefile-browser-next-line ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
872 "Move the browser selection cursor to the next line."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
873 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
874 (if (not (makefile-last-line-p))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
875 (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
876 (forward-line 1)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
877 (forward-char makefile-browser-cursor-column))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
878
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
879 (defun makefile-browser-previous-line ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
880 "Move the browser selection cursor to the previous line."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
881 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
882 (if (not (makefile-first-line-p))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
883 (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
884 (forward-line -1)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
885 (forward-char makefile-browser-cursor-column))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
886
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
887 ;;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
888 ;;; Quitting the browser (returns to client buffer)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
889 ;;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
890
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
891 (defun makefile-browser-quit ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
892 "Leave the makefile-browser-buffer and return to the buffer
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
893 from that it has been entered."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
894 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
895 (let ((my-client makefile-browser-client))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
896 (setq makefile-browser-client nil) ; we quitted, so NO client!
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
897 (set-buffer-modified-p nil)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
898 (kill-buffer (current-buffer))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
899 (pop-to-buffer my-client)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
900
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
901 ;;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
902 ;;; Toggle state of a browser item
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
903 ;;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
904
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
905 (defun makefile-browser-toggle ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
906 "Toggle the selection state of the browser item at the cursor position."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
907 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
908 (let ((this-line (count-lines (point-min) (point))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
909 (setq this-line (max 1 this-line))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
910 (makefile-browser-toggle-state-for-line this-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
911 (goto-line this-line)
5820
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
912 (let ((inhibit-read-only t))
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
913 (beginning-of-line)
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
914 (if (makefile-browser-on-macro-line-p)
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
915 (let ((macro-name (makefile-browser-this-line-macro-name)))
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
916 (kill-line)
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
917 (insert
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
918 (makefile-browser-format-macro-line
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
919 macro-name
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
920 (makefile-browser-get-state-for-line this-line))))
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
921 (let ((target-name (makefile-browser-this-line-target-name)))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
922 (kill-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
923 (insert
5820
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
924 (makefile-browser-format-target-line
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
925 target-name
3443820118a0 (makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents: 5464
diff changeset
926 (makefile-browser-get-state-for-line this-line))))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
927 (beginning-of-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
928 (forward-char makefile-browser-cursor-column)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
929 (if makefile-browser-auto-advance-after-selection-p
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
930 (makefile-browser-next-line))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
931
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
932 ;;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
933 ;;; Making insertions into the client buffer
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
934 ;;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
935
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
936 (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
937 "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
938 In the browser\'s client buffer, go to (end-of-line), insert a \'\\\'
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
939 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
940 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
941 large dependencies from the browser to the client buffer.
7639
67b7d1ea7b2e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 7024
diff changeset
942 \(point) advances accordingly in the client buffer."
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
943 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
944 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
945 (set-buffer makefile-browser-client)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
946 (end-of-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
947 (insert "\\\n\t")))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
948
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
949 (defun makefile-browser-insert-selection ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
950 "Insert all browser-selected targets and/or macros in the browser\'s
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
951 client buffer.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
952 Insertion takes place at (point)."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
953 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
954 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
955 (goto-line 1)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
956 (let ((current-line 1))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
957 (while (not (eobp))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
958 (if (makefile-browser-get-state-for-line current-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
959 (makefile-browser-send-this-line-item))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
960 (forward-line 1)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
961 (setq current-line (1+ current-line))))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
962
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
963 (defun makefile-browser-insert-selection-and-quit ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
964 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
965 (makefile-browser-insert-selection)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
966 (makefile-browser-quit))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
967
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
968 (defun makefile-browser-send-this-line-item ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
969 (if (makefile-browser-on-macro-line-p)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
970 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
971 (let ((macro-name (makefile-browser-this-line-macro-name)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
972 (set-buffer makefile-browser-client)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
973 (insert (makefile-format-macro-ref macro-name) " ")))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
974 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
975 (let ((target-name (makefile-browser-this-line-target-name)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
976 (set-buffer makefile-browser-client)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
977 (insert target-name " ")))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
978
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
979 (defun makefile-browser-start-interaction ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
980 (use-local-map makefile-browser-map)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
981 (setq buffer-read-only t))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
982
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
983 (defun makefile-browse (targets macros)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
984 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
985 (if (zerop (+ (length targets) (length macros)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
986 (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
987 (beep)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
988 (message "No macros or targets to browse! Consider running 'makefile-pickup-everything\'"))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
989 (let ((browser-buffer (get-buffer-create makefile-browser-buffer-name)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
990 (pop-to-buffer browser-buffer)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
991 (make-variable-buffer-local 'makefile-browser-selection-vector)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
992 (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
993 (shrink-window-if-larger-than-buffer)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
994 (setq makefile-browser-selection-vector
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
995 (make-vector (+ (length targets) (length macros)) nil))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
996 (makefile-browser-start-interaction))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
997
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
998 (defun makefile-switch-to-browser ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
999 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1000 (run-hooks 'makefile-browser-hook)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1001 (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
1002 (makefile-pickup-targets)
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1003 (makefile-pickup-macros)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1004 (makefile-browse makefile-target-table makefile-macro-table))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1005
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1006
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1007
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1008 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1009 ;;; Up-to-date overview buffer
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1010 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1011
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1012 (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
1013 "Create a buffer containing an overview of the state of all known targets.
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1014 Known targets are targets that are explicitly defined in that makefile;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1015 in other words, all targets that appear on the left hand side of a
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1016 dependency in the makefile."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1017 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1018 (if (y-or-n-p "Are you sure that the makefile being edited is consistent? ")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1019 ;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1020 ;; The rest of this function operates on a temporary makefile, created by
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1021 ;; writing the current contents of the makefile buffer.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1022 ;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1023 (let ((saved-target-table makefile-target-table)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1024 (this-buffer (current-buffer))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1025 (makefile-up-to-date-buffer
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1026 (get-buffer-create makefile-up-to-date-buffer-name))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1027 (filename (makefile-save-temporary))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1028 ;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1029 ;; Forget the target table because it may contain picked-up filenames
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1030 ;; that are not really targets in the current makefile.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1031 ;; We don't want to query these, so get a new target-table with just the
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1032 ;; targets that can be found in the makefile buffer.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1033 ;; The 'old' target table will be restored later.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1034 ;;
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1035 (real-targets (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1036 (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
1037 makefile-target-table))
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1038 (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
1039 )
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1040
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1041 (set-buffer makefile-up-to-date-buffer)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1042 (setq buffer-read-only nil)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1043 (erase-buffer)
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1044 (makefile-query-targets filename real-targets prereqs)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1045 (if (zerop (buffer-size)) ; if it did not get us anything
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1046 (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1047 (kill-buffer (current-buffer))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1048 (message "No overview created!")))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1049 (set-buffer this-buffer)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1050 (setq makefile-target-table saved-target-table)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1051 (if (get-buffer makefile-up-to-date-buffer-name)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1052 (progn
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1053 (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
1054 (shrink-window-if-larger-than-buffer)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1055 (sort-lines nil (point-min) (point-max))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1056 (setq buffer-read-only t))))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1057
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1058 (defun makefile-save-temporary ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1059 "Create a temporary file from the current makefile buffer."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1060 (let ((filename (makefile-generate-temporary-filename)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1061 (write-region (point-min) (point-max) filename nil 0)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1062 filename)) ; return the filename
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1063
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1064 (defun makefile-generate-temporary-filename ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1065 "Create a filename suitable for use in makefile-save-temporary.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1066 Be careful to allow brain-dead file systems (DOS, SYSV ...) to cope
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1067 with the generated name !"
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1068 (let ((my-name (user-login-name))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1069 (my-uid (int-to-string (user-uid))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1070 (concat "mktmp"
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1071 (if (> (length my-name) 3)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1072 (substring my-name 0 3)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1073 my-name)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1074 "."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1075 (if (> (length my-uid) 3)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1076 (substring my-uid 0 3)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1077 my-uid))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1078
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1079 (defun makefile-query-targets (filename target-table prereq-list)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1080 "This function fills the up-to-date-overview-buffer.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1081 It checks each target in target-table using makefile-query-one-target-method
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1082 and generates the overview, one line per target name."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1083 (insert
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1084 (mapconcat
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1085 (function (lambda (item)
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1086 (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
1087 (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
1088 (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
1089 (funcall
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1090 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
1091 target-name
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1092 filename))))
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1093 (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
1094 target-name
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1095 (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
1096 (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
1097 (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
1098 ))
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1099 target-table "\n"))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1100 (goto-char (point-min))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1101 (delete-file filename)) ; remove the tmpfile
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1102
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1103 (defun makefile-query-by-make-minus-q (target &optional filename)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1104 (not (zerop (call-process makefile-brave-make nil nil nil "-f" filename "-q" target))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1105
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1106
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1107
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1108 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1109 ;;; Continuation cleanup
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1110 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1111
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1112 (defun makefile-cleanup-continuations ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1113 (if (eq major-mode 'makefile-mode)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1114 (if (and makefile-cleanup-continuations-p
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1115 (not buffer-read-only))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1116 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1117 (goto-char (point-min))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1118 (while (re-search-forward "\\\\[ \t]+$" (point-max) t)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1119 (replace-match "\\" t t))))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1120
6146
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1121
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1122 ;;; ------------------------------------------------------------
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1123 ;;; Warn of suspicious lines
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1124 ;;; ------------------------------------------------------------
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1125
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1126 (defun makefile-warn-suspicious-lines ()
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1127 (let ((dont-save nil))
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1128 (if (eq major-mode 'makefile-mode)
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1129 (let ((suspicious
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1130 (save-excursion
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1131 (goto-char (point-min))
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1132 (re-search-forward
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1133 "\\(^[\t]+$\\)\\|\\(^[ ]+[\t]\\)" (point-max) t))))
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1134 (if suspicious
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1135 (let ((line-nr (count-lines (point-min) suspicious)))
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1136 (setq dont-save
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1137 (not (y-or-n-p
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1138 (format "Suspicious line %d. Save anyway "
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1139 line-nr))))))))
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1140 dont-save))
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1141
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1142
6146
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1143
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1144 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1145 ;;; GNU make function support
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1146 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1147
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1148 (defun makefile-insert-gmake-function ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1149 "This function is intended to help you using the numerous
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1150 macro-like \'function calls\' of GNU make.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1151 It will ask you for the name of the function you wish to
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1152 use (with completion), then, after you selected the function,
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1153 it will prompt you for all required parameters.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1154 This function \'knows\' about the required parameters of every
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1155 GNU make function and will use meaningfull prompts for the
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1156 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
1157 powerful GNU make feature."
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1158 (interactive)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1159 (let* ((gm-function-name (completing-read
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1160 "Function: "
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1161 makefile-gnumake-functions-alist
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1162 nil t nil))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1163 (gm-function-prompts
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1164 (cdr (assoc gm-function-name makefile-gnumake-functions-alist))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1165 (if (not (zerop (length gm-function-name)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1166 (insert (makefile-format-macro-ref
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1167 (concat gm-function-name " "
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1168 (makefile-prompt-for-gmake-funargs
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1169 gm-function-name gm-function-prompts)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1170 " "))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1171
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1172 (defun makefile-prompt-for-gmake-funargs (function-name prompt-list)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1173 (mapconcat
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1174 (function (lambda (one-prompt)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1175 (read-string (format "[%s] %s: " function-name one-prompt) nil)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1176 prompt-list
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1177 ","))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1178
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1179
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1180
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1181 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1182 ;;; Utility functions
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1183 ;;; ------------------------------------------------------------
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1184
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1185 (defun makefile-do-macro-insertion (macro-name)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1186 "Insert a macro reference."
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1187 (if (not (zerop (length macro-name)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1188 (if (assoc macro-name makefile-runtime-macros-list)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1189 (insert "$" macro-name)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1190 (insert (makefile-format-macro-ref macro-name)))))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1191
2559
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1192 (defun makefile-remember-target (target-name &optional has-prereqs)
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1193 "Remember a given target if it is not already remembered for this buffer."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1194 (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
1195 (progn
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1196 (if (not (assoc target-name makefile-target-table))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1197 (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
1198 (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
1199 (if has-prereqs
5f2c2994cbca Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2534
diff changeset
1200 (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
1201 (cons target-name makefile-has-prereqs))))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1202
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1203 (defun makefile-remember-macro (macro-name)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1204 "Remember a given macro if it is not already remembered for this buffer."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1205 (if (not (zerop (length macro-name)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1206 (if (not (assoc macro-name makefile-macro-table))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1207 (setq makefile-macro-table
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1208 (cons (list macro-name) makefile-macro-table)))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1209
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1210 (defun makefile-forward-after-target-colon ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1211 "Move point forward after the terminating colon
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1212 of a target has been inserted.
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1213 This accts according to the value of makefile-tab-after-target-colon ."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1214 (if makefile-tab-after-target-colon
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1215 (insert "\t")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1216 (insert " ")))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1217
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1218 (defun makefile-browser-on-macro-line-p ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1219 "Determine if point is on a macro line in the browser."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1220 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1221 (beginning-of-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1222 (re-search-forward "\\$[{(]" (makefile-end-of-line-point) t)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1223
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1224 (defun makefile-browser-this-line-target-name ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1225 "Extract the target name from a line in the browser."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1226 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1227 (end-of-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1228 (skip-chars-backward "^ \t")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1229 (buffer-substring (point) (1- (makefile-end-of-line-point)))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1230
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1231 (defun makefile-browser-this-line-macro-name ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1232 "Extract the macro name from a line in the browser."
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1233 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1234 (beginning-of-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1235 (re-search-forward "\\$[{(]" (makefile-end-of-line-point) t)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1236 (let ((macro-start (point)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1237 (skip-chars-forward "^})")
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1238 (buffer-substring macro-start (point)))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1239
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1240 (defun makefile-format-macro-ref (macro-name)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1241 "Format a macro reference according to the value of the
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1242 configuration variable makefile-use-curly-braces-for-macros-p ."
6146
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1243 (if (or (char-equal ?\( (string-to-char macro-name))
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1244 (char-equal ?\{ (string-to-char macro-name)))
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1245 (format "$%s" macro-name)
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1246 (if makefile-use-curly-braces-for-macros-p
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1247 (format "${%s}" macro-name)
1a2a8ef9b4af (makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents: 5820
diff changeset
1248 (format "$(%s)" macro-name))))
809
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1249
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1250 (defun makefile-browser-get-state-for-line (n)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1251 (aref makefile-browser-selection-vector (1- n)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1252
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1253 (defun makefile-browser-set-state-for-line (n to-state)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1254 (aset makefile-browser-selection-vector (1- n) to-state))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1255
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1256 (defun makefile-browser-toggle-state-for-line (n)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1257 (makefile-browser-set-state-for-line n (not (makefile-browser-get-state-for-line n))))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1258
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1259 (defun makefile-beginning-of-line-point ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1260 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1261 (beginning-of-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1262 (point)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1263
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1264 (defun makefile-end-of-line-point ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1265 (save-excursion
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1266 (end-of-line)
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1267 (point)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1268
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1269 (defun makefile-last-line-p ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1270 (= (makefile-end-of-line-point) (point-max)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1271
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1272 (defun makefile-first-line-p ()
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1273 (= (makefile-beginning-of-line-point) (point-min)))
8a0066235d56 Initial revision
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
diff changeset
1274
9454
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1275
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1276
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1277 ;;; Support for other packages, like add-log and imenu.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1278
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1279 (defun makefile-add-log-defun ()
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1280 "Return name of target or macro point is in, or nil."
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1281 (save-excursion
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1282 (beginning-of-line)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1283 (cond
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1284 ((looking-at makefile-macroassign-regex)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1285 (buffer-substring (match-beginning 1)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1286 (match-end 1)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1287 ((progn
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1288 (forward-char)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1289 (re-search-backward makefile-dependency-regex nil t))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1290 (buffer-substring (match-beginning 1)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1291 (match-end 1)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1292 (t nil))))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1293
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1294 ;; FIXME it might be nice to have them separated by macro vs target.
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1295 (defun makefile-menu-index-function ()
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1296 "Generate alist of indices for imenu."
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1297 (let (alist
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1298 stupid
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1299 (re (concat makefile-dependency-regex
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1300 "\\|"
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1301 makefile-macroassign-regex)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1302 (imenu-progress-message stupid 0)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1303 (goto-char (point-min))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1304 (while (re-search-forward re nil t)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1305 (imenu-progress-message stupid)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1306 (setq zardoz (list (match-beginning 0) (match-end 0)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1307 (match-beginning 1) (match-end 1)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1308 ))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1309 (let ((n (if (match-beginning 1) 1 5)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1310 (setq alist (cons
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1311 (cons (buffer-substring (match-beginning n)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1312 (match-end n))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1313 (match-beginning n))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1314 alist))))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1315 (imenu-progress-message stupid 100)
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1316 (nreverse alist)))
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1317
40340d39257d (makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1318 ;;; makefile.el ends here