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