Mercurial > emacs
annotate lisp/progmodes/make-mode.el @ 65055:0b9598224a95
(compilation-disable-input): Default to nil.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 20 Aug 2005 21:47:06 +0000 |
parents | 629afbe74e61 |
children | 4dadc0d80d76 edf295560b5a |
rev | line source |
---|---|
13402
1f9832fe9e44
(makefile-define-space-face): Don't make face if non-X.
Karl Heuer <kwzh@gnu.org>
parents:
13333
diff
changeset
|
1 ;;; make-mode.el --- makefile editing commands for Emacs |
809 | 2 |
64699
629afbe74e61
Update copyright for release of 22.1 for progmodes directory.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
3 ;; Copyright (C) 1992, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 2005 |
629afbe74e61
Update copyright for release of 22.1 for progmodes directory.
Nick Roberts <nickrob@snap.net.nz>
parents:
64085
diff
changeset
|
4 ;; Free Software Foundation, Inc. |
841 | 5 |
809 | 6 ;; 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
|
7 ;; Eric S. Raymond <esr@snark.thyrsus.com> |
17976 | 8 ;; Maintainer: FSF |
809 | 9 ;; Adapted-By: ESR |
811
e694e0879463
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
809
diff
changeset
|
10 ;; Keywords: unix, tools |
809 | 11 |
12 ;; This file is part of GNU Emacs. | |
13 | |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
15 ;; it under the terms of the GNU General Public License as published by | |
12244 | 16 ;; the Free Software Foundation; either version 2, or (at your option) |
809 | 17 ;; any later version. |
18 | |
19 ;; GNU Emacs is distributed in the hope that it will be useful, | |
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 ;; GNU General Public License for more details. | |
23 | |
24 ;; You should have received a copy of the GNU General Public License | |
14169 | 25 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 26 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
27 ;; Boston, MA 02110-1301, USA. | |
809 | 28 |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
841
diff
changeset
|
29 ;;; Commentary: |
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
841
diff
changeset
|
30 |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
31 ;; 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
|
32 ;; 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
|
33 ;; |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
34 ;; 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
|
35 ;; 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
|
36 ;; 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
|
37 ;; 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
|
38 ;; 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
|
39 ;; 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
|
40 ;; |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
41 ;; 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
|
42 ;; 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
|
43 ;; 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
|
44 ;; |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
45 ;; 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
|
46 ;; 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
|
47 ;; 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
|
48 ;; prerequisites. |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
49 ;; |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
50 ;; The command C-c C-b pops up a browser window listing all target and |
62082
2805978983d8
(makefile-font-lock-keywords): Use font-lock-negation-char-face.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57158
diff
changeset
|
51 ;; macro names. You can mark or unmark items with C-c SPC, and insert |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
52 ;; 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
|
53 ;; |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
54 ;; 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
|
55 ;; 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
|
56 ;; |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
57 ;; There are numerous other customization variables. |
2307
10e417efb12a
Added or corrected Commentary sections
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
841
diff
changeset
|
58 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
59 ;; |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
60 ;; To Do: |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
61 ;; |
56503 | 62 ;; * Add missing doc strings, improve terse doc strings. |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
63 ;; * Eliminate electric stuff entirely. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
64 ;; * 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
|
65 ;; 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
|
66 ;; interact with font-lock. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
67 ;; * 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
|
68 ;; indentation and slashification done automatically. Hard. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
69 ;; * Consider removing browser mode. It seems useless. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
70 ;; * ":" 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
|
71 ;; list (or at least set makefile-need-target-pickup). |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
72 ;; * Make browser into a major mode. |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
73 ;; * Clean up macro insertion stuff. It is a mess. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
74 ;; * Browser entry and exit is weird. Normalize. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
75 ;; * 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
|
76 ;; Should at least: |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
77 ;; * Act more like dired/buffer menu/whatever. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
78 ;; * Highlight as mouse traverses. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
79 ;; * B2 inserts. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
80 ;; * Update documentation above. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
81 ;; * Update texinfo manual. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
82 ;; * Update files.el. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
83 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
84 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
85 |
809 | 86 ;;; Code: |
87 | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
88 ;; Sadly we need this for a macro. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
89 (eval-when-compile |
28503 | 90 (require 'imenu) |
91 (require 'dabbrev) | |
92 (require 'add-log)) | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
93 |
809 | 94 ;;; ------------------------------------------------------------ |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
2671
diff
changeset
|
95 ;;; Configurable stuff |
809 | 96 ;;; ------------------------------------------------------------ |
97 | |
19008 | 98 (defgroup makefile nil |
99 "Makefile editing commands for Emacs." | |
100 :group 'tools | |
101 :prefix "makefile-") | |
809 | 102 |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
103 (defface makefile-space |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
104 '((((class color)) (:background "hotpink")) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
105 (t (:reverse-video t))) |
19028
f2458ec72074
(makefile-space-face): Add defface.
Richard M. Stallman <rms@gnu.org>
parents:
19008
diff
changeset
|
106 "Face to use for highlighting leading spaces in Font-Lock mode." |
f2458ec72074
(makefile-space-face): Add defface.
Richard M. Stallman <rms@gnu.org>
parents:
19008
diff
changeset
|
107 :group 'faces |
48377
7f3cb336821a
(makefile-space-face): Fix typo in group name.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
48037
diff
changeset
|
108 :group 'makefile) |
63474
7e5dd206d539
(put 'makefile-space-face 'face-alias 'makefile-space)
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63444
diff
changeset
|
109 (put 'makefile-space-face 'face-alias 'makefile-space) |
19028
f2458ec72074
(makefile-space-face): Add defface.
Richard M. Stallman <rms@gnu.org>
parents:
19008
diff
changeset
|
110 |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
111 (defface makefile-targets |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
112 ;; This needs to go along both with foreground and background colors (i.e. shell) |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
113 '((t (:inherit font-lock-function-name-face))) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
114 "Face to use for additionally highlighting rule targets in Font-Lock mode." |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
115 :group 'faces |
62965
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
116 :group 'makefile |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
117 :version "22.1") |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
118 |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
119 (defface makefile-shell |
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
120 () |
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
121 ;;'((((class color) (min-colors 88) (background light)) (:background "seashell1")) |
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
122 ;; (((class color) (min-colors 88) (background dark)) (:background "seashell4"))) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
123 "Face to use for additionally highlighting Shell commands in Font-Lock mode." |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
124 :group 'faces |
62965
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
125 :group 'makefile |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
126 :version "22.1") |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
127 |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
128 (defface makefile-makepp-perl |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
129 '((((class color) (background light)) (:background "LightBlue1")) ; Camel Book |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
130 (((class color) (background dark)) (:background "DarkBlue")) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
131 (t (:reverse-video t))) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
132 "Face to use for additionally highlighting Perl code in Font-Lock mode." |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
133 :group 'faces |
62965
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
134 :group 'makefile |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
135 :version "22.1") |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
136 |
19008 | 137 (defcustom makefile-browser-buffer-name "*Macros and Targets*" |
28503 | 138 "*Name of the macro- and target browser buffer." |
19008 | 139 :type 'string |
140 :group 'makefile) | |
141 | |
142 (defcustom makefile-target-colon ":" | |
28503 | 143 "*String to append to all target names inserted by `makefile-insert-target'. |
19008 | 144 \":\" or \"::\" are common values." |
145 :type 'string | |
146 :group 'makefile) | |
809 | 147 |
19008 | 148 (defcustom makefile-macro-assign " = " |
28503 | 149 "*String to append to all macro names inserted by `makefile-insert-macro'. |
809 | 150 The normal value should be \" = \", since this is what |
26136 | 151 standard make expects. However, newer makes such as dmake |
809 | 152 allow a larger variety of different macro assignments, so you |
19008 | 153 might prefer to use \" += \" or \" := \" ." |
154 :type 'string | |
155 :group 'makefile) | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
156 |
19008 | 157 (defcustom makefile-electric-keys nil |
28503 | 158 "*If non-nil, Makefile mode should install electric keybindings. |
19008 | 159 Default is nil." |
160 :type 'boolean | |
161 :group 'makefile) | |
162 | |
163 (defcustom makefile-use-curly-braces-for-macros-p nil | |
28503 | 164 "*Controls the style of generated macro references. |
19008 | 165 Non-nil means macro references should use curly braces, like `${this}'. |
166 nil means use parentheses, like `$(this)'." | |
167 :type 'boolean | |
168 :group 'makefile) | |
809 | 169 |
19008 | 170 (defcustom makefile-tab-after-target-colon t |
28503 | 171 "*If non-nil, insert a TAB after a target colon. |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
172 Otherwise, a space is inserted. |
19008 | 173 The default is t." |
174 :type 'boolean | |
175 :group 'makefile) | |
809 | 176 |
19008 | 177 (defcustom makefile-browser-leftmost-column 10 |
28503 | 178 "*Number of blanks to the left of the browser selection mark." |
19008 | 179 :type 'integer |
180 :group 'makefile) | |
809 | 181 |
19008 | 182 (defcustom makefile-browser-cursor-column 10 |
28503 | 183 "*Column the cursor goes to when it moves up or down in the Makefile browser." |
19008 | 184 :type 'integer |
185 :group 'makefile) | |
809 | 186 |
19008 | 187 (defcustom makefile-backslash-column 48 |
188 "*Column in which `makefile-backslash-region' inserts backslashes." | |
189 :type 'integer | |
190 :group 'makefile) | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
191 |
19008 | 192 (defcustom makefile-backslash-align t |
28503 | 193 "*If non-nil, `makefile-backslash-region' will align backslashes." |
19008 | 194 :type 'boolean |
195 :group 'makefile) | |
17240
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
196 |
19008 | 197 (defcustom makefile-browser-selected-mark "+ " |
28503 | 198 "*String used to mark selected entries in the Makefile browser." |
19008 | 199 :type 'string |
200 :group 'makefile) | |
809 | 201 |
19008 | 202 (defcustom makefile-browser-unselected-mark " " |
28503 | 203 "*String used to mark unselected entries in the Makefile browser." |
19008 | 204 :type 'string |
205 :group 'makefile) | |
809 | 206 |
19008 | 207 (defcustom makefile-browser-auto-advance-after-selection-p t |
28503 | 208 "*If non-nil, cursor will move after item is selected in Makefile browser." |
19008 | 209 :type 'boolean |
210 :group 'makefile) | |
809 | 211 |
19008 | 212 (defcustom makefile-pickup-everything-picks-up-filenames-p nil |
28503 | 213 "*If non-nil, `makefile-pickup-everything' picks up filenames as targets. |
19896
b27fcef497c1
(makefile-pickup-everything-picks-up-filenames-p): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19028
diff
changeset
|
214 This means it calls `makefile-pickup-filenames-as-targets'. |
19008 | 215 Otherwise filenames are omitted." |
216 :type 'boolean | |
217 :group 'makefile) | |
809 | 218 |
48018
1117d26eaae0
(makefile-cleanup-continuations): Default for variable is nil.
Richard M. Stallman <rms@gnu.org>
parents:
47546
diff
changeset
|
219 (defcustom makefile-cleanup-continuations nil |
28503 | 220 "*If non-nil, automatically clean up continuation lines when saving. |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
221 A line is cleaned up by removing all whitespace following a trailing |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
222 backslash. This is done silently. |
26136 | 223 IMPORTANT: Please note that enabling this option causes Makefile mode |
19008 | 224 to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \"it seems necessary\"." |
225 :type 'boolean | |
226 :group 'makefile) | |
809 | 227 |
26621 | 228 (defcustom makefile-mode-hook nil |
28503 | 229 "*Normal hook run by `makefile-mode'." |
26621 | 230 :type 'hook |
231 :group 'makefile) | |
232 | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
233 (defvar makefile-browser-hook '()) |
809 | 234 |
235 ;; | |
236 ;; Special targets for DMake, Sun's make ... | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48980
diff
changeset
|
237 ;; |
19008 | 238 (defcustom makefile-special-targets-list |
809 | 239 '(("DEFAULT") ("DONE") ("ERROR") ("EXPORT") |
240 ("FAILED") ("GROUPEPILOG") ("GROUPPROLOG") ("IGNORE") | |
241 ("IMPORT") ("INCLUDE") ("INCLUDEDIRS") ("INIT") | |
242 ("KEEP_STATE") ("MAKEFILES") ("MAKE_VERSION") ("NO_PARALLEL") | |
243 ("PARALLEL") ("PHONY") ("PRECIOUS") ("REMOVE") | |
244 ("SCCS_GET") ("SILENT") ("SOURCE") ("SUFFIXES") | |
245 ("WAIT") ("c.o") ("C.o") ("m.o") | |
246 ("el.elc") ("y.c") ("s.o")) | |
28503 | 247 "*List of special targets. |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
248 You will be offered to complete on one of those in the minibuffer whenever |
28503 | 249 you enter a \".\" at the beginning of a line in `makefile-mode'." |
19008 | 250 :type '(repeat (list string)) |
251 :group 'makefile) | |
809 | 252 |
19008 | 253 (defcustom makefile-runtime-macros-list |
14688
217222b416f7
(makefile-runtime-macros-list): Add + to the list.
Richard M. Stallman <rms@gnu.org>
parents:
14375
diff
changeset
|
254 '(("@") ("&") (">") ("<") ("*") ("^") ("+") ("?") ("%") ("$")) |
28503 | 255 "*List of macros that are resolved by make at runtime. |
26136 | 256 If you insert a macro reference using `makefile-insert-macro-ref', the name |
257 of the macro is checked against this list. If it can be found its name will | |
19008 | 258 not be enclosed in { } or ( )." |
259 :type '(repeat (list string)) | |
260 :group 'makefile) | |
809 | 261 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
262 ;; Note that the first big subexpression is used by font lock. Note |
24271 | 263 ;; that if you change this regexp you might have to fix the imenu |
264 ;; index in makefile-imenu-generic-expression. | |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
265 (defvar makefile-dependency-regex |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
266 ;; Allow for two nested levels $(v1:$(v2:$(v3:a=b)=c)=d) |
63138
2a347143dae3
(makefile-shell-face): Make this a no-op
Richard M. Stallman <rms@gnu.org>
parents:
63067
diff
changeset
|
267 "^\\(\\(?:\\$\\(?:[({]\\(?:\\$\\(?:[({]\\(?:\\$\\(?:[^({]\\|.[^\n$#})]+?[})]\\)\\|[^\n$#)}]\\)+?[})]\\|[^({]\\)\\|[^\n$#)}]\\)+?[})]\\|[^({]\\)\\|[^\n$#:=]\\)+?\\)\\(:\\)\\(?:[ \t]*$\\|[^=\n]\\(?:[^#\n]*?;[ \t]*\\(.+\\)\\)?\\)" |
809 | 268 "Regex used to find dependency lines in a makefile.") |
269 | |
62965
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
270 (defconst makefile-bsdmake-dependency-regex |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
271 (progn (string-match (regexp-quote "\\(:\\)") makefile-dependency-regex) |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
272 (replace-match "\\([:!]\\)" t t makefile-dependency-regex)) |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
273 "Regex used to find dependency lines in a BSD makefile.") |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
274 |
62444
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
275 (defvar makefile-dependency-skip "^:" |
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
276 "Characters to skip to find a line that might be a dependency.") |
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
277 |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
278 (defvar makefile-rule-action-regex |
62849
dbba3c92fc76
(makefile-rule-action-regex, makefile-macroassign-regex): Continuation lines may be empty. Reported by Joshua Varner.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62569
diff
changeset
|
279 "^\t[ \t]*\\([-@]*\\)[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)" |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
280 "Regex used to highlight rule action lines in font lock mode.") |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
281 |
62965
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
282 (defconst makefile-makepp-rule-action-regex |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
283 ;; Don't care about initial tab, but I don't know how to font-lock correctly without. |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
284 "^\t[ \t]*\\(\\(?:\\(?:noecho\\|ignore[-_]error\\|[-@]+\\)[ \t]*\\)*\\)\\(\\(&\\S +\\)?\\(?:.*\\\\\n\\)*.*\\)" |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
285 "Regex used to highlight makepp rule action lines in font lock mode.") |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
286 |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
287 (defconst makefile-bsdmake-rule-action-regex |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
288 (progn (string-match "-@" makefile-rule-action-regex) |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
289 (replace-match "-+@" t t makefile-rule-action-regex)) |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
290 "Regex used to highlight BSD rule action lines in font lock mode.") |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
291 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
292 ;; Note that the first and second subexpression is used by font lock. Note |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
293 ;; that if you change this regexp you might have to fix the imenu index in |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
294 ;; makefile-imenu-generic-expression. |
809 | 295 (defconst makefile-macroassign-regex |
63067
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
296 "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)" |
809 | 297 "Regex used to find macro assignment lines in a makefile.") |
298 | |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
299 (defconst makefile-var-use-regex |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
300 "[^$]\\$[({]\\([-a-zA-Z0-9_.]+\\|[@%<?^+*][FD]?\\)" |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
301 "Regex used to find $(macro) uses in a makefile.") |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
302 |
809 | 303 (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
|
304 "\\(^\\..*\\)\\|\\(.*~$\\)\\|\\(.*,v$\\)\\|\\(\\.[chy]\\)" |
809 | 305 "Regex for filenames that will NOT be included in the target list.") |
306 | |
14117
50df7ee940e8
(makefile-space-face): Don't work on
Karl Heuer <kwzh@gnu.org>
parents:
13995
diff
changeset
|
307 (if (fboundp 'facemenu-unlisted-faces) |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
308 (add-to-list 'facemenu-unlisted-faces 'makefile-space)) |
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
309 (defvar makefile-space 'makefile-space |
12912
e519963ce31a
(makefile-space-face): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
12373
diff
changeset
|
310 "Face to use for highlighting leading spaces in Font-Lock mode.") |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
311 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
312 ;; These lists were inspired by the old solution. But they are silly, because |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
313 ;; you can't differentiate what follows. They need to be split up. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
314 (defconst makefile-statements '("include") |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
315 "List of keywords understood by standard make.") |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
316 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
317 (defconst makefile-automake-statements |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
318 `("if" "else" "endif" ,@makefile-statements) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
319 "List of keywords understood by automake.") |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
320 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
321 (defconst makefile-gmake-statements |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
322 `("-sinclude" "sinclude" "override" "vpath" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
323 "ifdef" "ifndef" "ifeq" "ifneq" "-include" "define" "endef" "export" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
324 "unexport" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
325 ,@(cdr makefile-automake-statements)) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
326 "List of keywords understood by gmake.") |
28503 | 327 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
328 ;; These are even more silly, because you can have more spaces in between. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
329 (defconst makefile-makepp-statements |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
330 `("and ifdef" "and ifndef" "and ifeq" "and ifneq" "and ifperl" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
331 "and ifmakeperl" "and ifsys" "and ifnsys" "build_cache" "build_check" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
332 "else ifdef" "else ifndef" "else ifeq" "else ifneq" "else ifperl" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
333 "else ifmakeperl" "else ifsys" "else ifnsys" "enddef" "load_makefile" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
334 "ifperl" "ifmakeperl" "ifsys" "ifnsys" "_include" "makeperl" "makesub" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
335 "no_implicit_load" "perl" "perl-begin" "perl_begin" "perl-end" "perl_end" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
336 "prebuild" "or ifdef" "or ifndef" "or ifeq" "or ifneq" "or ifperl" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
337 "or ifmakeperl" "or ifsys" "or ifnsys" "register_command_parser" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
338 "register_scanner" "repository" "runtime" "signature" "sub" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
339 ,@(nthcdr 4 makefile-gmake-statements)) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
340 "List of keywords understood by gmake.") |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
341 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
342 (defconst makefile-bsdmake-statements |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
343 `(".elif" ".elifdef" ".elifmake" ".elifndef" ".elifnmake" ".else" ".endfor" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
344 ".endif" ".for" ".if" ".ifdef" ".ifmake" ".ifndef" ".ifnmake" ".undef") |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
345 "List of keywords understood by BSD make.") |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
346 |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
347 (defun makefile-make-font-lock-keywords (var keywords space |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
348 &optional negation |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
349 &rest font-lock-keywords) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
350 `(;; Do macro assignments. These get the "variable-name" face. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
351 (,makefile-macroassign-regex |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
352 (1 font-lock-variable-name-face) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
353 ;; This is for after != |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
354 (2 'makefile-shell prepend t) |
62446
c03004f09a28
(makefile-macroassign-regex, makefile-make-font-lock-keywords): Also fontify plain strings assigned to variables, mostly so that a colon has a face and is thus not taken as a dependency separator.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62444
diff
changeset
|
355 ;; This is for after normal assignment |
c03004f09a28
(makefile-macroassign-regex, makefile-make-font-lock-keywords): Also fontify plain strings assigned to variables, mostly so that a colon has a face and is thus not taken as a dependency separator.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62444
diff
changeset
|
356 (3 'font-lock-string-face prepend t)) |
28503 | 357 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
358 ;; Rule actions. |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
359 (makefile-match-action |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
360 (1 font-lock-type-face) |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
361 (2 'makefile-shell prepend) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
362 ;; Only makepp has builtin commands. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
363 (3 font-lock-builtin-face prepend t)) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
364 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
365 ;; Variable references even in targets/strings/comments. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
366 (,var 1 font-lock-variable-name-face prepend) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
367 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
368 ;; Automatic variable references and single character variable references, |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
369 ;; but not shell variables references. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
370 ("[^$]\\$\\([@%<?^+*_]\\|[a-zA-Z0-9]\\>\\)" |
49754
77c84ccd18b9
(makefile-font-lock-keywords): Simplify last change.
Juanma Barranquero <lekktu@gmail.com>
parents:
49739
diff
changeset
|
371 1 font-lock-constant-face prepend) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
372 ("[^$]\\(\\$[@%*]\\)" |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
373 1 'makefile-targets append) |
28503 | 374 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
375 ;; Fontify conditionals and includes. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
376 (,(concat "^\\(?: [ \t]*\\)?" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
377 (regexp-opt keywords t) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
378 "\\>[ \t]*\\([^: \t\n#]*\\)") |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
379 (1 font-lock-keyword-face) (2 font-lock-variable-name-face)) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
380 |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
381 ,@(if negation |
62491
2acb3a2dd842
(makefile-previous-dependency, makefile-match-dependency): Check for := (and in bsd mode also !=) to give a better result, even when font-lock is not on.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62446
diff
changeset
|
382 `((,negation (1 font-lock-negation-char-face prepend) |
2acb3a2dd842
(makefile-previous-dependency, makefile-match-dependency): Check for := (and in bsd mode also !=) to give a better result, even when font-lock is not on.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62446
diff
changeset
|
383 (2 font-lock-negation-char-face prepend t)))) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
384 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
385 ,@(if space |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
386 '(;; Highlight lines that contain just whitespace. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
387 ;; They can cause trouble, especially if they start with a tab. |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
388 ("^[ \t]+$" . makefile-space) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
389 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
390 ;; Highlight shell comments that Make treats as commands, |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
391 ;; since these can fool people. |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
392 ("^\t+#" 0 makefile-space t) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
393 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
394 ;; Highlight spaces that precede tabs. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
395 ;; They can make a tab fail to be effective. |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
396 ("^\\( +\\)\t" 1 makefile-space))) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
397 |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
398 ,@font-lock-keywords |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
399 |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
400 ;; Do dependencies. |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
401 (makefile-match-dependency |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
402 (1 'makefile-targets prepend) |
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
403 (3 'makefile-shell prepend t)))) |
49739
7e5f5bd11b07
(makefile-font-lock-keywords): Fontify single character variable references, but
Juanma Barranquero <lekktu@gmail.com>
parents:
49598
diff
changeset
|
404 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
405 (defconst makefile-font-lock-keywords |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
406 (makefile-make-font-lock-keywords |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
407 makefile-var-use-regex |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
408 makefile-statements |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
409 t)) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
410 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
411 (defconst makefile-automake-font-lock-keywords |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
412 (makefile-make-font-lock-keywords |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
413 makefile-var-use-regex |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
414 makefile-automake-statements |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
415 t)) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
416 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
417 (defconst makefile-gmake-font-lock-keywords |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
418 (makefile-make-font-lock-keywords |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
419 makefile-var-use-regex |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
420 makefile-gmake-statements |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
421 t |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
422 "^\\(?: [ \t]*\\)?if\\(n\\)\\(?:def\\|eq\\)\\>" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
423 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
424 '("[^$]\\(\\$[({][@%*][DF][})]\\)" |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
425 1 'makefile-targets append) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
426 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
427 ;; $(function ...) ${function ...} |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
428 '("[^$]\\$[({]\\([-a-zA-Z0-9_.]+\\s \\)" |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
429 1 font-lock-function-name-face prepend) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
430 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
431 ;; $(shell ...) ${shell ...} |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
432 '("[^$]\\$\\([({]\\)shell[ \t]+" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
433 makefile-match-function-end nil nil |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
434 (1 'makefile-shell prepend t)))) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
435 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
436 (defconst makefile-makepp-font-lock-keywords |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
437 (makefile-make-font-lock-keywords |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
438 makefile-var-use-regex |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
439 makefile-makepp-statements |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
440 nil |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
441 "^\\(?: [ \t]*\\)?\\(?:and[ \t]+\\|else[ \t]+\\|or[ \t]+\\)?if\\(n\\)\\(?:def\\|eq\\|sys\\)\\>" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
442 |
62849
dbba3c92fc76
(makefile-rule-action-regex, makefile-macroassign-regex): Continuation lines may be empty. Reported by Joshua Varner.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62569
diff
changeset
|
443 '("[^$]\\(\\$[({]\\(?:output\\|stem\\|target\\)s?\\_>.*?[})]\\)" |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
444 1 'makefile-targets append) |
28802
f7eed599c0df
(makefile-mode-abbrev-table): New variable.
Gerd Moellmann <gerd@gnu.org>
parents:
28503
diff
changeset
|
445 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
446 ;; Colon modifier keywords. |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
447 '("\\(:\\s *\\)\\(build_c\\(?:ache\\|heck\\)\\|env\\(?:ironment\\)?\\|foreach\\|signature\\|scanner\\|quickscan\\|smartscan\\)\\>\\([^:\n]*\\)" |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
448 (1 font-lock-type-face t) |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
449 (2 font-lock-keyword-face t) |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
450 (3 font-lock-variable-name-face t)) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
451 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
452 ;; $(function ...) $((function ...)) ${function ...} ${{function ...}} |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
453 '("[^$]\\$\\(?:((?\\|{{?\\)\\([-a-zA-Z0-9_.]+\\s \\)" |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
454 1 font-lock-function-name-face prepend) |
62082
2805978983d8
(makefile-font-lock-keywords): Use font-lock-negation-char-face.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
57158
diff
changeset
|
455 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
456 ;; $(shell ...) $((shell ...)) ${shell ...} ${{shell ...}} |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
457 '("[^$]\\$\\(((?\\|{{?\\)shell\\(?:[-_]\\(?:global[-_]\\)?once\\)?[ \t]+" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
458 makefile-match-function-end nil nil |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
459 (1 'makefile-shell prepend t)) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
460 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
461 ;; $(perl ...) $((perl ...)) ${perl ...} ${{perl ...}} |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
462 '("[^$]\\$\\(((?\\|{{?\\)makeperl[ \t]+" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
463 makefile-match-function-end nil nil |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
464 (1 'makefile-makepp-perl prepend t)) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
465 '("[^$]\\$\\(((?\\|{{?\\)perl[ \t]+" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
466 makefile-match-function-end nil nil |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
467 (1 'makefile-makepp-perl t t)) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
468 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
469 ;; Can we unify these with (if (match-end 1) 'prepend t)? |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
470 '("ifmakeperl\\s +\\(.*\\)" 1 'makefile-makepp-perl prepend) |
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
471 '("ifperl\\s +\\(.*\\)" 1 'makefile-makepp-perl t) |
12936 | 472 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
473 ;; Perl block single- or multiline, as statement or rule action. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
474 ;; Don't know why the initial newline in 2nd variant of group 2 doesn't get skipped. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
475 '("\\<make\\(?:perl\\|sub\\s +\\S +\\)\\s *\n?\\s *{\\(?:{\\s *\n?\\(\\(?:.*\n\\)+?\\)\\s *}\\|\\s *\\(\\(?:.*?\\|\n?\\(?:.*\n\\)+?\\)\\)\\)}" |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
476 (1 'makefile-makepp-perl prepend t) |
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
477 (2 'makefile-makepp-perl prepend t)) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
478 '("\\<\\(?:perl\\|sub\\s +\\S +\\)\\s *\n?\\s *{\\(?:{\\s *\n?\\(\\(?:.*\n\\)+?\\)\\s *}\\|\\s *\\(\\(?:.*?\\|\n?\\(?:.*\n\\)+?\\)\\)\\)}" |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
479 (1 'makefile-makepp-perl t t) |
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
480 (2 'makefile-makepp-perl t t)) |
12961
e8028ecec7ea
(makefile-font-lock-keywords): Highlight lines with
Richard M. Stallman <rms@gnu.org>
parents:
12938
diff
changeset
|
481 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
482 ;; Statement style perl block. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
483 '("perl[-_]begin\\s *\\(?:\\s #.*\\)?\n\\(\\(?:.*\n\\)+?\\)\\s *perl[-_]end\\>" |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
484 1 'makefile-makepp-perl t))) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
485 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
486 (defconst makefile-bsdmake-font-lock-keywords |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
487 (makefile-make-font-lock-keywords |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
488 ;; A lot more could be done for variables here: |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
489 makefile-var-use-regex |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
490 makefile-bsdmake-statements |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
491 t |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
492 "^\\(?: [ \t]*\\)?\\.\\(?:el\\)?if\\(n?\\)\\(?:def\\|make\\)?\\>[ \t]*\\(!?\\)" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
493 '("^[ \t]*\\.for[ \t].+[ \t]\\(in\\)\\>" 1 font-lock-keyword-face))) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
494 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
495 |
50205
63bfe3825510
(makefile-font-lock-syntactic-keywords): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
49970
diff
changeset
|
496 (defconst makefile-font-lock-syntactic-keywords |
53170
67eeb641d52a
(makefile-font-lock-syntactic-keywords): Don't use `space' for \\\n.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
497 ;; From sh-script.el. |
67eeb641d52a
(makefile-font-lock-syntactic-keywords): Don't use `space' for \\\n.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
498 ;; A `#' begins a comment in sh when it is unquoted and at the beginning |
67eeb641d52a
(makefile-font-lock-syntactic-keywords): Don't use `space' for \\\n.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
499 ;; of a word. In the shell, words are separated by metacharacters. |
67eeb641d52a
(makefile-font-lock-syntactic-keywords): Don't use `space' for \\\n.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
500 ;; The list of special chars is taken from the single-unix spec of the |
67eeb641d52a
(makefile-font-lock-syntactic-keywords): Don't use `space' for \\\n.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
501 ;; shell command language (under `quoting') but with `$' removed. |
67eeb641d52a
(makefile-font-lock-syntactic-keywords): Don't use `space' for \\\n.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
502 '(("[^|&;<>()`\\\"' \t\n]\\(#+\\)" 1 "_") |
67eeb641d52a
(makefile-font-lock-syntactic-keywords): Don't use `space' for \\\n.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
503 ;; Change the syntax of a quoted newline so that it does not end a comment. |
67eeb641d52a
(makefile-font-lock-syntactic-keywords): Don't use `space' for \\\n.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
52401
diff
changeset
|
504 ("\\\\\n" 0 "."))) |
50205
63bfe3825510
(makefile-font-lock-syntactic-keywords): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
49970
diff
changeset
|
505 |
24248
fd94cf07b4cc
(makefile-imenu-generic-expression): New var.
Richard M. Stallman <rms@gnu.org>
parents:
22837
diff
changeset
|
506 (defvar makefile-imenu-generic-expression |
62569
f09fbe52c543
(makefile-imenu-generic-expression): Use function to find dependencies, because regexp alone is so complex, it easily goes into an endless loop.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62525
diff
changeset
|
507 `(("Dependencies" makefile-previous-dependency 1) |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
508 ("Macro Assignment" ,makefile-macroassign-regex 1)) |
26136 | 509 "Imenu generic expression for Makefile mode. See `imenu-generic-expression'.") |
24248
fd94cf07b4cc
(makefile-imenu-generic-expression): New var.
Richard M. Stallman <rms@gnu.org>
parents:
22837
diff
changeset
|
510 |
809 | 511 ;;; ------------------------------------------------------------ |
512 ;;; The following configurable variables are used in the | |
513 ;;; up-to-date overview . | |
3591
507f64624555
Apply typo patches from Paul Eggert.
Jim Blandy <jimb@redhat.com>
parents:
2671
diff
changeset
|
514 ;;; The standard configuration assumes that your `make' program |
809 | 515 ;;; can be run in question/query mode using the `-q' option, this |
516 ;;; means that the command | |
517 ;;; | |
518 ;;; make -q foo | |
519 ;;; | |
520 ;;; should return an exit status of zero if the target `foo' is | |
521 ;;; up to date and a nonzero exit status otherwise. | |
522 ;;; 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
|
523 ;;; 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
|
524 ;;; Dennis Vadura's DMake have no problems. |
809 | 525 ;;; Set the variable `makefile-brave-make' to the name of the |
526 ;;; 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
|
527 ;;; To understand what this is all about see the function definition |
809 | 528 ;;; of `makefile-query-by-make-minus-q' . |
529 ;;; ------------------------------------------------------------ | |
530 | |
19008 | 531 (defcustom makefile-brave-make "make" |
28503 | 532 "*How to invoke make, for `makefile-query-targets'. |
19008 | 533 This should identify a `make' command that can handle the `-q' option." |
534 :type 'string | |
535 :group 'makefile) | |
809 | 536 |
19008 | 537 (defcustom makefile-query-one-target-method 'makefile-query-by-make-minus-q |
28503 | 538 "*Function to call to determine whether a make target is up to date. |
12936 | 539 The function must satisfy this calling convention: |
809 | 540 |
541 * As its first argument, it must accept the name of the target to | |
542 be checked, as a string. | |
543 | |
544 * As its second argument, it may accept the name of a makefile | |
26136 | 545 as a string. Depending on what you're going to do you may |
809 | 546 not need this. |
547 | |
548 * It must return the integer value 0 (zero) if the given target | |
549 should be considered up-to-date in the context of the given | |
19008 | 550 makefile, any nonzero integer value otherwise." |
551 :type 'function | |
552 :group 'makefile) | |
809 | 553 |
19008 | 554 (defcustom makefile-up-to-date-buffer-name "*Makefile Up-to-date overview*" |
28503 | 555 "*Name of the Up-to-date overview buffer." |
19008 | 556 :type 'string |
557 :group 'makefile) | |
809 | 558 |
559 ;;; --- end of up-to-date-overview configuration ------------------ | |
560 | |
28503 | 561 (defvar makefile-mode-abbrev-table nil |
562 "Abbrev table in use in Makefile buffers.") | |
563 (if makefile-mode-abbrev-table | |
564 () | |
565 (define-abbrev-table 'makefile-mode-abbrev-table ())) | |
566 | |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
567 (defvar makefile-mode-map |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
568 (let ((map (make-sparse-keymap))) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
569 ;; set up the keymap |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
570 (define-key map "\C-c:" 'makefile-insert-target-ref) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
571 (if makefile-electric-keys |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
572 (progn |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
573 (define-key map "$" 'makefile-insert-macro-ref) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
574 (define-key map ":" 'makefile-electric-colon) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
575 (define-key map "=" 'makefile-electric-equal) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
576 (define-key map "." 'makefile-electric-dot))) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
577 (define-key map "\C-c\C-f" 'makefile-pickup-filenames-as-targets) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
578 (define-key map "\C-c\C-b" 'makefile-switch-to-browser) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
579 (define-key map "\C-c\C-c" 'comment-region) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
580 (define-key map "\C-c\C-p" 'makefile-pickup-everything) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
581 (define-key map "\C-c\C-u" 'makefile-create-up-to-date-overview) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
582 (define-key map "\C-c\C-i" 'makefile-insert-gmake-function) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
583 (define-key map "\C-c\C-\\" 'makefile-backslash-region) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
584 (define-key map "\C-c\C-m\C-a" 'makefile-automake-mode) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
585 (define-key map "\C-c\C-m\C-b" 'makefile-bsdmake-mode) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
586 (define-key map "\C-c\C-m\C-g" 'makefile-gmake-mode) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
587 (define-key map "\C-c\C-m\C-m" 'makefile-mode) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
588 (define-key map "\C-c\C-m\C-p" 'makefile-makepp-mode) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
589 (define-key map "\M-p" 'makefile-previous-dependency) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
590 (define-key map "\M-n" 'makefile-next-dependency) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
591 (define-key map "\e\t" 'makefile-complete) |
12936 | 592 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
593 ;; Make menus. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
594 (define-key map [menu-bar makefile-mode] |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
595 (cons "Makefile" (make-sparse-keymap "Makefile"))) |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
596 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
597 (define-key map [menu-bar makefile-mode browse] |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
598 '("Pop up Makefile Browser" . makefile-switch-to-browser)) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
599 (define-key map [menu-bar makefile-mode complete] |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
600 '("Complete Target or Macro" . makefile-complete)) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
601 (define-key map [menu-bar makefile-mode pickup] |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
602 '("Find Targets and Macros" . makefile-pickup-everything)) |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
603 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
604 (define-key map [menu-bar makefile-mode prev] |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
605 '("Move to Previous Dependency" . makefile-previous-dependency)) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
606 (define-key map [menu-bar makefile-mode next] |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
607 '("Move to Next Dependency" . makefile-next-dependency)) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
608 map) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
609 "The keymap that is used in Makefile mode.") |
809 | 610 |
611 (defvar makefile-browser-map nil | |
612 "The keymap that is used in the macro- and target browser.") | |
613 (if makefile-browser-map | |
614 () | |
615 (setq makefile-browser-map (make-sparse-keymap)) | |
616 (define-key makefile-browser-map "n" 'makefile-browser-next-line) | |
26136 | 617 (define-key makefile-browser-map "\C-n" 'makefile-browser-next-line) |
809 | 618 (define-key makefile-browser-map "p" 'makefile-browser-previous-line) |
619 (define-key makefile-browser-map "\C-p" 'makefile-browser-previous-line) | |
620 (define-key makefile-browser-map " " 'makefile-browser-toggle) | |
621 (define-key makefile-browser-map "i" 'makefile-browser-insert-selection) | |
26136 | 622 (define-key makefile-browser-map "I" 'makefile-browser-insert-selection-and-quit) |
809 | 623 (define-key makefile-browser-map "\C-c\C-m" 'makefile-browser-insert-continuation) |
624 (define-key makefile-browser-map "q" 'makefile-browser-quit) | |
625 ;; disable horizontal movement | |
626 (define-key makefile-browser-map "\C-b" 'undefined) | |
26136 | 627 (define-key makefile-browser-map "\C-f" 'undefined)) |
809 | 628 |
629 | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
630 (defvar makefile-mode-syntax-table nil) |
809 | 631 (if makefile-mode-syntax-table |
632 () | |
633 (setq makefile-mode-syntax-table (make-syntax-table)) | |
634 (modify-syntax-entry ?\( "() " makefile-mode-syntax-table) | |
635 (modify-syntax-entry ?\) ")( " makefile-mode-syntax-table) | |
636 (modify-syntax-entry ?\[ "(] " makefile-mode-syntax-table) | |
12938
123200a483ae
(makefile-mode-syntax-table): "]" is a close-paren.
Richard M. Stallman <rms@gnu.org>
parents:
12937
diff
changeset
|
637 (modify-syntax-entry ?\] ")[ " makefile-mode-syntax-table) |
26136 | 638 (modify-syntax-entry ?\{ "(} " makefile-mode-syntax-table) |
809 | 639 (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
|
640 (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
|
641 (modify-syntax-entry ?\` "\" " makefile-mode-syntax-table) |
809 | 642 (modify-syntax-entry ?# "< " makefile-mode-syntax-table) |
643 (modify-syntax-entry ?\n "> " makefile-mode-syntax-table)) | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
644 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
645 |
809 | 646 ;;; ------------------------------------------------------------ |
647 ;;; Internal variables. | |
648 ;;; You don't need to configure below this line. | |
649 ;;; ------------------------------------------------------------ | |
650 | |
651 (defvar makefile-target-table nil | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
652 "Table of all target names known for this buffer.") |
809 | 653 |
654 (defvar makefile-macro-table nil | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
655 "Table of all macro names known for this buffer.") |
809 | 656 |
657 (defvar makefile-browser-client | |
12936 | 658 "A buffer in Makefile mode that is currently using the browser.") |
809 | 659 |
660 (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
|
661 (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
|
662 (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
|
663 (defvar makefile-need-macro-pickup t) |
809 | 664 |
665 (defvar makefile-mode-hook '()) | |
666 | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
667 ;; Each element looks like '("GNU MAKE FUNCTION" "ARG" "ARG" ... ) |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
668 ;; Each "ARG" is used as a prompt for a required argument. |
809 | 669 (defconst makefile-gnumake-functions-alist |
670 '( | |
671 ;; Text functions | |
672 ("subst" "From" "To" "In") | |
673 ("patsubst" "Pattern" "Replacement" "In") | |
674 ("strip" "Text") | |
675 ("findstring" "Find what" "In") | |
676 ("filter" "Pattern" "Text") | |
677 ("filter-out" "Pattern" "Text") | |
678 ("sort" "List") | |
679 ;; Filename functions | |
680 ("dir" "Names") | |
681 ("notdir" "Names") | |
682 ("suffix" "Names") | |
683 ("basename" "Names") | |
15523
682a3d405c49
(makefile-gnumake-functions-alist): Add `addprefix'.
Richard M. Stallman <rms@gnu.org>
parents:
14688
diff
changeset
|
684 ("addprefix" "Prefix" "Names") |
809 | 685 ("addsuffix" "Suffix" "Names") |
686 ("join" "List 1" "List 2") | |
687 ("word" "Index" "Text") | |
688 ("words" "Text") | |
689 ("firstword" "Text") | |
690 ("wildcard" "Pattern") | |
691 ;; Misc functions | |
692 ("foreach" "Variable" "List" "Text") | |
693 ("origin" "Variable") | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
694 ("shell" "Command"))) |
809 | 695 |
696 | |
697 ;;; ------------------------------------------------------------ | |
698 ;;; The mode function itself. | |
699 ;;; ------------------------------------------------------------ | |
700 | |
2534
0099d6be2b11
(makefile-mode): Fix typo in autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents:
2400
diff
changeset
|
701 ;;;###autoload |
809 | 702 (defun makefile-mode () |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
703 "Major mode for editing standard Makefiles. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
704 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
705 If you are editing a file for a different make, try one of the |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
706 variants `makefile-automake-mode', `makefile-gmake-mode', |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
707 `makefile-makepp-mode' or `makefile-bsdmake-mode'. All but the |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
708 last should be correctly chosen based on the file name, except if |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
709 it is *.mk. This function ends by invoking the function(s) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
710 `makefile-mode-hook'. |
809 | 711 |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
712 It is strongly recommended to use `font-lock-mode', because that |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
713 provides additional parsing information. This is used for |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
714 example to see that a rule action `echo foo: bar' is a not rule |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
715 dependency, despite the colon. |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
716 |
809 | 717 \\{makefile-mode-map} |
718 | |
719 In the browser, use the following keys: | |
720 | |
721 \\{makefile-browser-map} | |
722 | |
12936 | 723 Makefile mode can be configured by modifying the following variables: |
809 | 724 |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
725 `makefile-browser-buffer-name': |
809 | 726 Name of the macro- and target browser buffer. |
727 | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
728 `makefile-target-colon': |
809 | 729 The string that gets appended to all target names |
12936 | 730 inserted by `makefile-insert-target'. |
809 | 731 \":\" or \"::\" are quite common values. |
732 | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
733 `makefile-macro-assign': |
809 | 734 The string that gets appended to all macro names |
12936 | 735 inserted by `makefile-insert-macro'. |
809 | 736 The normal value should be \" = \", since this is what |
26136 | 737 standard make expects. However, newer makes such as dmake |
809 | 738 allow a larger variety of different macro assignments, so you |
739 might prefer to use \" += \" or \" := \" . | |
740 | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
741 `makefile-tab-after-target-colon': |
809 | 742 If you want a TAB (instead of a space) to be appended after the |
743 target colon, then set this to a non-nil value. | |
744 | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
745 `makefile-browser-leftmost-column': |
809 | 746 Number of blanks to the left of the browser selection mark. |
747 | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
748 `makefile-browser-cursor-column': |
809 | 749 Column in which the cursor is positioned when it moves |
750 up or down in the browser. | |
751 | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
752 `makefile-browser-selected-mark': |
809 | 753 String used to mark selected entries in the browser. |
754 | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
755 `makefile-browser-unselected-mark': |
809 | 756 String used to mark unselected entries in the browser. |
757 | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
758 `makefile-browser-auto-advance-after-selection-p': |
809 | 759 If this variable is set to a non-nil value the cursor |
760 will automagically advance to the next line after an item | |
761 has been selected in the browser. | |
762 | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
763 `makefile-pickup-everything-picks-up-filenames-p': |
809 | 764 If this variable is set to a non-nil value then |
12936 | 765 `makefile-pickup-everything' also picks up filenames as targets |
19896
b27fcef497c1
(makefile-pickup-everything-picks-up-filenames-p): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
19028
diff
changeset
|
766 (i.e. it calls `makefile-pickup-filenames-as-targets'), otherwise |
809 | 767 filenames are omitted. |
768 | |
47546
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
769 `makefile-cleanup-continuations': |
26136 | 770 If this variable is set to a non-nil value then Makefile mode |
809 | 771 will assure that no line in the file ends with a backslash |
772 (the continuation character) followed by any whitespace. | |
773 This is done by silently removing the trailing whitespace, leaving | |
774 the backslash itself intact. | |
26136 | 775 IMPORTANT: Please note that enabling this option causes Makefile mode |
12936 | 776 to MODIFY A FILE WITHOUT YOUR CONFIRMATION when \"it seems necessary\". |
809 | 777 |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
778 `makefile-browser-hook': |
809 | 779 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
|
780 browser is entered. This is executed in the makefile buffer. |
809 | 781 |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
782 `makefile-special-targets-list': |
809 | 783 List of special targets. You will be offered to complete |
12936 | 784 on one of those in the minibuffer whenever you enter a `.'. |
785 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
|
786 |
809 | 787 (interactive) |
788 (kill-all-local-variables) | |
47546
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
789 (add-hook 'write-file-functions |
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
790 'makefile-warn-suspicious-lines nil t) |
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
791 (add-hook 'write-file-functions |
48018
1117d26eaae0
(makefile-cleanup-continuations): Default for variable is nil.
Richard M. Stallman <rms@gnu.org>
parents:
47546
diff
changeset
|
792 'makefile-warn-continuations nil t) |
1117d26eaae0
(makefile-cleanup-continuations): Default for variable is nil.
Richard M. Stallman <rms@gnu.org>
parents:
47546
diff
changeset
|
793 (add-hook 'write-file-functions |
47546
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
794 'makefile-cleanup-continuations nil t) |
6146
1a2a8ef9b4af
(makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents:
5820
diff
changeset
|
795 (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
|
796 (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
|
797 (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
|
798 (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
|
799 (make-local-variable 'makefile-need-macro-pickup) |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
800 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
801 ;; Font lock. |
9477
7a8a379513e4
* makefile.el: (makefile-mode-syntax-table): Made `'' and ``' be
Simon Marshall <simon@gnu.org>
parents:
9454
diff
changeset
|
802 (make-local-variable 'font-lock-defaults) |
35932
2b3447fcf42b
(makefile-mode): Set SYNTAX-BEGIN member
Eli Zaretskii <eliz@gnu.org>
parents:
30468
diff
changeset
|
803 (setq font-lock-defaults |
2b3447fcf42b
(makefile-mode): Set SYNTAX-BEGIN member
Eli Zaretskii <eliz@gnu.org>
parents:
30468
diff
changeset
|
804 ;; SYNTAX-BEGIN set to backward-paragraph to avoid slow-down |
2b3447fcf42b
(makefile-mode): Set SYNTAX-BEGIN member
Eli Zaretskii <eliz@gnu.org>
parents:
30468
diff
changeset
|
805 ;; near the end of a large buffer, due to parse-partial-sexp's |
2b3447fcf42b
(makefile-mode): Set SYNTAX-BEGIN member
Eli Zaretskii <eliz@gnu.org>
parents:
30468
diff
changeset
|
806 ;; trying to parse all the way till the beginning of buffer. |
50205
63bfe3825510
(makefile-font-lock-syntactic-keywords): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
49970
diff
changeset
|
807 '(makefile-font-lock-keywords |
63bfe3825510
(makefile-font-lock-syntactic-keywords): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
49970
diff
changeset
|
808 nil nil |
63bfe3825510
(makefile-font-lock-syntactic-keywords): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
49970
diff
changeset
|
809 ((?$ . ".")) |
63bfe3825510
(makefile-font-lock-syntactic-keywords): New variable.
Juanma Barranquero <lekktu@gmail.com>
parents:
49970
diff
changeset
|
810 backward-paragraph |
62446
c03004f09a28
(makefile-macroassign-regex, makefile-make-font-lock-keywords): Also fontify plain strings assigned to variables, mostly so that a colon has a face and is thus not taken as a dependency separator.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62444
diff
changeset
|
811 (font-lock-syntactic-keywords . makefile-font-lock-syntactic-keywords) |
c03004f09a28
(makefile-macroassign-regex, makefile-make-font-lock-keywords): Also fontify plain strings assigned to variables, mostly so that a colon has a face and is thus not taken as a dependency separator.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62444
diff
changeset
|
812 (font-lock-support-mode))) ; JIT breaks on long series of continuation lines. |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
813 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
814 ;; Add-log. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
815 (make-local-variable 'add-log-current-defun-function) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
816 (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
|
817 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
818 ;; Imenu. |
24248
fd94cf07b4cc
(makefile-imenu-generic-expression): New var.
Richard M. Stallman <rms@gnu.org>
parents:
22837
diff
changeset
|
819 (make-local-variable 'imenu-generic-expression) |
fd94cf07b4cc
(makefile-imenu-generic-expression): New var.
Richard M. Stallman <rms@gnu.org>
parents:
22837
diff
changeset
|
820 (setq imenu-generic-expression makefile-imenu-generic-expression) |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
821 |
11638
2b1d5f2e99cc
(makefile-mode): Set dabbrev-abbrev-skip-leading-regexp.
Richard M. Stallman <rms@gnu.org>
parents:
9758
diff
changeset
|
822 ;; Dabbrev. |
2b1d5f2e99cc
(makefile-mode): Set dabbrev-abbrev-skip-leading-regexp.
Richard M. Stallman <rms@gnu.org>
parents:
9758
diff
changeset
|
823 (make-local-variable 'dabbrev-abbrev-skip-leading-regexp) |
2b1d5f2e99cc
(makefile-mode): Set dabbrev-abbrev-skip-leading-regexp.
Richard M. Stallman <rms@gnu.org>
parents:
9758
diff
changeset
|
824 (setq dabbrev-abbrev-skip-leading-regexp "\\$") |
2b1d5f2e99cc
(makefile-mode): Set dabbrev-abbrev-skip-leading-regexp.
Richard M. Stallman <rms@gnu.org>
parents:
9758
diff
changeset
|
825 |
28503 | 826 ;; Other abbrevs. |
827 (setq local-abbrev-table makefile-mode-abbrev-table) | |
828 | |
17240
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
829 ;; Filling. |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
830 (make-local-variable 'fill-paragraph-function) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
831 (setq fill-paragraph-function 'makefile-fill-paragraph) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
832 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
833 ;; Comment stuff. |
5464
4823e14b1314
(makefile-mode): Make comment-start, comment-end,
Richard M. Stallman <rms@gnu.org>
parents:
5312
diff
changeset
|
834 (make-local-variable 'comment-start) |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
835 (setq comment-start "#") |
5464
4823e14b1314
(makefile-mode): Make comment-start, comment-end,
Richard M. Stallman <rms@gnu.org>
parents:
5312
diff
changeset
|
836 (make-local-variable 'comment-end) |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
837 (setq comment-end "") |
5464
4823e14b1314
(makefile-mode): Make comment-start, comment-end,
Richard M. Stallman <rms@gnu.org>
parents:
5312
diff
changeset
|
838 (make-local-variable 'comment-start-skip) |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
839 (setq comment-start-skip "#+[ \t]*") |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
840 |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
841 ;; Make sure TAB really inserts \t. |
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
842 (set (make-local-variable 'indent-line-function) 'indent-to-left-margin) |
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
843 |
809 | 844 ;; become the current major mode |
845 (setq major-mode 'makefile-mode) | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
846 (setq mode-name "Makefile") |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
847 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
848 ;; Activate keymap and syntax table. |
809 | 849 (use-local-map makefile-mode-map) |
850 (set-syntax-table makefile-mode-syntax-table) | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
851 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
852 ;; Real TABs are important in makefiles |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
853 (setq indent-tabs-mode t) |
62525
10a127a02c08
(makefile-mode): Use run-mode-hooks.
Richard M. Stallman <rms@gnu.org>
parents:
62503
diff
changeset
|
854 (run-mode-hooks 'makefile-mode-hook)) |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
855 |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
856 ;; These should do more than just differentiate font-lock. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
857 ;;;###autoload |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
858 (define-derived-mode makefile-automake-mode makefile-mode "Makefile.am" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
859 "An adapted `makefile-mode' that knows about automake." |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
860 (setq font-lock-defaults |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
861 `(makefile-automake-font-lock-keywords ,@(cdr font-lock-defaults)))) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
862 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
863 ;;;###autoload |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
864 (define-derived-mode makefile-gmake-mode makefile-mode "GNUmakefile" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
865 "An adapted `makefile-mode' that knows about gmake." |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
866 (setq font-lock-defaults |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
867 `(makefile-gmake-font-lock-keywords ,@(cdr font-lock-defaults)))) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
868 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
869 ;;;###autoload |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
870 (define-derived-mode makefile-makepp-mode makefile-mode "Makeppfile" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
871 "An adapted `makefile-mode' that knows about makepp." |
62965
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
872 (set (make-local-variable 'makefile-rule-action-regex) |
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
873 makefile-makepp-rule-action-regex) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
874 (setq font-lock-defaults |
62569
f09fbe52c543
(makefile-imenu-generic-expression): Use function to find dependencies, because regexp alone is so complex, it easily goes into an endless loop.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62525
diff
changeset
|
875 `(makefile-makepp-font-lock-keywords ,@(cdr font-lock-defaults)) |
f09fbe52c543
(makefile-imenu-generic-expression): Use function to find dependencies, because regexp alone is so complex, it easily goes into an endless loop.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62525
diff
changeset
|
876 imenu-generic-expression |
f09fbe52c543
(makefile-imenu-generic-expression): Use function to find dependencies, because regexp alone is so complex, it easily goes into an endless loop.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62525
diff
changeset
|
877 `(("Functions" "^[ \t]*\\(?:make\\)?sub[ \t]+\\([A-Za-z0-9_]+\\)" 1) |
f09fbe52c543
(makefile-imenu-generic-expression): Use function to find dependencies, because regexp alone is so complex, it easily goes into an endless loop.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62525
diff
changeset
|
878 ,@imenu-generic-expression))) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
879 |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
880 ;;;###autoload |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
881 (define-derived-mode makefile-bsdmake-mode makefile-mode "BSDmakefile" |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
882 "An adapted `makefile-mode' that knows about BSD make." |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
883 (set (make-local-variable 'makefile-dependency-regex) |
62965
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
884 makefile-bsdmake-dependency-regex) |
62444
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
885 (set (make-local-variable 'makefile-dependency-skip) "^:!") |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
886 (set (make-local-variable 'makefile-rule-action-regex) |
62965
a078bb7e3d21
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): Add :version.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62851
diff
changeset
|
887 makefile-bsdmake-rule-action-regex) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
888 (setq font-lock-defaults |
62569
f09fbe52c543
(makefile-imenu-generic-expression): Use function to find dependencies, because regexp alone is so complex, it easily goes into an endless loop.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62525
diff
changeset
|
889 `(makefile-bsdmake-font-lock-keywords ,@(cdr font-lock-defaults)))) |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
890 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
891 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
892 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
893 ;;; Motion code. |
809 | 894 |
895 (defun makefile-next-dependency () | |
12936 | 896 "Move point to the beginning of the next dependency line." |
809 | 897 (interactive) |
898 (let ((here (point))) | |
899 (end-of-line) | |
62444
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
900 (if (makefile-match-dependency nil) |
809 | 901 (progn (beginning-of-line) t) ; indicate success |
902 (goto-char here) nil))) | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
903 |
809 | 904 (defun makefile-previous-dependency () |
12936 | 905 "Move point to the beginning of the previous dependency line." |
809 | 906 (interactive) |
62444
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
907 (let ((pt (point))) |
809 | 908 (beginning-of-line) |
62444
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
909 ;; makefile-match-dependency done backwards: |
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
910 (catch 'found |
62503
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
911 (while (progn (skip-chars-backward makefile-dependency-skip) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
912 (not (bobp))) |
62491
2acb3a2dd842
(makefile-previous-dependency, makefile-match-dependency): Check for := (and in bsd mode also !=) to give a better result, even when font-lock is not on.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62446
diff
changeset
|
913 (or (prog1 (eq (char-after) ?=) |
2acb3a2dd842
(makefile-previous-dependency, makefile-match-dependency): Check for := (and in bsd mode also !=) to give a better result, even when font-lock is not on.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62446
diff
changeset
|
914 (backward-char)) |
2acb3a2dd842
(makefile-previous-dependency, makefile-match-dependency): Check for := (and in bsd mode also !=) to give a better result, even when font-lock is not on.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62446
diff
changeset
|
915 (get-text-property (point) 'face) |
62444
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
916 (beginning-of-line) |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
917 (if (> (point) (+ (point-min) 2)) |
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
918 (eq (char-before (1- (point))) ?\\)) |
62444
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
919 (if (looking-at makefile-dependency-regex) |
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
920 (throw 'found t)))) |
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
921 (goto-char pt) |
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
922 nil))) |
809 | 923 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
924 |
809 | 925 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
926 ;;; 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
|
927 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
928 (defun makefile-electric-dot (arg) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
929 "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
|
930 Only does electric insertion at beginning of line. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
931 Anywhere else just self-inserts." |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
932 (interactive "p") |
809 | 933 (if (bolp) |
934 (makefile-insert-special-target) | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
935 (self-insert-command arg))) |
809 | 936 |
937 (defun makefile-insert-special-target () | |
13995
33b51573611f
(makefile-insert-special-target,
Karl Heuer <kwzh@gnu.org>
parents:
13847
diff
changeset
|
938 "Prompt for and insert a special target name. |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
939 Uses `makefile-special-targets' list." |
809 | 940 (interactive) |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
941 (makefile-pickup-targets) |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
942 (let ((special-target |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
943 (completing-read "Special target: " |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
944 makefile-special-targets-list nil nil nil))) |
809 | 945 (if (zerop (length special-target)) |
946 () | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
947 (insert "." special-target ":") |
809 | 948 (makefile-forward-after-target-colon)))) |
949 | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
950 (defun makefile-electric-equal (arg) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
951 "Prompt for name of a macro to insert. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
952 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
|
953 Anywhere else just self-inserts." |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
954 (interactive "p") |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
955 (makefile-pickup-macros) |
809 | 956 (if (bolp) |
957 (call-interactively 'makefile-insert-macro) | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
958 (self-insert-command arg))) |
809 | 959 |
960 (defun makefile-insert-macro (macro-name) | |
961 "Prepare definition of a new macro." | |
962 (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
|
963 (makefile-pickup-macros) |
809 | 964 (if (not (zerop (length macro-name))) |
965 (progn | |
966 (beginning-of-line) | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
967 (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
|
968 (setq makefile-need-macro-pickup t) |
809 | 969 (makefile-remember-macro macro-name)))) |
970 | |
971 (defun makefile-insert-macro-ref (macro-name) | |
12936 | 972 "Complete on a list of known macros, then insert complete ref at point." |
809 | 973 (interactive |
974 (list | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
975 (progn |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
976 (makefile-pickup-macros) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
977 (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
|
978 (makefile-do-macro-insertion macro-name)) |
809 | 979 |
980 (defun makefile-insert-target (target-name) | |
981 "Prepare definition of a new target (dependency line)." | |
982 (interactive "sTarget: ") | |
983 (if (not (zerop (length target-name))) | |
984 (progn | |
985 (beginning-of-line) | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
986 (insert target-name makefile-target-colon) |
809 | 987 (makefile-forward-after-target-colon) |
988 (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
|
989 (setq makefile-need-target-pickup t) |
809 | 990 (makefile-remember-target target-name)))) |
991 | |
992 (defun makefile-insert-target-ref (target-name) | |
26136 | 993 "Complete on a list of known targets, then insert TARGET-NAME at point." |
809 | 994 (interactive |
995 (list | |
5312
aad805608eec
(makefile-ignored-files-in-pickup-regex): Supply missing \\.
Richard M. Stallman <rms@gnu.org>
parents:
3591
diff
changeset
|
996 (progn |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
997 (makefile-pickup-targets) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
998 (completing-read "Refer to target: " makefile-target-table nil nil nil)))) |
809 | 999 (if (not (zerop (length target-name))) |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1000 (insert target-name " "))) |
809 | 1001 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1002 (defun makefile-electric-colon (arg) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1003 "Prompt for name of new target. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1004 Prompting only happens at beginning of line. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1005 Anywhere else just self-inserts." |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1006 (interactive "p") |
809 | 1007 (if (bolp) |
1008 (call-interactively 'makefile-insert-target) | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1009 (self-insert-command arg))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1010 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1011 |
809 | 1012 |
1013 ;;; ------------------------------------------------------------ | |
1014 ;;; Extracting targets and macros from an existing makefile | |
1015 ;;; ------------------------------------------------------------ | |
1016 | |
1017 (defun makefile-pickup-targets () | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1018 "Notice names of all target definitions in Makefile." |
809 | 1019 (interactive) |
62503
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1020 (when makefile-need-target-pickup |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1021 (setq makefile-need-target-pickup nil |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1022 makefile-target-table nil |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1023 makefile-has-prereqs nil) |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1024 (save-excursion |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1025 (goto-char (point-min)) |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
1026 (while (makefile-match-dependency nil) |
62503
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1027 (goto-char (match-beginning 1)) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1028 (while (let ((target-name |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1029 (buffer-substring-no-properties (point) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1030 (progn |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1031 (skip-chars-forward "^ \t:#") |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1032 (point)))) |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1033 (has-prereqs |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1034 (not (looking-at ":[ \t]*$")))) |
62503
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1035 (if (makefile-remember-target target-name has-prereqs) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1036 (message "Picked up target \"%s\" from line %d" |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1037 target-name (line-number-at-pos))) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1038 (skip-chars-forward " \t") |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1039 (not (or (eolp) (eq (char-after) ?:))))) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1040 (forward-line))) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1041 (message "Read targets OK."))) |
809 | 1042 |
1043 (defun makefile-pickup-macros () | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1044 "Notice names of all macro definitions in Makefile." |
809 | 1045 (interactive) |
62503
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1046 (when makefile-need-macro-pickup |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1047 (setq makefile-need-macro-pickup nil |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1048 makefile-macro-table nil) |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1049 (save-excursion |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1050 (goto-char (point-min)) |
47546
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1051 (while (re-search-forward makefile-macroassign-regex nil t) |
62503
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1052 (goto-char (match-beginning 1)) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1053 (let ((macro-name (buffer-substring-no-properties (point) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1054 (progn |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1055 (skip-chars-forward "^ \t:#=*") |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1056 (point))))) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1057 (if (makefile-remember-macro macro-name) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1058 (message "Picked up macro \"%s\" from line %d" |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1059 macro-name (line-number-at-pos)))) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1060 (forward-line))) |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1061 (message "Read macros OK."))) |
809 | 1062 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1063 (defun makefile-pickup-everything (arg) |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1064 "Notice names of all macros and targets in Makefile. |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1065 Prefix arg means force pickups to be redone." |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1066 (interactive "P") |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1067 (if arg |
62503
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1068 (setq makefile-need-target-pickup t |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1069 makefile-need-macro-pickup t)) |
809 | 1070 (makefile-pickup-macros) |
1071 (makefile-pickup-targets) | |
1072 (if makefile-pickup-everything-picks-up-filenames-p | |
1073 (makefile-pickup-filenames-as-targets))) | |
1074 | |
1075 (defun makefile-pickup-filenames-as-targets () | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1076 "Scan the current directory for filenames to use as targets. |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1077 Checks each filename against `makefile-ignored-files-in-pickup-regex' |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1078 and adds all qualifying names to the list of known targets." |
809 | 1079 (interactive) |
62503
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1080 (mapc (lambda (name) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1081 (or (file-directory-p name) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1082 (string-match makefile-ignored-files-in-pickup-regex name) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1083 (if (makefile-remember-target name) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1084 (message "Picked up file \"%s\" as target" name)))) |
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1085 (file-name-all-completions "" (or (file-name-directory (buffer-file-name)) "")))) |
809 | 1086 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1087 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1088 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1089 ;;; Completion. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1090 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1091 (defun makefile-complete () |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1092 "Perform completion on Makefile construct preceding point. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1093 Can complete variable and target names. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1094 The context determines which are considered." |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1095 (interactive) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1096 (let* ((beg (save-excursion |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1097 (skip-chars-backward "^$(){}:#= \t\n") |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1098 (point))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1099 (try (buffer-substring beg (point))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1100 (do-macros nil) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1101 (paren nil)) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1102 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1103 (save-excursion |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1104 (goto-char beg) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1105 (let ((pc (preceding-char))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1106 (cond |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1107 ;; Beginning of line means anything. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1108 ((bolp) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1109 ()) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1110 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1111 ;; Preceding "$" means macros only. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1112 ((= pc ?$) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1113 (setq do-macros t)) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1114 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1115 ;; Preceding "$(" or "${" means macros only. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1116 ((and (or (= pc ?{) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1117 (= pc ?\()) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1118 (progn |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1119 (setq paren pc) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1120 (backward-char) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1121 (and (not (bolp)) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1122 (= (preceding-char) ?$)))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1123 (setq do-macros t))))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1124 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1125 ;; Try completion. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1126 (let* ((table (append (if do-macros |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1127 '() |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1128 makefile-target-table) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1129 makefile-macro-table)) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1130 (completion (try-completion try table))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1131 (cond |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1132 ;; Exact match, so insert closing paren or colon. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1133 ((eq completion t) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1134 (insert (if do-macros |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1135 (if (eq paren ?{) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1136 ?} |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1137 ?\)) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1138 (if (save-excursion |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1139 (goto-char beg) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1140 (bolp)) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1141 ":" |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1142 " ")))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1143 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1144 ;; No match. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1145 ((null completion) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1146 (message "Can't find completion for \"%s\"" try) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1147 (ding)) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1148 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1149 ;; Partial completion. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1150 ((not (string= try completion)) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1151 ;; 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
|
1152 ;; exact, unambiguous match were found. That is not possible |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1153 ;; right now. Ditto closing ":" for targets. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1154 (delete-region beg (point)) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1155 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1156 ;; 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
|
1157 ;; 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
|
1158 ;; must be done for macros. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1159 (if (or do-macros |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1160 (assoc completion makefile-macro-table)) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1161 (let ((makefile-use-curly-braces-for-macros-p |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1162 (or (eq paren ?{) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1163 makefile-use-curly-braces-for-macros-p))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1164 (delete-backward-char 2) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1165 (makefile-do-macro-insertion completion) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1166 (delete-backward-char 1)) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1167 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1168 ;; Just insert targets. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1169 (insert completion))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1170 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1171 ;; 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
|
1172 ;; 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
|
1173 ;; 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
|
1174 ;; that. |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1175 (t |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1176 (message "Making completion list...") |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1177 (let ((list (all-completions try table))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1178 (with-output-to-temp-buffer "*Completions*" |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1179 (display-completion-list list))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1180 (message "Making completion list...done")))))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1181 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1182 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1183 |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1184 ;; Backslashification. Stolen from cc-mode.el. |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1185 |
17240
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1186 (defun makefile-backslash-region (from to delete-flag) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1187 "Insert, align, or delete end-of-line backslashes on the lines in the region. |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1188 With no argument, inserts backslashes and aligns existing backslashes. |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1189 With an argument, deletes the backslashes. |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1190 |
26136 | 1191 This function does not modify the last line of the region if the region ends |
17240
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1192 right at the start of the following line; it does not modify blank lines |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1193 at the start of the region. So you can put the region around an entire macro |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1194 definition and conveniently use this command." |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1195 (interactive "r\nP") |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1196 (save-excursion |
17240
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1197 (goto-char from) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1198 (let ((column makefile-backslash-column) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1199 (endmark (make-marker))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1200 (move-marker endmark to) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1201 ;; Compute the smallest column number past the ends of all the lines. |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1202 (if makefile-backslash-align |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1203 (progn |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1204 (if (not delete-flag) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1205 (while (< (point) to) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1206 (end-of-line) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1207 (if (= (preceding-char) ?\\) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1208 (progn (forward-char -1) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1209 (skip-chars-backward " \t"))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1210 (setq column (max column (1+ (current-column)))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1211 (forward-line 1))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1212 ;; Adjust upward to a tab column, if that doesn't push |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1213 ;; past the margin. |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1214 (if (> (% column tab-width) 0) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1215 (let ((adjusted (* (/ (+ column tab-width -1) tab-width) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1216 tab-width))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1217 (if (< adjusted (window-width)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1218 (setq column adjusted)))))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1219 ;; Don't modify blank lines at start of region. |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1220 (goto-char from) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1221 (while (and (< (point) endmark) (eolp)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1222 (forward-line 1)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1223 ;; Add or remove backslashes on all the lines. |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1224 (while (and (< (point) endmark) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1225 ;; Don't backslashify the last line |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1226 ;; if the region ends right at the start of the next line. |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1227 (save-excursion |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1228 (forward-line 1) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1229 (< (point) endmark))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1230 (if (not delete-flag) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1231 (makefile-append-backslash column) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1232 (makefile-delete-backslash)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1233 (forward-line 1)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1234 (move-marker endmark nil)))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1235 |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1236 (defun makefile-append-backslash (column) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1237 (end-of-line) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1238 ;; Note that "\\\\" is needed to get one backslash. |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1239 (if (= (preceding-char) ?\\) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1240 (progn (forward-char -1) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1241 (delete-horizontal-space) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1242 (indent-to column (if makefile-backslash-align nil 1))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1243 (indent-to column (if makefile-backslash-align nil 1)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1244 (insert "\\"))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1245 |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1246 (defun makefile-delete-backslash () |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1247 (end-of-line) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1248 (or (bolp) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1249 (progn |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1250 (forward-char -1) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1251 (if (looking-at "\\\\") |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1252 (delete-region (1+ (point)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1253 (progn (skip-chars-backward " \t") (point))))))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1254 |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1255 |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1256 |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1257 ;; Filling |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1258 |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1259 (defun makefile-fill-paragraph (arg) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1260 ;; Fill comments, backslashed lines, and variable definitions |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1261 ;; specially. |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1262 (save-excursion |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1263 (beginning-of-line) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1264 (cond |
57158
84b733d819d4
(makefile-fill-paragraph): Don't insist on spaces when looking for
Richard M. Stallman <rms@gnu.org>
parents:
56503
diff
changeset
|
1265 ((looking-at "^#+") |
47527
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1266 ;; Found a comment. Set the fill prefix, and find the paragraph |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1267 ;; boundaries by searching for lines that look like comment-only |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1268 ;; lines. |
47546
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1269 (let ((fill-prefix (match-string-no-properties 0)) |
17240
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1270 (fill-paragraph-function nil)) |
47527
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1271 (save-excursion |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1272 (save-restriction |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1273 (narrow-to-region |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1274 ;; Search backwards. |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1275 (save-excursion |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1276 (while (and (zerop (forward-line -1)) |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1277 (looking-at "^#"))) |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1278 ;; We may have gone too far. Go forward again. |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1279 (or (looking-at "^#") |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1280 (forward-line 1)) |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1281 (point)) |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1282 ;; Search forwards. |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1283 (save-excursion |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1284 (while (looking-at "^#") |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1285 (forward-line)) |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1286 (point))) |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1287 (fill-paragraph nil) |
7d7d818ed852
(makefile-fill-paragraph): Find comment boundaries before filling.
Richard M. Stallman <rms@gnu.org>
parents:
41642
diff
changeset
|
1288 t)))) |
17240
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1289 |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1290 ;; Must look for backslashed-region before looking for variable |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1291 ;; assignment. |
47546
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1292 ((or (eq (char-before (line-end-position 1)) ?\\) |
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1293 (eq (char-before (line-end-position 0)) ?\\)) |
17240
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1294 ;; A backslash region. Find beginning and end, remove |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1295 ;; backslashes, fill, and then reapply backslahes. |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1296 (end-of-line) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1297 (let ((beginning |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1298 (save-excursion |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1299 (end-of-line 0) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1300 (while (= (preceding-char) ?\\) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1301 (end-of-line 0)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1302 (forward-char) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1303 (point))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1304 (end |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1305 (save-excursion |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1306 (while (= (preceding-char) ?\\) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1307 (end-of-line 2)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1308 (point)))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1309 (save-restriction |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1310 (narrow-to-region beginning end) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1311 (makefile-backslash-region (point-min) (point-max) t) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1312 (let ((fill-paragraph-function nil)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1313 (fill-paragraph nil)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1314 (makefile-backslash-region (point-min) (point-max) nil) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1315 (goto-char (point-max)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1316 (if (< (skip-chars-backward "\n") 0) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1317 (delete-region (point) (point-max)))))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1318 |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1319 ((looking-at makefile-macroassign-regex) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1320 ;; Have a macro assign. Fill just this line, and then backslash |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1321 ;; resulting region. |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1322 (save-restriction |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
1323 (narrow-to-region (point) (line-beginning-position 2)) |
17240
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1324 (let ((fill-paragraph-function nil)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1325 (fill-paragraph nil)) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1326 (makefile-backslash-region (point-min) (point-max) nil))))) |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1327 |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1328 ;; Always return non-nil so we don't fill anything else. |
9e236e540a59
(makefile-backslash-align): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
17142
diff
changeset
|
1329 t) |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1330 |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1331 |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1332 |
809 | 1333 ;;; ------------------------------------------------------------ |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1334 ;;; Browser mode. |
809 | 1335 ;;; ------------------------------------------------------------ |
1336 | |
1337 (defun makefile-browser-format-target-line (target selected) | |
1338 (format | |
1339 (concat (make-string makefile-browser-leftmost-column ?\ ) | |
1340 (if selected | |
1341 makefile-browser-selected-mark | |
1342 makefile-browser-unselected-mark) | |
1343 "%s%s") | |
1344 target makefile-target-colon)) | |
1345 | |
1346 (defun makefile-browser-format-macro-line (macro selected) | |
1347 (format | |
1348 (concat (make-string makefile-browser-leftmost-column ?\ ) | |
1349 (if selected | |
1350 makefile-browser-selected-mark | |
1351 makefile-browser-unselected-mark) | |
1352 (makefile-format-macro-ref macro)))) | |
1353 | |
1354 (defun makefile-browser-fill (targets macros) | |
5820
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1355 (let ((inhibit-read-only t)) |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1356 (goto-char (point-min)) |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1357 (erase-buffer) |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1358 (mapconcat |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1359 (function |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1360 (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
|
1361 targets |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1362 "") |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1363 (mapconcat |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1364 (function |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1365 (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
|
1366 macros |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1367 "") |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1368 (sort-lines nil (point-min) (point-max)) |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1369 (goto-char (1- (point-max))) |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1370 (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
|
1371 (goto-char (point-min)) |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1372 (forward-char makefile-browser-cursor-column))) |
809 | 1373 |
1374 ;;; | |
1375 ;;; Moving up and down in the browser | |
1376 ;;; | |
1377 | |
1378 (defun makefile-browser-next-line () | |
1379 "Move the browser selection cursor to the next line." | |
1380 (interactive) | |
1381 (if (not (makefile-last-line-p)) | |
1382 (progn | |
1383 (forward-line 1) | |
1384 (forward-char makefile-browser-cursor-column)))) | |
1385 | |
1386 (defun makefile-browser-previous-line () | |
1387 "Move the browser selection cursor to the previous line." | |
1388 (interactive) | |
1389 (if (not (makefile-first-line-p)) | |
1390 (progn | |
1391 (forward-line -1) | |
1392 (forward-char makefile-browser-cursor-column)))) | |
1393 | |
1394 ;;; | |
1395 ;;; Quitting the browser (returns to client buffer) | |
1396 ;;; | |
1397 | |
1398 (defun makefile-browser-quit () | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1399 "Leave the browser and return to the makefile buffer." |
809 | 1400 (interactive) |
1401 (let ((my-client makefile-browser-client)) | |
1402 (setq makefile-browser-client nil) ; we quitted, so NO client! | |
1403 (set-buffer-modified-p nil) | |
21096
712fd7860b32
(makefile-browser-quit): Use quit-window.
Richard M. Stallman <rms@gnu.org>
parents:
21000
diff
changeset
|
1404 (quit-window t) |
809 | 1405 (pop-to-buffer my-client))) |
1406 | |
1407 ;;; | |
1408 ;;; Toggle state of a browser item | |
1409 ;;; | |
1410 | |
1411 (defun makefile-browser-toggle () | |
1412 "Toggle the selection state of the browser item at the cursor position." | |
1413 (interactive) | |
1414 (let ((this-line (count-lines (point-min) (point)))) | |
1415 (setq this-line (max 1 this-line)) | |
1416 (makefile-browser-toggle-state-for-line this-line) | |
1417 (goto-line this-line) | |
5820
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1418 (let ((inhibit-read-only t)) |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1419 (beginning-of-line) |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1420 (if (makefile-browser-on-macro-line-p) |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1421 (let ((macro-name (makefile-browser-this-line-macro-name))) |
14277
f0d30883b329
(makefile-browser-toggle): Use delete-region, not kill-line.
Richard M. Stallman <rms@gnu.org>
parents:
14209
diff
changeset
|
1422 (delete-region (point) (progn (end-of-line) (point))) |
5820
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1423 (insert |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1424 (makefile-browser-format-macro-line |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1425 macro-name |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1426 (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
|
1427 (let ((target-name (makefile-browser-this-line-target-name))) |
14277
f0d30883b329
(makefile-browser-toggle): Use delete-region, not kill-line.
Richard M. Stallman <rms@gnu.org>
parents:
14209
diff
changeset
|
1428 (delete-region (point) (progn (end-of-line) (point))) |
809 | 1429 (insert |
5820
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1430 (makefile-browser-format-target-line |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1431 target-name |
3443820118a0
(makefile-browser-fill, makefile-browser-toggle):
Richard M. Stallman <rms@gnu.org>
parents:
5464
diff
changeset
|
1432 (makefile-browser-get-state-for-line this-line)))))) |
809 | 1433 (beginning-of-line) |
1434 (forward-char makefile-browser-cursor-column) | |
1435 (if makefile-browser-auto-advance-after-selection-p | |
1436 (makefile-browser-next-line)))) | |
1437 | |
1438 ;;; | |
1439 ;;; Making insertions into the client buffer | |
1440 ;;; | |
1441 | |
1442 (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
|
1443 "Insert a makefile continuation. |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1444 In the makefile buffer, go to (end-of-line), insert a \'\\\' |
809 | 1445 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
|
1446 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
|
1447 large dependencies from the browser to the client buffer. |
7639 | 1448 \(point) advances accordingly in the client buffer." |
809 | 1449 (interactive) |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
1450 (with-current-buffer makefile-browser-client |
809 | 1451 (end-of-line) |
1452 (insert "\\\n\t"))) | |
1453 | |
1454 (defun makefile-browser-insert-selection () | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1455 "Insert all selected targets and/or macros in the makefile buffer. |
12936 | 1456 Insertion takes place at point." |
809 | 1457 (interactive) |
1458 (save-excursion | |
1459 (goto-line 1) | |
1460 (let ((current-line 1)) | |
1461 (while (not (eobp)) | |
1462 (if (makefile-browser-get-state-for-line current-line) | |
1463 (makefile-browser-send-this-line-item)) | |
1464 (forward-line 1) | |
1465 (setq current-line (1+ current-line)))))) | |
1466 | |
1467 (defun makefile-browser-insert-selection-and-quit () | |
1468 (interactive) | |
1469 (makefile-browser-insert-selection) | |
1470 (makefile-browser-quit)) | |
1471 | |
1472 (defun makefile-browser-send-this-line-item () | |
1473 (if (makefile-browser-on-macro-line-p) | |
1474 (save-excursion | |
1475 (let ((macro-name (makefile-browser-this-line-macro-name))) | |
1476 (set-buffer makefile-browser-client) | |
1477 (insert (makefile-format-macro-ref macro-name) " "))) | |
1478 (save-excursion | |
1479 (let ((target-name (makefile-browser-this-line-target-name))) | |
1480 (set-buffer makefile-browser-client) | |
1481 (insert target-name " "))))) | |
1482 | |
1483 (defun makefile-browser-start-interaction () | |
1484 (use-local-map makefile-browser-map) | |
1485 (setq buffer-read-only t)) | |
1486 | |
1487 (defun makefile-browse (targets macros) | |
1488 (interactive) | |
1489 (if (zerop (+ (length targets) (length macros))) | |
1490 (progn | |
1491 (beep) | |
1492 (message "No macros or targets to browse! Consider running 'makefile-pickup-everything\'")) | |
1493 (let ((browser-buffer (get-buffer-create makefile-browser-buffer-name))) | |
1494 (pop-to-buffer browser-buffer) | |
1495 (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
|
1496 (shrink-window-if-larger-than-buffer) |
38418
336177767929
(makefile-browse): Use make-local-variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37469
diff
changeset
|
1497 (set (make-local-variable 'makefile-browser-selection-vector) |
336177767929
(makefile-browse): Use make-local-variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
37469
diff
changeset
|
1498 (make-vector (+ (length targets) (length macros)) nil)) |
809 | 1499 (makefile-browser-start-interaction)))) |
1500 | |
1501 (defun makefile-switch-to-browser () | |
1502 (interactive) | |
1503 (run-hooks 'makefile-browser-hook) | |
1504 (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
|
1505 (makefile-pickup-targets) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1506 (makefile-pickup-macros) |
809 | 1507 (makefile-browse makefile-target-table makefile-macro-table)) |
1508 | |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1509 |
809 | 1510 |
1511 ;;; ------------------------------------------------------------ | |
1512 ;;; Up-to-date overview buffer | |
1513 ;;; ------------------------------------------------------------ | |
1514 | |
1515 (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
|
1516 "Create a buffer containing an overview of the state of all known targets. |
809 | 1517 Known targets are targets that are explicitly defined in that makefile; |
1518 in other words, all targets that appear on the left hand side of a | |
1519 dependency in the makefile." | |
1520 (interactive) | |
1521 (if (y-or-n-p "Are you sure that the makefile being edited is consistent? ") | |
1522 ;; | |
1523 ;; The rest of this function operates on a temporary makefile, created by | |
1524 ;; writing the current contents of the makefile buffer. | |
1525 ;; | |
1526 (let ((saved-target-table makefile-target-table) | |
1527 (this-buffer (current-buffer)) | |
1528 (makefile-up-to-date-buffer | |
1529 (get-buffer-create makefile-up-to-date-buffer-name)) | |
1530 (filename (makefile-save-temporary)) | |
1531 ;; | |
1532 ;; Forget the target table because it may contain picked-up filenames | |
1533 ;; that are not really targets in the current makefile. | |
1534 ;; We don't want to query these, so get a new target-table with just the | |
1535 ;; targets that can be found in the makefile buffer. | |
1536 ;; The 'old' target table will be restored later. | |
1537 ;; | |
1538 (real-targets (progn | |
1539 (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
|
1540 makefile-target-table)) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1541 (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
|
1542 ) |
809 | 1543 |
1544 (set-buffer makefile-up-to-date-buffer) | |
1545 (setq buffer-read-only nil) | |
1546 (erase-buffer) | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1547 (makefile-query-targets filename real-targets prereqs) |
809 | 1548 (if (zerop (buffer-size)) ; if it did not get us anything |
1549 (progn | |
1550 (kill-buffer (current-buffer)) | |
1551 (message "No overview created!"))) | |
1552 (set-buffer this-buffer) | |
1553 (setq makefile-target-table saved-target-table) | |
1554 (if (get-buffer makefile-up-to-date-buffer-name) | |
1555 (progn | |
1556 (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
|
1557 (shrink-window-if-larger-than-buffer) |
809 | 1558 (sort-lines nil (point-min) (point-max)) |
1559 (setq buffer-read-only t)))))) | |
1560 | |
1561 (defun makefile-save-temporary () | |
1562 "Create a temporary file from the current makefile buffer." | |
1563 (let ((filename (makefile-generate-temporary-filename))) | |
1564 (write-region (point-min) (point-max) filename nil 0) | |
1565 filename)) ; return the filename | |
1566 | |
1567 (defun makefile-generate-temporary-filename () | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1568 "Create a filename suitable for use in `makefile-save-temporary'. |
809 | 1569 Be careful to allow brain-dead file systems (DOS, SYSV ...) to cope |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1570 with the generated name!" |
809 | 1571 (let ((my-name (user-login-name)) |
1572 (my-uid (int-to-string (user-uid)))) | |
1573 (concat "mktmp" | |
1574 (if (> (length my-name) 3) | |
1575 (substring my-name 0 3) | |
1576 my-name) | |
1577 "." | |
1578 (if (> (length my-uid) 3) | |
1579 (substring my-uid 0 3) | |
1580 my-uid)))) | |
1581 | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1582 (defun makefile-query-targets (filename target-table prereq-list) |
12936 | 1583 "Fill the up-to-date overview buffer. |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1584 Checks each target in TARGET-TABLE using `makefile-query-one-target-method' |
809 | 1585 and generates the overview, one line per target name." |
1586 (insert | |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1587 (mapconcat |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1588 (function (lambda (item) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1589 (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
|
1590 (no-prereqs (not (member target-name prereq-list))) |
26136 | 1591 (needs-rebuild (or no-prereqs |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1592 (funcall |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1593 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
|
1594 target-name |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1595 filename)))) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1596 (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
|
1597 target-name |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1598 (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
|
1599 (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
|
1600 (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
|
1601 )) |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1602 target-table "\n")) |
809 | 1603 (goto-char (point-min)) |
1604 (delete-file filename)) ; remove the tmpfile | |
1605 | |
1606 (defun makefile-query-by-make-minus-q (target &optional filename) | |
53477
79093b308520
* progmodes/idlwave.el (idlwave-make-tags):
Eli Zaretskii <eliz@is.elta.co.il>
parents:
53170
diff
changeset
|
1607 (not (eq 0 |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1608 (call-process makefile-brave-make nil nil nil |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1609 "-f" filename "-q" target)))) |
809 | 1610 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1611 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1612 |
809 | 1613 ;;; ------------------------------------------------------------ |
1614 ;;; Continuation cleanup | |
1615 ;;; ------------------------------------------------------------ | |
1616 | |
1617 (defun makefile-cleanup-continuations () | |
1618 (if (eq major-mode 'makefile-mode) | |
47546
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1619 (if (and makefile-cleanup-continuations |
809 | 1620 (not buffer-read-only)) |
1621 (save-excursion | |
1622 (goto-char (point-min)) | |
47546
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1623 (while (re-search-forward "\\\\[ \t]+$" nil t) |
809 | 1624 (replace-match "\\" t t)))))) |
1625 | |
6146
1a2a8ef9b4af
(makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents:
5820
diff
changeset
|
1626 |
1a2a8ef9b4af
(makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents:
5820
diff
changeset
|
1627 ;;; ------------------------------------------------------------ |
1a2a8ef9b4af
(makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents:
5820
diff
changeset
|
1628 ;;; 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
|
1629 ;;; ------------------------------------------------------------ |
1a2a8ef9b4af
(makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents:
5820
diff
changeset
|
1630 |
1a2a8ef9b4af
(makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents:
5820
diff
changeset
|
1631 (defun makefile-warn-suspicious-lines () |
28277
18aaefd4bc8f
(makefile-warn-suspicious-lines): clean
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
26621
diff
changeset
|
1632 ;; Returning non-nil cancels the save operation |
18aaefd4bc8f
(makefile-warn-suspicious-lines): clean
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
26621
diff
changeset
|
1633 (if (eq major-mode 'makefile-mode) |
18aaefd4bc8f
(makefile-warn-suspicious-lines): clean
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
26621
diff
changeset
|
1634 (save-excursion |
18aaefd4bc8f
(makefile-warn-suspicious-lines): clean
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
26621
diff
changeset
|
1635 (goto-char (point-min)) |
18aaefd4bc8f
(makefile-warn-suspicious-lines): clean
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
26621
diff
changeset
|
1636 (if (re-search-forward "^\\(\t+$\\| +\t\\)" nil t) |
18aaefd4bc8f
(makefile-warn-suspicious-lines): clean
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
26621
diff
changeset
|
1637 (not (y-or-n-p |
48018
1117d26eaae0
(makefile-cleanup-continuations): Default for variable is nil.
Richard M. Stallman <rms@gnu.org>
parents:
47546
diff
changeset
|
1638 (format "Suspicious line %d. Save anyway? " |
28277
18aaefd4bc8f
(makefile-warn-suspicious-lines): clean
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
26621
diff
changeset
|
1639 (count-lines (point-min) (point))))))))) |
48018
1117d26eaae0
(makefile-cleanup-continuations): Default for variable is nil.
Richard M. Stallman <rms@gnu.org>
parents:
47546
diff
changeset
|
1640 |
1117d26eaae0
(makefile-cleanup-continuations): Default for variable is nil.
Richard M. Stallman <rms@gnu.org>
parents:
47546
diff
changeset
|
1641 (defun makefile-warn-continuations () |
1117d26eaae0
(makefile-cleanup-continuations): Default for variable is nil.
Richard M. Stallman <rms@gnu.org>
parents:
47546
diff
changeset
|
1642 (if (eq major-mode 'makefile-mode) |
1117d26eaae0
(makefile-cleanup-continuations): Default for variable is nil.
Richard M. Stallman <rms@gnu.org>
parents:
47546
diff
changeset
|
1643 (save-excursion |
1117d26eaae0
(makefile-cleanup-continuations): Default for variable is nil.
Richard M. Stallman <rms@gnu.org>
parents:
47546
diff
changeset
|
1644 (goto-char (point-min)) |
48037
1e646259d1b2
(makefile-warn-continuations): Don't barf when there _aren't_ any
Miles Bader <miles@gnu.org>
parents:
48018
diff
changeset
|
1645 (if (re-search-forward "\\\\[ \t]+$" nil t) |
48018
1117d26eaae0
(makefile-cleanup-continuations): Default for variable is nil.
Richard M. Stallman <rms@gnu.org>
parents:
47546
diff
changeset
|
1646 (not (y-or-n-p |
1117d26eaae0
(makefile-cleanup-continuations): Default for variable is nil.
Richard M. Stallman <rms@gnu.org>
parents:
47546
diff
changeset
|
1647 (format "Suspicious continuation in line %d. Save anyway? " |
1117d26eaae0
(makefile-cleanup-continuations): Default for variable is nil.
Richard M. Stallman <rms@gnu.org>
parents:
47546
diff
changeset
|
1648 (count-lines (point-min) (point))))))))) |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1649 |
6146
1a2a8ef9b4af
(makefile-mode): Set local-write-file-hooks, not write-file-hooks.
Richard M. Stallman <rms@gnu.org>
parents:
5820
diff
changeset
|
1650 |
809 | 1651 ;;; ------------------------------------------------------------ |
1652 ;;; GNU make function support | |
1653 ;;; ------------------------------------------------------------ | |
1654 | |
1655 (defun makefile-insert-gmake-function () | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1656 "Insert a GNU make function call. |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1657 Asks for the name of the function to use (with completion). |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1658 Then prompts for all required parameters." |
809 | 1659 (interactive) |
1660 (let* ((gm-function-name (completing-read | |
1661 "Function: " | |
1662 makefile-gnumake-functions-alist | |
1663 nil t nil)) | |
1664 (gm-function-prompts | |
1665 (cdr (assoc gm-function-name makefile-gnumake-functions-alist)))) | |
1666 (if (not (zerop (length gm-function-name))) | |
1667 (insert (makefile-format-macro-ref | |
1668 (concat gm-function-name " " | |
1669 (makefile-prompt-for-gmake-funargs | |
1670 gm-function-name gm-function-prompts))) | |
1671 " ")))) | |
1672 | |
1673 (defun makefile-prompt-for-gmake-funargs (function-name prompt-list) | |
1674 (mapconcat | |
1675 (function (lambda (one-prompt) | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1676 (read-string (format "[%s] %s: " function-name one-prompt) |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1677 nil))) |
809 | 1678 prompt-list |
1679 ",")) | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1680 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1681 |
809 | 1682 |
1683 ;;; ------------------------------------------------------------ | |
1684 ;;; Utility functions | |
1685 ;;; ------------------------------------------------------------ | |
1686 | |
62276
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
1687 (defun makefile-match-function-end (end) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
1688 "To be called as an anchored matcher by font-lock. |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
1689 The anchor must have matched the opening parens in the first group." |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
1690 (let ((s (match-string-no-properties 1))) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
1691 (setq s (cond ((string= s "(") "\\(.*?\\)[ \t]*)") |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
1692 ((string= s "{") "\\(.*?\\)[ \t]*}") |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
1693 ((string= s "((") "\\(.*?\\)[ \t]*))") |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
1694 ((string= s "{{") "\\(.*?\\)[ \t]*}}"))) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
1695 (if s (looking-at s)))) |
c1e4bf9803aa
(makefile-targets-face, makefile-shell-face, makefile-makepp-perl-face): New faces.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62082
diff
changeset
|
1696 |
62444
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
1697 (defun makefile-match-dependency (bound) |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
1698 "Search for `makefile-dependency-regex' up to BOUND. |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
1699 Checks that the colon has not already been fontified, else we |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
1700 matched in a rule action." |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
1701 (catch 'found |
62444
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
1702 (let ((pt (point))) |
62503
c50200e8e7e8
(makefile-add-this-line-targets): Simplify and integrate into `makefile-pickup-targets'.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62491
diff
changeset
|
1703 (while (progn (skip-chars-forward makefile-dependency-skip bound) |
62569
f09fbe52c543
(makefile-imenu-generic-expression): Use function to find dependencies, because regexp alone is so complex, it easily goes into an endless loop.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62525
diff
changeset
|
1704 (< (point) (or bound (point-max)))) |
62444
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
1705 (forward-char) |
62491
2acb3a2dd842
(makefile-previous-dependency, makefile-match-dependency): Check for := (and in bsd mode also !=) to give a better result, even when font-lock is not on.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62446
diff
changeset
|
1706 (or (eq (char-after) ?=) |
2acb3a2dd842
(makefile-previous-dependency, makefile-match-dependency): Check for := (and in bsd mode also !=) to give a better result, even when font-lock is not on.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62446
diff
changeset
|
1707 (get-text-property (1- (point)) 'face) |
63444
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
1708 (if (> (line-beginning-position) (+ (point-min) 2)) |
cc4a71461921
(makefile-space, makefile-makepp-perl): Eliminate "-face" suffix.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
63138
diff
changeset
|
1709 (eq (char-before (line-end-position 0)) ?\\)) |
62444
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
1710 (when (save-excursion |
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
1711 (beginning-of-line) |
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
1712 (looking-at makefile-dependency-regex)) |
63067
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1713 (save-excursion |
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1714 (let ((deps-end (match-end 1)) |
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1715 (match-data (match-data))) |
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1716 (goto-char deps-end) |
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1717 (skip-chars-backward " \t") |
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1718 (setq deps-end (point)) |
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1719 (beginning-of-line) |
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1720 (skip-chars-forward " \t") |
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1721 ;; Alter the bounds recorded for subexp 1, |
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1722 ;; which is what is supposed to match the targets. |
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1723 (setcar (nthcdr 2 match-data) (point)) |
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1724 (setcar (nthcdr 3 match-data) deps-end) |
7738d9700f66
(makefile-dependency-regex): Handle whitespace
Richard M. Stallman <rms@gnu.org>
parents:
62965
diff
changeset
|
1725 (store-match-data match-data))) |
62444
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
1726 (end-of-line) |
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
1727 (throw 'found (point))))) |
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
1728 (goto-char pt)) |
24bf25fa47db
(makefile-dependency-skip): New variable.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62412
diff
changeset
|
1729 nil)) |
62412
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
1730 |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
1731 (defun makefile-match-action (bound) |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
1732 (catch 'found |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
1733 (while (re-search-forward makefile-rule-action-regex bound t) |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
1734 (or (eq ?\\ (char-after (- (match-beginning 0) 2))) |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
1735 (throw 'found t))))) |
6ac7ed8e212b
(makefile-dependency-regex): Turn it into a var, and refine it to mask one more level of nested vars.
Daniel Pfeiffer <occitan@esperanto.org>
parents:
62276
diff
changeset
|
1736 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1737 (defun makefile-do-macro-insertion (macro-name) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1738 "Insert a macro reference." |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1739 (if (not (zerop (length macro-name))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1740 (if (assoc macro-name makefile-runtime-macros-list) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1741 (insert "$" macro-name) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1742 (insert (makefile-format-macro-ref macro-name))))) |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1743 |
2559
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1744 (defun makefile-remember-target (target-name &optional has-prereqs) |
809 | 1745 "Remember a given target if it is not already remembered for this buffer." |
1746 (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
|
1747 (progn |
809 | 1748 (if (not (assoc target-name makefile-target-table)) |
1749 (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
|
1750 (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
|
1751 (if has-prereqs |
5f2c2994cbca
Rewritten and simplified, commentary added. It now will usually
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2534
diff
changeset
|
1752 (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
|
1753 (cons target-name makefile-has-prereqs)))))) |
809 | 1754 |
1755 (defun makefile-remember-macro (macro-name) | |
1756 "Remember a given macro if it is not already remembered for this buffer." | |
1757 (if (not (zerop (length macro-name))) | |
1758 (if (not (assoc macro-name makefile-macro-table)) | |
1759 (setq makefile-macro-table | |
1760 (cons (list macro-name) makefile-macro-table))))) | |
1761 | |
1762 (defun makefile-forward-after-target-colon () | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1763 "Move point forward after inserting the terminating colon of a target. |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1764 This acts according to the value of `makefile-tab-after-target-colon'." |
809 | 1765 (if makefile-tab-after-target-colon |
1766 (insert "\t") | |
1767 (insert " "))) | |
1768 | |
1769 (defun makefile-browser-on-macro-line-p () | |
1770 "Determine if point is on a macro line in the browser." | |
1771 (save-excursion | |
1772 (beginning-of-line) | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
1773 (re-search-forward "\\$[{(]" (line-end-position) t))) |
809 | 1774 |
1775 (defun makefile-browser-this-line-target-name () | |
1776 "Extract the target name from a line in the browser." | |
1777 (save-excursion | |
1778 (end-of-line) | |
1779 (skip-chars-backward "^ \t") | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
1780 (buffer-substring (point) (1- (line-end-position))))) |
809 | 1781 |
1782 (defun makefile-browser-this-line-macro-name () | |
1783 "Extract the macro name from a line in the browser." | |
1784 (save-excursion | |
1785 (beginning-of-line) | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
1786 (re-search-forward "\\$[{(]" (line-end-position) t) |
809 | 1787 (let ((macro-start (point))) |
1788 (skip-chars-forward "^})") | |
1789 (buffer-substring macro-start (point))))) | |
1790 | |
1791 (defun makefile-format-macro-ref (macro-name) | |
9758
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1792 "Format a macro reference. |
b9084912762f
Changed almost every doc string.
Richard M. Stallman <rms@gnu.org>
parents:
9477
diff
changeset
|
1793 Uses `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
|
1794 (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
|
1795 (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
|
1796 (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
|
1797 (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
|
1798 (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
|
1799 (format "$(%s)" macro-name)))) |
809 | 1800 |
1801 (defun makefile-browser-get-state-for-line (n) | |
1802 (aref makefile-browser-selection-vector (1- n))) | |
1803 | |
1804 (defun makefile-browser-set-state-for-line (n to-state) | |
1805 (aset makefile-browser-selection-vector (1- n) to-state)) | |
1806 | |
1807 (defun makefile-browser-toggle-state-for-line (n) | |
1808 (makefile-browser-set-state-for-line n (not (makefile-browser-get-state-for-line n)))) | |
1809 | |
1810 (defun makefile-last-line-p () | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
1811 (= (line-end-position) (point-max))) |
809 | 1812 |
1813 (defun makefile-first-line-p () | |
41641
66c7637cbf17
Use line-(end|beginning)-position.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
38600
diff
changeset
|
1814 (= (line-beginning-position) (point-min))) |
809 | 1815 |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1816 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1817 |
24271 | 1818 ;;; Support for other packages, like add-log. |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1819 |
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1820 (defun makefile-add-log-defun () |
13847
36556403b62b
(makefile-add-log-defun): Rewrite to scan back
Richard M. Stallman <rms@gnu.org>
parents:
13804
diff
changeset
|
1821 "Return name of target or variable assignment that point is in. |
36556403b62b
(makefile-add-log-defun): Rewrite to scan back
Richard M. Stallman <rms@gnu.org>
parents:
13804
diff
changeset
|
1822 If it isn't in one, return nil." |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1823 (save-excursion |
13847
36556403b62b
(makefile-add-log-defun): Rewrite to scan back
Richard M. Stallman <rms@gnu.org>
parents:
13804
diff
changeset
|
1824 (let (found) |
36556403b62b
(makefile-add-log-defun): Rewrite to scan back
Richard M. Stallman <rms@gnu.org>
parents:
13804
diff
changeset
|
1825 (beginning-of-line) |
36556403b62b
(makefile-add-log-defun): Rewrite to scan back
Richard M. Stallman <rms@gnu.org>
parents:
13804
diff
changeset
|
1826 ;; Scan back line by line, noticing when we come to a |
36556403b62b
(makefile-add-log-defun): Rewrite to scan back
Richard M. Stallman <rms@gnu.org>
parents:
13804
diff
changeset
|
1827 ;; variable or rule definition, and giving up when we see |
36556403b62b
(makefile-add-log-defun): Rewrite to scan back
Richard M. Stallman <rms@gnu.org>
parents:
13804
diff
changeset
|
1828 ;; a line that is not part of either of those. |
47546
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1829 (while (not (or (setq found |
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1830 (when (or (looking-at makefile-macroassign-regex) |
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1831 (looking-at makefile-dependency-regex)) |
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1832 (match-string-no-properties 1))) |
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1833 ;; Don't keep looking across a blank line or comment. |
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1834 (looking-at "$\\|#") |
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1835 (not (zerop (forward-line -1)))))) |
2c7b4003c5ad
(makefile-cleanup-continuations-p): Rename to makefile-cleanup-continuations.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
47527
diff
changeset
|
1836 found))) |
9454
40340d39257d
(makefile-mode-name): Removed.
Richard M. Stallman <rms@gnu.org>
parents:
7639
diff
changeset
|
1837 |
41642
d00b43e2316c
Move `provide' to the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41641
diff
changeset
|
1838 (provide 'make-mode) |
d00b43e2316c
Move `provide' to the end.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41641
diff
changeset
|
1839 |
52401 | 1840 ;;; arch-tag: bd23545a-de91-44fb-b1b2-feafbb2635a0 |
13402
1f9832fe9e44
(makefile-define-space-face): Don't make face if non-X.
Karl Heuer <kwzh@gnu.org>
parents:
13333
diff
changeset
|
1841 ;;; make-mode.el ends here |