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