Mercurial > emacs
annotate lisp/hilit19.el @ 24296:28d942c5d967
(vietnamese-viqr): Add charset-origin-alist property.
("Vietnamese"): Remove charset-origin-alist property.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 12 Feb 1999 07:46:42 +0000 |
parents | 70ed7ba1ed08 |
children | 4e913c73fa7e |
rev | line source |
---|---|
13337 | 1 ;;; hilit19.el --- customizable highlighting for Emacs19 |
2 | |
7300 | 3 ;; Copyright (c) 1993, 1994 Free Software Foundation, Inc. |
13337 | 4 |
12881
1df99da28f3d
(hilit-submit-feedback): New bug-reporting address.
Karl Heuer <kwzh@gnu.org>
parents:
11035
diff
changeset
|
5 ;; Author: Jonathan Stigelman <stig@hackvan.com> |
17970 | 6 ;; Maintainer: FSF |
7 ;; (actually no longer maintained) | |
4251 | 8 ;; Keywords: faces |
13337 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
4251 | 13 ;; it under the terms of the GNU General Public License as published by |
13337 | 14 ;; the Free Software Foundation; either version 2, or (at your option) |
15 ;; any later version. | |
16 | |
17 ;; GNU Emacs is distributed in the hope that it will be useful, | |
4251 | 18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;; GNU General Public License for more details. | |
13337 | 21 |
4251 | 22 ;; You should have received a copy of the GNU General Public License |
14169 | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
25 ;; Boston, MA 02111-1307, USA. | |
4251 | 26 |
27 ;;; Commentary: | |
28 | |
4390 | 29 ;; Hilit19.el is a customizable highlighting package for Emacs19. It supports |
30 ;; not only source code highlighting, but also Info, RMAIL, VM, gnus... | |
31 ;; Hilit19 knows (or thinks it knows) how to highlight emacs buffers in | |
32 ;; about 25 different modes. | |
33 ;; | |
18717
70ed7ba1ed08
(hilit-submit-feedback): Change mail address.
Richard M. Stallman <rms@gnu.org>
parents:
17970
diff
changeset
|
34 ;; WHERE TO GET THE LATEST VERSIONS OF HILIT19.EL (beta and release): |
4251 | 35 ;; |
18717
70ed7ba1ed08
(hilit-submit-feedback): Change mail address.
Richard M. Stallman <rms@gnu.org>
parents:
17970
diff
changeset
|
36 ;; http://hackvan.com/pub/stig/src/elisp/ |
4251 | 37 ;; |
38 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
39 ;; | |
40 ;; TO SUBMIT BUG REPORTS (or feedback of any sort)... | |
41 ;; | |
42 ;; M-x hilit-submit-feedback RET | |
43 ;; | |
44 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
45 ;; | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
46 ;; hilit19.el,v 2.19 1993/09/08 18:44:10 stig Release |
4251 | 47 ;; |
48 ;; LCD Archive Entry: | |
12881
1df99da28f3d
(hilit-submit-feedback): New bug-reporting address.
Karl Heuer <kwzh@gnu.org>
parents:
11035
diff
changeset
|
49 ;; hilit19|Jonathan Stigelman|stig@hackvan.com| |
4390 | 50 ;; Comprehensive (and comparatively fast) regex-based highlighting for Emacs 19| |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
51 ;; 1993/09/08 18:44:10|Release 2.19|~/packages/hilit19.el.Z| |
4251 | 52 ;; |
53 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
54 ;; | |
55 ;; GENERAL OVERVIEW | |
56 ;; | |
57 ;; This package installs numerous hooks to colorfully highlight your | |
58 ;; source code buffers as well as mail and news buffers. Most | |
59 ;; programming languages have predefined highlighting patterns. | |
60 ;; Just load hilit19 and files will be automatically highlighted as | |
61 ;; they're loaded. | |
62 ;; | |
63 ;; Rehighlight a buffer by typing C-S-l (control-shift-lowercase-L). | |
64 ;; | |
65 ;; If, when you edit the buffer, the coloring gets messed up, just | |
66 ;; redraw and the coloring will be adjusted. If automatic highlighting | |
67 ;; in the current buffer has been turned off, then typing C-u C-S-l will | |
68 ;; force a rehighlight of the entire buffer. | |
69 ;; | |
70 ;; Hilit19 can build faces by examining the names that you give to them | |
71 ;; For example, green/black-bold-italic-underline would be created as | |
72 ;; a face with a green foreground, and a black background, using a | |
73 ;; bold-italic font...with underlining for good measure. | |
74 ;; | |
75 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
76 ;; | |
77 ;; SETUP -- In your .emacs: | |
78 ;; | |
4390 | 79 ;; |
80 ;; (cond (window-system | |
81 ;; (setq hilit-mode-enable-list '(not text-mode) | |
82 ;; hilit-background-mode 'light | |
83 ;; hilit-inhibit-hooks nil | |
84 ;; hilit-inhibit-rebinding nil) | |
85 ;; | |
86 ;; (require 'hilit19) | |
87 ;; )) | |
88 ;; | |
89 ;; If you like font-lock-mode and want to use both packages, then you can | |
90 ;; disable hilit for the modes in which you want to use font-lock by listing | |
91 ;; said modes in hilit-mode-enable-list. | |
92 ;; | |
4251 | 93 ;; (hilit-translate type 'RoyalBlue ; enable highlighting in C/C++ |
94 ;; string nil) ; disable string highlighting | |
95 ;; | |
96 ;; To get 100% of the utility of hilit19, you may also have to apply the | |
97 ;; patches below for info.el and vm5.33L_19/vm-summary.el | |
98 ;; | |
99 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
100 ;; | |
101 ;; SETUP -- Are you using the right font for Emacs? | |
102 ;; | |
103 ;; Emacs cannot properly find bold and italic fonts unless you specify a | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
104 ;; verbose X11 font name. If you specify a font for emacs in your |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
105 ;; .Xdefaults, it *MUST* be specified using the long form of the font name. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
106 ;; Here's a good font menu: |
4251 | 107 ;; |
108 ;; (setq | |
109 ;; x-fixed-font-alist | |
110 ;; '("Font Menu" | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
111 ;; ("Misc" |
4251 | 112 ;; ("6x12" "-misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-*-1") |
113 ;; ("6x13" "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-*-1") | |
114 ;; ("lucida 13" | |
115 ;; "-b&h-lucidatypewriter-medium-r-normal-sans-0-0-0-0-m-0-*-1") | |
116 ;; ("7x13" "-misc-fixed-medium-r-normal--13-120-75-75-c-70-*-1") | |
117 ;; ("7x14" "-misc-fixed-medium-r-normal--14-130-75-75-c-70-*-1") | |
118 ;; ("9x15" "-misc-fixed-medium-r-normal--15-140-*-*-c-*-*-1") | |
119 ;; ("") | |
120 ;; ("clean 8x8" "-schumacher-clean-medium-r-normal--*-80-*-*-c-*-*-1") | |
121 ;; ("clean 8x14" "-schumacher-clean-medium-r-normal--*-140-*-*-c-*-*-1") | |
122 ;; ("clean 8x10" "-schumacher-clean-medium-r-normal--*-100-*-*-c-*-*-1") | |
123 ;; ("clean 8x16" "-schumacher-clean-medium-r-normal--*-160-*-*-c-*-*-1") | |
124 ;; ("") | |
125 ;; ("sony 8x16" "-sony-fixed-medium-r-normal--16-120-100-100-c-80-*-1") | |
126 ;; ("") | |
127 ;; ("-- Courier --") | |
128 ;; ("Courier 10" "-adobe-courier-medium-r-normal--*-100-*-*-m-*-*-1") | |
129 ;; ("Courier 12" "-adobe-courier-medium-r-normal--*-120-*-*-m-*-*-1") | |
130 ;; ("Courier 14" "-adobe-courier-medium-r-normal--*-140-*-*-m-*-*-1") | |
131 ;; ("Courier 18" "-adobe-courier-medium-r-normal--*-180-*-*-m-*-*-1") | |
132 ;; ("Courier 18-b" "-adobe-courier-bold-r-normal--*-180-*-*-m-*-*-1") | |
133 ;; ))) | |
134 ;; | |
135 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
136 ;; | |
137 ;; KNOWN BUGS/TO DO LIST/HELP WANTED/APPLY WITHIN | |
138 ;; | |
4390 | 139 ;; * unbalanced, unescaped double quote characters can confuse hilit19. |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
140 ;; This will be fixed someday, so don't bug me about it. |
4251 | 141 ;; |
4390 | 142 ;; * ALTHOUGH HILIT19 IS FASTER THAN FONT-LOCK-MODE... |
143 ;; For various reasons, the speed of the package could still stand to be | |
144 ;; improved. If you care to do a little profiling and make things tighter... | |
145 ;; | |
146 ;; * hilit-toggle-highlight is flaky when auto-rehighlight is neither t nor nil. | |
147 ;; Does anyone actually USE this? I think I might just remove it. | |
4251 | 148 ;; |
149 ;; PROJECTS THAT YOU CAN TAKE OVER BECAUSE I DON'T MUCH CARE ABOUT THEM... | |
150 ;; | |
151 ;; * Moved hilit-wysiwyg-replace here from my version of man.el, this is not | |
152 ;; a bug. The bug is that I don't have a reverse operation yet...just a | |
16427 | 153 ;; stub Wysiwyg-anything really belongs in a package of its own. |
4251 | 154 ;; |
155 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
156 ;; | |
157 ;; Thanks to the following people for their input: | |
4390 | 158 ;; ebert@enpc.enpc.fr (Rolf EBERT), ada, LaTeX & bibtex highlights |
159 ;; Vivek Khera <khera@cs.duke.edu>, gnus hooks + random advice & patches | |
160 ;; brian@athe.WUstl.EDU (Brian Dunford-Shore), prolog highlights | |
161 ;; John Ladwig <jladwig@soils.umn.edu>, 1st pass nroff highlights | |
162 ;; campo@sunthpi3.difi.unipi.it (Massimo Campostrini), fortran highlights | |
163 ;; jayb@laplace.MATH.ColoState.EDU (Jay Bourland), 1st pass dired | |
164 ;; Yoshio Turner <yoshio@CS.UCLA.EDU>, modula 2 highlights | |
165 ;; Fritz Knabe <knabe@ecrc.de>, advice & patches | |
166 ;; Alon Albert <alon@milcse.rtsg.mot.com>, advice & patches | |
167 ;; dana@thumper.bellcore.com (Dana A. Chee), working on the multi-frame bug | |
168 ;; derway@ndc.com (Don Erway), for breaking it... | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
169 ;; moss_r@summer.chem.su.oz.au (Richard Moss), first pass at add-pattern |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
170 ;; Olivier Lecarme <ol@aiguemarine.unice.fr>, Pascal & Icon patterns |
4251 | 171 ;; |
172 ;; With suggestions and minor regex patches from numerous others... | |
173 ;; | |
174 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
175 ;; | |
4390 | 176 ;; hilit19.el,v |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
177 ;; Revision 2.19 1993/09/08 18:44:10 stig |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
178 ;; installed patch for elusive bug in hilit-rehighlight-region that caused |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
179 ;; hilit-unhighlight-region to hang in an infinite loop. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
180 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
181 ;; Revision 2.18 1993/08/27 03:51:00 stig |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
182 ;; minor mods to lisp-mode and c/c++ mode patterns |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
183 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
184 ;; Revision 2.17 1993/08/25 02:19:17 stig |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
185 ;; work-around for bug in next-overlay-change that caused dired and jargon-mode |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
186 ;; to hang in an endless loop. Perhaps other modes were doing this too. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
187 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
188 ;; Revision 2.16 1993/08/22 19:46:00 stig |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
189 ;; bug fix for next-overlay-change and accompanying change to |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
190 ;; hilit-unhighlight-region |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
191 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
192 ;; Revision 2.15 1993/08/20 12:16:22 stig |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
193 ;; minor change to fortran patterns |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
194 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
195 ;; Revision 2.14 1993/08/17 14:12:10 stig |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
196 ;; added default face mapping for 'formula' which is needed for new latex |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
197 ;; patterns. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
198 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
199 ;; twiddled the calendar-mode patterns a bit. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
200 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
201 ;; Revision 2.13 1993/08/16 04:33:54 stig |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
202 ;; hilit-set-mode-patterns was screwing up two part patterns. it doesn't now. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
203 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
204 ;; Revision 2.12 1993/08/16 00:16:41 stig |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
205 ;; changed references to default-bold-italic to just bold-italic because the |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
206 ;; font for that face is maintained by emacs. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
207 ;; |
16427 | 208 ;; the pattern matcher now starts its searches from the end of the most |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
209 ;; recently highlighted region (which is not necessarily the end of the most |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
210 ;; recently matched regex). |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
211 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
212 ;; multiple errors in pattern matcher now just give an error instead of lots of |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
213 ;; annoying messages and dings. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
214 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
215 ;; no longer use vm-summary-mode-hooks. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
216 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
217 ;; some code moved from hilit-highlight-region to hilit-set-mode-patterns. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
218 ;; This will affect you if you pass your patterns directly to |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
219 ;; hilit-highlight-region....use a pseudo-mode instead. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
220 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
221 ;; pattern changes to C/C++, latex, texinfo, fortran, nroff, etc. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
222 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
223 ;; Revision 2.11 1993/08/13 12:12:37 stig |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
224 ;; removed some crufty commented-out code |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
225 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
226 ;; diverged lisp-mode and emacs-lisp-mode...also added lisp keywords. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
227 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
228 ;; Revision 2.10 1993/08/13 09:47:06 stig |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
229 ;; added calendar-mode, icon-mode and pascal-mode patterns |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
230 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
231 ;; commented out hilit-toggle-highlight because I want to phase it out entirely |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
232 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
233 ;; Revision 2.9 1993/08/13 08:44:22 stig |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
234 ;; added optional case-fold argument to hilit-set-mode-patterns, this case-fold |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
235 ;; parameter is now stored in hilit-patterns-alist. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
236 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
237 ;; Revision 2.8 1993/08/12 22:05:03 stig |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
238 ;; fixed some typos in documentation |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
239 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
240 ;; twiddled some of the color defaults for dark backgrounds |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
241 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
242 ;; always get 'mono color defaults if (not (x-display-color-p)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
243 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
244 ;; added hilit-rehighlight-buffer-quietly to dired-after-readin-hook |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
245 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
246 ;; fixed bug in hilit-string-find that mishandled strings of the form: "\\" |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
247 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
248 ;; NEW FUNCTION: hilit-add-mode-pattern... kinda like add-hook for patterns |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
249 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
250 ;; fixed minor pattern bugs for latex-mode and emacs-lisp-mode |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
251 ;; |
4390 | 252 ;; Revision 2.7 1993/07/30 02:43:01 stig |
253 ;; added const to the list of modifiers for C/C++ types | |
254 ;; | |
255 ;; Revision 2.6 1993/07/30 00:30:54 stig | |
256 ;; now permit selection of arbitrary subexpressions for highlighting... | |
257 ;; fixed keyword patterns for C/C++ using this technique. | |
258 ;; | |
259 ;; Revision 2.5 1993/07/28 05:02:56 stig | |
260 ;; improvements to makefile regular expressions | |
261 ;; removed about 130 lines just by compacting the big defconst for | |
262 ;; hilit-face-translation-table into a mapcar and defining a separate table | |
263 ;; of default faces. | |
264 ;; | |
265 ;; Revision 2.4 1993/07/27 14:09:05 stig | |
266 ;; documented another "known problem" to "head off gripe mail at the pass." | |
267 ;; | |
268 ;; Revision 2.3 1993/07/27 02:15:49 stig | |
16427 | 269 ;; (hilit-lookup-face-create) incorporated patch which improves its behavior |
4390 | 270 ;; with more than one frame... Still can't have bold on the same face in two |
13958
a6908f13121e
(hilit-submit-feedback): Fix message spelling.
Karl Heuer <kwzh@gnu.org>
parents:
13400
diff
changeset
|
271 ;; different fonts sizes at the same time... |
4251 | 272 ;; |
4390 | 273 ;; Revision 2.2 1993/07/27 02:02:59 stig |
274 ;; vastly improved the makefile patterns | |
275 ;; added hook for mh-show-mode | |
276 ;; | |
277 ;; Revision 2.1 1993/07/24 17:46:21 stig | |
278 ;; Phasing out Info-select-hook... Version 19.18 will use Info-selection-hook. | |
279 ;; | |
280 ;; Revision 2.0 1993/07/24 13:50:10 stig | |
281 ;; better documentation and added the function hilit-submit-feedback. | |
282 ;; C-S-l (control shift l) repaints the buffer. Other bindings are optional. | |
283 ;; multi-line highlights no longer cause problems when | |
284 ;; hilit-auto-rehighlight is 'visible | |
285 ;; added hilit-predefined-face-list... | |
286 ;; changed name of hilit-mode-alist to hilit-patterns-alist | |
287 ;; added hilit-message-quietly to mail-setup-hook | |
288 ;; added hilit-parser-alist which can be used to apply different patterns to | |
289 ;; different parts of a buffer. This could be integrated in a far more | |
290 ;; elegant manner, but it presently serves the purpose of not applying | |
16427 | 291 ;; message header patterns to message bodies in mail-mode and its kin. |
4390 | 292 ;; hilit-set-mode-patterns now takes a list of modes and an optional parse-fn |
293 ;; | |
4251 | 294 |
295 ;;;;;; AND THIS CAN BE APPLIED TO VM 5.33L_19 | |
296 ;; | |
297 ;; *** ../site/vm5.33L_19/vm-summary.el Fri Jun 4 22:17:11 1993 | |
298 ;; --- ./vm-summary.el Tue Jun 22 16:39:30 1993 | |
299 ;; *************** | |
300 ;; *** 152,158 **** | |
301 ;; (insert "->") | |
302 ;; (delete-char 2) | |
303 ;; (forward-char -2) | |
304 ;; ! (and w vm-auto-center-summary (vm-auto-center-summary)))) | |
305 ;; (and old-window (select-window old-window))))))) | |
306 ;; | |
307 ;; (defun vm-mark-for-display-update (message) | |
308 ;; --- 152,159 ---- | |
309 ;; (insert "->") | |
310 ;; (delete-char 2) | |
311 ;; (forward-char -2) | |
312 ;; ! (and w vm-auto-center-summary (vm-auto-center-summary)) | |
313 ;; ! (run-hooks 'vm-summary-pointer-hook))) | |
314 ;; (and old-window (select-window old-window))))))) | |
315 ;; | |
316 ;; (defun vm-mark-for-display-update (message) | |
317 ;; | |
318 ;;;;;; | |
319 | |
4252 | 320 ;;; Code: |
4251 | 321 |
322 ;; User Options: | |
323 | |
324 (defvar hilit-quietly nil | |
325 "* If non-nil, this inhibits progress indicators during highlighting") | |
326 | |
327 (defvar hilit-auto-highlight t | |
328 "* T if we should highlight all buffers as we find 'em, nil to disable | |
329 automatic highlighting by the find-file hook.") | |
330 | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
331 (defvar hilit-auto-highlight-maxout 60000 ; hilit19 keeps getting bigger... |
4251 | 332 "* auto-highlight is disabled in buffers larger than this") |
333 | |
334 (defvar hilit-auto-rehighlight t | |
335 "* If this is non-nil, then hilit-redraw and hilit-recenter will also | |
4390 | 336 rehighlight part or all of the current buffer. T will rehighlight the |
337 whole buffer, a NUMBER will rehighlight that many lines before and after | |
338 the cursor, and the symbol 'visible' will rehighlight only the visible | |
339 portion of the current buffer. This variable is buffer-local.") | |
4251 | 340 |
341 (make-variable-buffer-local 'hilit-auto-rehighlight) | |
342 | |
343 (defvar hilit-auto-rehighlight-fallback '(20000 . 100) | |
344 "* Cons of the form (THRESHOLD . FALLBACK), where FALLBACK is assigned to | |
4390 | 345 hilit-auto-rehighlight if the size of a newly opened buffer is larger than |
346 THRESHOLD.") | |
4251 | 347 |
348 (defvar hilit-face-check t | |
349 "* T slows down highlighting but permits the user to change fonts without | |
4390 | 350 losing bold and italic faces... T causes hilit-lookup-face-create to dig |
351 through the frame parameters for the current window every time it's called. | |
352 If you never change fonts in emacs, set this to NIL.") | |
353 | |
354 ;; Variables which must be set before loading hilit19. | |
355 | |
356 (defvar hilit-inhibit-rebinding nil | |
357 "If non-nil, this inhibits replacement of recenter, yank, and yank-pop.") | |
358 | |
359 (defvar hilit-inhibit-hooks nil | |
360 "If non-nil, this inhibits installation of hooks for Info, gnus, & vm.") | |
361 | |
362 (defvar hilit-background-mode 'light | |
363 "'mono inhibits color, 'dark or 'light indicate the background brightness.") | |
364 | |
365 (defvar hilit-mode-enable-list nil | |
366 "If a list of modes to exclusively enable or specifically disable. | |
367 The sense of the list is negated if it begins with the symbol 'not'. | |
368 Set this variable before you load hilit19. | |
369 | |
370 Ex: (perl-mode jargon-mode c-mode) ; just perl, C, and jargon modes | |
371 (not text-mode) ; all modes except text mode") | |
4251 | 372 |
373 ;; Variables that are not generally modified directly | |
374 | |
375 (defvar hilit-parser-alist nil | |
376 "alist of major-mode values and parsers called by hilit-rehighlight-buffer. | |
377 | |
378 Parsers for a given mode are IGNORED for partial rehighlights...maybe you'd | |
379 like to make this more universal?") | |
380 | |
381 (defvar hilit-patterns-alist nil | |
382 "alist of major-mode values and default highlighting patterns | |
383 | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
384 A highlighting pattern is a list of the form (start end face), where |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
385 start is a regex, end is either a regex or a match number for start, and face |
4251 | 386 is the name of an entry in hilit-face-translation-table, the name of a face, |
387 or nil (which disables the pattern). | |
388 | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
389 Each entry in the alist is of the form: |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
390 (mode . (case-fold pattern [pattern ...])) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
391 |
4251 | 392 See the hilit-lookup-face-create documentation for valid face names.") |
393 | |
394 (defvar hilit-predefined-face-list (face-list) | |
4390 | 395 "List of faces with which hilit-lookup-face-create will NOT tamper. |
4251 | 396 |
397 If hilit19 is dumped into emacs at your site, you may have to set this in | |
398 your init file.") | |
399 | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
400 (eval-when-compile (setq byte-optimize t)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
401 |
4251 | 402 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
403 ;; Use this to report bugs: | |
404 | |
4390 | 405 (eval-when-compile (require 'reporter)) ; no compilation gripes |
406 | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
407 (defun hilit-submit-feedback () |
18717
70ed7ba1ed08
(hilit-submit-feedback): Change mail address.
Richard M. Stallman <rms@gnu.org>
parents:
17970
diff
changeset
|
408 "Submit feedback on hilit19 to hilit@hackvan.com" |
4251 | 409 (interactive) |
410 (require 'reporter) | |
411 (and (y-or-n-p "Do you really want to submit a report on hilit19? ") | |
412 (reporter-submit-bug-report | |
18717
70ed7ba1ed08
(hilit-submit-feedback): Change mail address.
Richard M. Stallman <rms@gnu.org>
parents:
17970
diff
changeset
|
413 "Jonathan Stigelman <hilit@hackvan.com>" |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
414 "hilit19.el (Release 2.19)" |
4251 | 415 (and (y-or-n-p "Do you need to include a dump hilit variables? ") |
416 (append | |
417 '( | |
418 hilit-quietly hilit-inhibit-hooks | |
419 hilit-background-mode hilit-mode-enable-list | |
420 hilit-auto-highlight hilit-auto-highlight-maxout | |
421 hilit-auto-rehighlight hilit-auto-rehighlight-fallback | |
422 hilit-face-check | |
423 ) | |
424 (and (y-or-n-p "Have you modified the standard patterns? ") | |
425 (yes-or-no-p "Are your patterns *REALLY* relevant? ") | |
426 '(hilit-parser-alist | |
427 hilit-patterns-alist | |
428 hilit-predefined-face-list | |
429 )))) | |
430 (function | |
431 (lambda () | |
4390 | 432 (and (y-or-n-p "Is this a problem with font display? ") |
433 (insert "\nFrame Configuration:\n====================\n" | |
434 (prin1-to-string (frame-configuration-to-register ?F)) | |
435 "\n" | |
436 )))) | |
4251 | 437 nil |
438 (concat | |
4390 | 439 "This is (check all that apply, and delete what's irrelevant):\n" |
4251 | 440 " [ ] a _MASSIVE_THANK_YOU_ for writing hilit19.el\n" |
4390 | 441 " [ ] An invitation to attend the next Hackers Conference\n" |
4251 | 442 " [ ] You're a RIGHTEOUS HACKER, what are your rates?\n" |
443 " [ ] I've used the force and read the source, but I'M CONFUSED\n" | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
444 " [ ] a PATCH. (output of 'diff -uw old.el new.el' or 'diff -cw')\n" |
13958
a6908f13121e
(hilit-submit-feedback): Fix message spelling.
Karl Heuer <kwzh@gnu.org>
parents:
13400
diff
changeset
|
445 " [ ] a SERIOUS AND REPRODUCIBLE BUG that is not an EMACS bug\n" |
4251 | 446 " - I *swear* that it's not already mentioned in the KNOWN BUGS\n" |
12891
e41d6c7b04ca
(hilit-submit-feedback): New ftp site.
Karl Heuer <kwzh@gnu.org>
parents:
12881
diff
changeset
|
447 " - I HAVE CHECKED ftp.hackvan.com:/pub/stig/src/elisp/hilit19.el.gz\n" |
4251 | 448 " for a newer release that fixes the problem.\n" |
12891
e41d6c7b04ca
(hilit-submit-feedback): New ftp site.
Karl Heuer <kwzh@gnu.org>
parents:
12881
diff
changeset
|
449 " >> I HAVE ALSO CHECKED ftp.hackvan.com:/pub/stig/src/elisp/hl319.el.gz\n" |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
450 " This is the alpha version...what will become hilit19 (Beta 3.0).\n" |
4251 | 451 "\n" |
4390 | 452 "Hey Stig, I *know* you're busy but...\n")))) |
4251 | 453 |
454 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
455 ;; | |
456 ;; These faces are either a valid face name, or nil | |
457 ;; if you want to change them, you must do so AFTER hilit19 is loaded | |
458 | |
4390 | 459 (defconst hilit-default-face-table |
460 '( | |
11035 | 461 ;; used for C/C++ and Emacs Lisp and perl |
4390 | 462 (comment firebrick-italic moccasin italic) |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
463 (include purple Plum1 bold-italic) |
4390 | 464 (define ForestGreen-bold green bold) |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
465 (defun blue-bold cyan-bold bold-italic) |
4390 | 466 (decl RoyalBlue cyan bold) |
467 (type nil yellow nil) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
468 (keyword RoyalBlue cyan bold-italic) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
469 (label red-underline orange-underlined underline) |
4390 | 470 (string grey40 orange underline) |
471 | |
472 ;; some further faces for Ada | |
473 (struct black-bold white-bold bold) | |
474 (glob-struct magenta Plum1 default-bold-underline) | |
475 (named-param DarkGoldenrod Goldenrod underline) | |
4251 | 476 |
13958
a6908f13121e
(hilit-submit-feedback): Fix message spelling.
Karl Heuer <kwzh@gnu.org>
parents:
13400
diff
changeset
|
477 ;; and another one for LaTeX |
4390 | 478 (crossref DarkGoldenrod Goldenrod underline) |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
479 (formula Goldenrod DarkGoldenrod underline) |
4390 | 480 |
481 ;; compilation buffers | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
482 (active-error default/pink-bold default/DeepPink-bold default-underline) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
483 (error red-bold yellow bold) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
484 (warning blue-italic green italic) |
4251 | 485 |
4390 | 486 ;; Makefiles (some faces borrowed from C/C++ too) |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
487 (rule blue-bold-underline cyan-underline default-bold-underline) |
4390 | 488 |
489 ;; VM, GNUS and Text mode | |
490 (msg-subject blue-bold yellow bold) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
491 (msg-from purple-bold green bold) |
4390 | 492 (msg-header firebrick-bold cyan italic) |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
493 (msg-separator black/tan-bold black/lightblue nil) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
494 (msg-quote ForestGreen pink italic) |
4251 | 495 |
4390 | 496 (summary-seen grey40 white nil) |
497 (summary-killed grey50 white nil) | |
498 (summary-Xed OliveDrab2 green nil) | |
499 (summary-deleted firebrick white italic) | |
500 (summary-unread RoyalBlue yellow bold) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
501 (summary-new blue-bold yellow-bold bold-italic) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
502 (summary-current default/skyblue-bold green/dimgrey-bold reverse-default) |
4251 | 503 |
4390 | 504 (gnus-group-unsubscribed grey50 white nil) |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
505 (gnus-group-empty nil nil nil) |
4390 | 506 (gnus-group-full ForestGreen green italic) |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
507 (gnus-group-overflowing firebrick red bold-italic) |
4251 | 508 |
4390 | 509 ;; dired mode |
510 (dired-directory blue-bold cyan bold) | |
511 (dired-link firebrick-italic green italic) | |
512 (dired-ignored ForestGreen moccasin nil) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
513 (dired-deleted red-bold-italic orange bold-italic) |
4390 | 514 (dired-marked purple Plum1 nil) |
515 | |
516 ;; Info-mode, and jargon-mode.el and prep.ai.mit.edu:/pub/gnu/jargon* | |
517 (jargon-entry blue-bold cyan bold) | |
518 (jargon-xref purple-bold Plum1 italic) | |
519 (jargon-keyword firebrick-underline yellow underline) | |
520 ) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
521 "alist of default faces (face . (light-default dark-default mono-default)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
522 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
523 There is no way for the user to modify this table such that it will have any |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
524 effect upon the translations used by hilit19. Instead, use the function |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
525 hilit-translate AFTER hilit19 has been loaded. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
526 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
527 See also the documentation for hilit-lookup-face-create.") |
4251 | 528 |
4390 | 529 (defconst hilit-face-translation-table |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
530 (let ((index (or (and (x-display-color-p) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
531 (cdr (assq hilit-background-mode |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
532 '((light . 1) (dark . 2))))) |
4390 | 533 3))) |
534 (mapcar (function (lambda (x) (cons (car x) (nth index x)))) | |
535 hilit-default-face-table)) | |
536 "alist that maps symbolic face-names to real face names") | |
4251 | 537 |
538 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
539 ;; To translate one face to another... | |
540 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
541 | |
542 (defmacro hilit-translate (&rest args) | |
543 "(hilit-translate FROM TO FROM TO ...): translate each face FROM to the | |
544 value of its TO face. This is like setq for faces. | |
545 | |
546 The function hilit-lookup-face-create will repeatedly translate until no more | |
547 translations for the face exist in the translation table. | |
548 | |
4390 | 549 See the documentation for hilit-lookup-face-create for names of valid faces." |
4251 | 550 (or (zerop (% (length args) 2)) |
551 (error "wrong number of args")) | |
552 (let (cmdl from to) | |
553 (while args | |
554 (setq from (car args) to (nth 1 args) args (nthcdr 2 args) | |
555 cmdl (cons (list 'hilit-associate ''hilit-face-translation-table | |
4390 | 556 (list 'quote from) to) |
4251 | 557 cmdl))) |
558 (cons 'progn cmdl))) | |
559 | |
560 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
561 ;; This function actually translates and then creates the faces... | |
562 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
563 | |
564 (defun hilit-lookup-face-create (face &optional force) | |
565 "Get a FACE, or create it if it doesn't exist. In order for it to | |
13958
a6908f13121e
(hilit-submit-feedback): Fix message spelling.
Karl Heuer <kwzh@gnu.org>
parents:
13400
diff
changeset
|
566 properly create the face, the following naming convention must be used: |
4251 | 567 [reverse-](fgcolor[/bgcolor])[-bold][-italic][-underline] |
568 Example: (hilit-lookup-face-create 'comment-face) might create and return 'red | |
569 | |
570 Each color is either the name of an X color (see .../X11/lib/X11/rgb.txt), | |
571 a hexadecimal specification of the form \"hex-[0-9A-Fa-f]+\", or \"default\". | |
572 | |
573 An optional argument, FORCE, will cause the face to be recopied from the | |
574 default...which is probably of use only if you've changed fonts. | |
575 | |
576 See the documentation for hilit-translate and hilit-face-translation-table." | |
577 | |
578 ;; translate the face ... | |
579 (let ((trec t) visited) | |
580 (while trec | |
581 (cond ((memq face visited) (error "face translation loop: %S" visited)) | |
582 (t (setq visited (cons face visited) | |
583 trec (assq face hilit-face-translation-table)) | |
584 (and trec (setq face (cdr trec))))))) | |
585 | |
586 ;; make the face if we need to... | |
587 (let* ((fn (symbol-name face)) | |
588 (frame (selected-frame)) | |
589 (basefont (cdr (assq 'font (frame-parameters frame)))) | |
590 error fgcolor bgcolor) | |
591 (cond | |
592 ((or (null face) | |
593 (memq face hilit-predefined-face-list)) | |
594 ;; do nothing if the face is nil or if it's predefined. | |
595 ) | |
596 ((or force | |
597 (not (memq face (face-list))) | |
598 (and hilit-face-check | |
599 (not (string= (get face 'basefont) basefont)))) | |
600 (copy-face 'default 'scratch-face) | |
601 (if (string-match "^reverse-?" fn) | |
602 (progn (invert-face 'scratch-face) | |
603 (setq fn (substring fn (match-end 0))))) | |
604 | |
605 ;; parse foreground color | |
606 (if (string-match "^\\(hex-\\)?\\([A-Za-z0-9]+\\)" fn) | |
607 (setq fgcolor (concat | |
608 (if (match-beginning 1) "#") | |
609 (substring fn (match-beginning 2) (match-end 2))) | |
610 fn (substring fn (match-end 0))) | |
611 (error "bad face name %S" face)) | |
612 | |
613 ;; parse background color | |
614 (if (string-match "^/\\(hex-\\)?\\([A-Za-z0-9]+\\)" fn) | |
615 (setq bgcolor (concat | |
616 (and (match-beginning 1) "#") | |
617 (substring fn (match-beginning 2) (match-end 2))) | |
618 fn (substring fn (match-end 0)))) | |
619 | |
620 (and (string= "default" fgcolor) (setq fgcolor nil)) | |
621 (and (string= "default" bgcolor) (setq bgcolor nil)) | |
622 | |
623 ;; catch errors if we can't allocate the color(s) | |
624 (condition-case nil | |
625 (progn (set-face-foreground 'scratch-face fgcolor) | |
626 (set-face-background 'scratch-face bgcolor) | |
627 (copy-face 'scratch-face face) | |
628 (put face 'basefont basefont)) | |
629 (error (message "couldn't allocate color for '%s'" | |
630 (symbol-name face)) | |
631 (setq face 'default) | |
632 (setq error t))) | |
633 (or error | |
634 ;; don't bother w/ bold or italic if we didn't get the color | |
635 ;; we wanted, but ignore errors making the face bold or italic | |
636 ;; if the font isn't available, there's nothing to do about it... | |
637 (progn | |
638 (set-face-font face nil frame) | |
639 (set-face-underline-p face (string-match "underline" fn)) | |
640 (if (string-match ".*bold" fn) | |
7349
c1a962cf4e7a
(hilit-lookup-face-create): Don't put string values into the global face-font
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
641 ;; make face bold in all frames |
c1a962cf4e7a
(hilit-lookup-face-create): Don't put string values into the global face-font
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
642 (make-face-bold face nil 'noerr)) |
4251 | 643 (if (string-match ".*italic" fn) |
7349
c1a962cf4e7a
(hilit-lookup-face-create): Don't put string values into the global face-font
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
644 ;; make face italic in all frames |
c1a962cf4e7a
(hilit-lookup-face-create): Don't put string values into the global face-font
Karl Heuer <kwzh@gnu.org>
parents:
7300
diff
changeset
|
645 (make-face-italic face nil 'noerr)) |
4251 | 646 )) |
647 ))) | |
648 face) | |
649 | |
650 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
651 ;; Region Highlight/Unhighlight code (Both overlay and text-property versions) | |
652 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
653 | |
654 (defsubst hilit-region-set-face (start end face-name &optional prio prop) | |
655 "Highlight region from START to END using FACE and, optionally, PRIO. | |
656 The optional 5th arg, PROP is a property to set instead of 'hilit." | |
657 (let ((overlay (make-overlay start end))) | |
658 (overlay-put overlay 'face face-name) | |
659 (overlay-put overlay (or prop 'hilit) t) | |
660 (and prio (overlay-put overlay 'priority prio)))) | |
661 | |
662 (defun hilit-unhighlight-region (start end &optional quietly) | |
663 "Unhighlights the region from START to END, optionally in a QUIET way" | |
664 (interactive "r") | |
665 (or quietly hilit-quietly (message "Unhighlighting")) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
666 (let ((lstart 0)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
667 (while (and start (> start lstart) (< start end)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
668 (mapcar (function (lambda (ovr) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
669 (and (overlay-get ovr 'hilit) (delete-overlay ovr)))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
670 (overlays-at start)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
671 (setq lstart start start (next-overlay-change start)))) |
4251 | 672 (or quietly hilit-quietly (message "Done unhighlighting"))) |
673 | |
674 ;;;; These functions use text properties instead of overlays. Text properties | |
675 ;;;; are copied through kill and yank...which might be convenient, but is not | |
676 ;;;; terribly efficient as of 19.12, ERGO it's been disabled | |
677 ;; | |
678 ;;(defsubst hilit-region-set-face (start end face-name &optional prio prop) | |
679 ;; "Highlight region from START to END using FACE and, optionally, PRIO. | |
680 ;;The optional 5th arg, PROP is a property to set instead of 'hilit." | |
681 ;; (put-text-property start end 'face face-name) | |
682 ;; ) | |
683 ;; | |
684 ;;(defun hilit-unhighlight-region (start end &optional quietly) | |
685 ;; "Unhighlights the region from START to END, optionally in a QUIET way" | |
686 ;; (interactive "r") | |
687 ;; (let ((buffer-read-only nil) | |
688 ;; (bm (buffer-modified-p))) | |
689 ;; (remove-text-properties start end '(face)) | |
690 ;; (set-buffer-modified-p bm))) | |
691 ;;;; | |
692 | |
693 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
694 ;; Pattern Application code and user functions | |
695 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
696 | |
697 (defun hilit-highlight-region (start end &optional patterns quietly) | |
698 "Highlights the area of the buffer between START and END (the region when | |
699 interactive). Without the optional PATTERNS argument, the pattern for | |
700 major-mode is used. If PATTERNS is a symbol, then the patterns associated | |
701 with that symbol are used. QUIETLY suppresses progress messages if | |
702 non-nil." | |
703 (interactive "r") | |
704 (cond ((null patterns) | |
705 (setq patterns (cdr (assq major-mode hilit-patterns-alist)))) | |
706 ((symbolp patterns) | |
707 (setq patterns (cdr (assq patterns hilit-patterns-alist))))) | |
708 ;; txt prop: (setq patterns (reverse patterns)) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
709 (let ((case-fold-search (car patterns)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
710 (prio (1- (length patterns))) |
4251 | 711 ;; txt prop: (buffer-read-only nil) |
712 ;; txt prop: (bm (buffer-modified-p)) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
713 p pstart pend face mstart (puke-count 0)) |
4251 | 714 ;; txt prop: (unwind-protect |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
715 (setq patterns (cdr patterns)) ; remove case-fold from head of pattern |
4251 | 716 (save-excursion |
717 (save-restriction | |
718 (narrow-to-region start end) | |
719 (while patterns | |
720 (setq p (car patterns)) | |
721 (setq pstart (car p) | |
722 pend (nth 1 p) | |
723 face (hilit-lookup-face-create (nth 2 p))) | |
724 (if (not face) ; skipped if nil | |
725 nil | |
726 (or quietly hilit-quietly | |
727 (message "highlighting %d: %s%s" prio pstart | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
728 (if (stringp pend) (concat " ... " pend) ""))) |
4251 | 729 (goto-char (point-min)) |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
730 (condition-case msg |
4251 | 731 (cond |
732 ((symbolp pstart) | |
733 ;; inner loop -- special function to find pattern | |
734 (let (region) | |
735 (while (setq region (funcall pstart pend)) | |
736 (hilit-region-set-face (car region) (cdr region) | |
737 face prio)))) | |
4390 | 738 ((stringp pend) |
4251 | 739 ;; inner loop -- regex-start ... regex-end |
740 (while (re-search-forward pstart nil t nil) | |
741 (goto-char (setq mstart (match-beginning 0))) | |
742 (if (re-search-forward pend nil t nil) | |
743 (hilit-region-set-face mstart (match-end 0) | |
744 face prio) | |
745 (forward-char 1)))) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
746 ((numberp pend) |
4251 | 747 ;; inner loop -- just one regex to match whole pattern |
748 (while (re-search-forward pstart nil t nil) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
749 (goto-char (match-end pend)) |
4390 | 750 (hilit-region-set-face (match-beginning pend) |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
751 (match-end pend) face prio))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
752 (t (error "malformed pattern"))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
753 (error (if (> (setq puke-count (1+ puke-count)) 1) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
754 (error msg) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
755 (message "Error: '%s'" msg) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
756 (ding) (sit-for 4))))) |
4251 | 757 (setq prio (1- prio) |
758 patterns (cdr patterns))) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
759 )) |
4251 | 760 (or quietly hilit-quietly (message "")) ; "Done highlighting" |
761 ;; txt prop: (set-buffer-modified-p bm)) ; unwind protection | |
762 )) | |
763 | |
764 (defun hilit-rehighlight-region (start end &optional quietly) | |
765 "Re-highlights the region, optionally in a QUIET way" | |
766 (interactive "r") | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
767 (save-restriction |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
768 (widen) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
769 (setq start (apply 'min start (mapcar 'overlay-start (overlays-at start))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
770 end (apply 'max end (mapcar 'overlay-end (overlays-at end)))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
771 (hilit-unhighlight-region start end quietly) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
772 (hilit-highlight-region start end nil quietly))) |
4251 | 773 |
774 (defun hilit-rehighlight-buffer (&optional quietly) | |
775 "Re-highlights the buffer, optionally in a QUIET way" | |
776 (interactive "") | |
777 (let ((parse-fn (cdr (assq major-mode hilit-parser-alist)))) | |
778 (if parse-fn | |
779 (funcall parse-fn quietly) | |
780 (hilit-rehighlight-region (point-min) (point-max) quietly))) | |
781 nil) | |
782 | |
783 (defun hilit-rehighlight-buffer-quietly () | |
784 (hilit-rehighlight-buffer t)) | |
785 | |
786 (defun hilit-rehighlight-message (quietly) | |
787 "Highlight a buffer containing a news article or mail message." | |
788 (save-excursion | |
789 (goto-char (point-min)) | |
17486
b555959aaf3f
(hilit-rehighlight-message): Respect mail-mode header/body separation line.
Richard M. Stallman <rms@gnu.org>
parents:
16427
diff
changeset
|
790 ;; find separation between headers and body (either a blank line or |
b555959aaf3f
(hilit-rehighlight-message): Respect mail-mode header/body separation line.
Richard M. Stallman <rms@gnu.org>
parents:
16427
diff
changeset
|
791 ;; the message separator line in mail-mode) |
b555959aaf3f
(hilit-rehighlight-message): Respect mail-mode header/body separation line.
Richard M. Stallman <rms@gnu.org>
parents:
16427
diff
changeset
|
792 (re-search-forward "^\\(\\|--text follows this line--\\)$" nil 'noerr) |
4251 | 793 (hilit-unhighlight-region (point-min) (point-max) quietly) |
794 (hilit-highlight-region (point-min) (point) 'msg-header quietly) | |
795 (hilit-highlight-region (point) (point-max) 'msg-body quietly))) | |
796 | |
797 (defalias 'hilit-highlight-buffer 'hilit-rehighlight-buffer) | |
798 | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
799 ;; Well, I want to remove this function...there's one sure way to find out if |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
800 ;; anyone uses it or not...and that's to comment it out. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
801 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
802 ;; (defun hilit-toggle-highlight (arg) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
803 ;; "Locally toggle highlighting. With arg, forces highlighting off." |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
804 ;; (interactive "P") |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
805 ;; ;; FIXME -- this loses numeric information in hilit-auto-rehighlight |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
806 ;; (setq hilit-auto-rehighlight |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
807 ;; (and (not arg) (not hilit-auto-rehighlight))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
808 ;; (if hilit-auto-rehighlight |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
809 ;; (hilit-rehighlight-buffer) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
810 ;; (hilit-unhighlight-region (point-min) (point-max))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
811 ;; (message "Rehighlighting is set to %s" hilit-auto-rehighlight)) |
4251 | 812 |
813 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
814 ;; HOOKS | |
815 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
816 | |
817 (defun hilit-find-file-hook () | |
818 "Find-file hook for hilit package. See the variable hilit-auto-highlight." | |
819 (cond ((and hilit-auto-highlight | |
820 (assq major-mode hilit-patterns-alist)) | |
821 (if (> buffer-saved-size (car hilit-auto-rehighlight-fallback)) | |
822 (setq hilit-auto-rehighlight | |
823 (cdr hilit-auto-rehighlight-fallback))) | |
8443
5b87f56b6a6d
(hilit-find-file-hook): Preserve buffer modified state.
Richard M. Stallman <rms@gnu.org>
parents:
8389
diff
changeset
|
824 (if (> buffer-saved-size hilit-auto-highlight-maxout) |
5b87f56b6a6d
(hilit-find-file-hook): Preserve buffer modified state.
Richard M. Stallman <rms@gnu.org>
parents:
8389
diff
changeset
|
825 nil |
5b87f56b6a6d
(hilit-find-file-hook): Preserve buffer modified state.
Richard M. Stallman <rms@gnu.org>
parents:
8389
diff
changeset
|
826 (let ((bm (buffer-modified-p))) |
5b87f56b6a6d
(hilit-find-file-hook): Preserve buffer modified state.
Richard M. Stallman <rms@gnu.org>
parents:
8389
diff
changeset
|
827 (hilit-rehighlight-buffer) |
5b87f56b6a6d
(hilit-find-file-hook): Preserve buffer modified state.
Richard M. Stallman <rms@gnu.org>
parents:
8389
diff
changeset
|
828 (set-buffer-modified-p bm)))))) |
4251 | 829 |
830 (defun hilit-repaint-command (arg) | |
831 "Rehighlights according to the value of hilit-auto-rehighlight, or the | |
832 prefix argument if that is specified. | |
833 \t\\[hilit-repaint-command]\t\trepaint according to hilit-auto-rehighlight | |
834 \t^U \\[hilit-repaint-command]\trepaint entire buffer | |
835 \t^U - \\[hilit-repaint-command]\trepaint visible portion of buffer | |
836 \t^U n \\[hilit-repaint-command]\trepaint n lines to either side of point" | |
837 (interactive "P") | |
838 (let (st en quietly) | |
839 (or arg (setq arg hilit-auto-rehighlight)) | |
840 (cond ((or (eq arg 'visible) (eq arg '-)) | |
841 (setq st (window-start) en (window-end) quietly t)) | |
842 ((numberp arg) | |
843 (setq st (save-excursion (forward-line (- arg)) (point)) | |
844 en (save-excursion (forward-line arg) (point)))) | |
845 (arg | |
846 (hilit-rehighlight-buffer))) | |
847 (if st | |
848 (hilit-rehighlight-region st en quietly)))) | |
849 | |
850 (defun hilit-recenter (arg) | |
851 "Recenter, then rehighlight according to hilit-auto-rehighlight. If called | |
852 with an unspecified prefix argument (^U but no number), then a rehighlight of | |
853 the entire buffer is forced." | |
854 (interactive "P") | |
855 (recenter arg) | |
856 ;; force display update | |
857 (sit-for 0) | |
858 (hilit-repaint-command (consp arg))) | |
859 | |
860 (defun hilit-yank (arg) | |
861 "Yank with rehighlighting" | |
862 (interactive "*P") | |
863 (let ((transient-mark-mode nil)) | |
864 (yank arg) | |
4390 | 865 (and hilit-auto-rehighlight |
866 (hilit-rehighlight-region (region-beginning) (region-end) t)) | |
4251 | 867 (setq this-command 'yank))) |
868 | |
869 (defun hilit-yank-pop (arg) | |
870 "Yank-pop with rehighlighting" | |
871 (interactive "*p") | |
872 (let ((transient-mark-mode nil)) | |
873 (yank-pop arg) | |
4390 | 874 (and hilit-auto-rehighlight |
875 (hilit-rehighlight-region (region-beginning) (region-end) t)) | |
4251 | 876 (setq this-command 'yank))) |
877 | |
878 ;;; this line highlighting stuff is untested. play with it only if you feel | |
879 ;;; adventurous...don't ask me to fix it...though you're welcome to. -- Stig | |
880 ;; | |
881 ;; (defun hilit-rehighlight-line-quietly (&rest args) | |
882 ;; "Quietly rehighlight just this line. | |
883 ;; Useful as an after change hook in VM/gnus summary buffers and dired buffers. | |
884 ;; If only there were an after-change-function, that is..." | |
885 ;; (save-excursion | |
886 ;; (push-mark nil t) | |
887 ;; (hilit-rehighlight-yank-region) | |
888 ;; (and orig-achange-function (apply orig-achange-function args)))) | |
889 ;; | |
890 ;; (defun hilit-install-line-hooks () | |
891 ;; (make-variable-buffer-local 'after-change-function) | |
892 ;; (make-local-variable 'orig-achange-function) | |
893 ;; (setq orig-achange-function after-change-function) | |
894 ;; (setq after-change-function 'hilit-rehighlight-line-quietly)) | |
895 | |
896 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
897 ;; Wysiwyg Stuff... take it away and build a whole package around it! | |
898 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
899 ;; | |
900 ;; ; For the Jargon-impaired, WYSIWYG === What You See Is What You Get | |
901 ;; ; Sure, it sucks to type. Oh, well. | |
902 ;; (defun hilit-wysiwyg-replace () | |
13958
a6908f13121e
(hilit-submit-feedback): Fix message spelling.
Karl Heuer <kwzh@gnu.org>
parents:
13400
diff
changeset
|
903 ;; "Replace overstruck text with normal text that's been overlaid with the |
4251 | 904 ;; appropriate text attribute. Suitable for a find-file hook." |
905 ;; (save-excursion | |
906 ;; (goto-char (point-min)) | |
907 ;; (let ((wysb (hilit-lookup-face-create 'wysiwyg-bold)) | |
908 ;; (wysu (hilit-lookup-face-create 'wysiwyg-underline)) | |
909 ;; (bmod (buffer-modified-p))) | |
910 ;; (while (re-search-forward "\\(.\b.\\)+" nil t) | |
911 ;; (let ((st (match-beginning 0)) (en (match-end 0))) | |
912 ;; (goto-char st) | |
913 ;; (if (looking-at "_") | |
914 ;; (hilit-region-set-face st en wysu 100 'wysiwyg) | |
915 ;; (hilit-region-set-face st en wysb 100 'wysiwyg)) | |
916 ;; (while (and (< (point) en) (looking-at ".\b")) | |
917 ;; (replace-match "") (forward-char)) | |
918 ;; )) | |
919 ;; (set-buffer-modified-p bmod)))) | |
920 ;; | |
921 ;; ; is this more appropriate as a write-file-hook or a write-contents-hook? | |
922 ;; (defun hilit-wysiwyg-write-repair () | |
923 ;; "Replace wysiwyg overlays with overstrike text." | |
924 ;; (message "*sigh* hilit-wysiwyg-write-repair not implemented yet") | |
925 ;; | |
926 ;; For efficiency, this hook should copy the current buffer to a scratch | |
16427 | 927 ;; buffer and do its overstriking there. Overlays are not copied, so it'll |
4251 | 928 ;; be necessary to hop back and forth. This is OK since you're not fiddling |
929 ;; with--making or deleting--any overlays. THEN write the new buffer, | |
930 ;; delete it, and RETURN T. << important | |
931 ;; | |
932 ;; Just so you know...there is already an emacs function called | |
933 ;; underline-region that does underlining. I think that the thing to do is | |
934 ;; extend that to do overstriking as well. | |
935 ;; | |
936 ;; (while (< start end) | |
937 ;; (mapcar (function (lambda (ovr) | |
938 ;; (and (overlay-get ovr 'hilit) (delete-overlay ovr)))) | |
939 ;; (overlays-at start)) | |
940 ;; (setq start (next-overlay-change start))) | |
941 ;; nil) | |
942 | |
943 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
944 ;; Initialization. | |
945 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
946 | |
4390 | 947 (and (not hilit-inhibit-rebinding) |
948 window-system | |
949 (progn | |
950 (substitute-key-definition 'yank 'hilit-yank | |
951 (current-global-map)) | |
952 (substitute-key-definition 'yank-pop 'hilit-yank-pop | |
953 (current-global-map)) | |
954 (substitute-key-definition 'recenter 'hilit-recenter | |
955 (current-global-map)))) | |
4251 | 956 |
957 (global-set-key [?\C-\S-l] 'hilit-repaint-command) | |
958 | |
959 (and window-system | |
960 (add-hook 'find-file-hooks 'hilit-find-file-hook t)) | |
961 | |
4390 | 962 (eval-when-compile (require 'gnus)) ; no compilation gripes |
963 | |
4251 | 964 (and (not hilit-inhibit-hooks) |
965 window-system | |
966 (condition-case c | |
967 (progn | |
968 | |
969 ;; BUFFER highlights... | |
970 (mapcar (function | |
971 (lambda (hook) | |
972 (add-hook hook 'hilit-rehighlight-buffer-quietly))) | |
973 '( | |
4390 | 974 Info-selection-hook |
975 | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
976 ;; runs too early vm-summary-mode-hooks |
4251 | 977 vm-summary-pointer-hook |
4390 | 978 vm-preview-message-hook |
979 vm-show-message-hook | |
980 | |
4251 | 981 rmail-show-message-hook |
982 mail-setup-hook | |
4390 | 983 mh-show-mode-hook |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
984 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
985 dired-after-readin-hook |
4251 | 986 )) |
987 ) | |
988 (error (message "Error loading highlight hooks: %s" c) | |
989 (ding) (sit-for 1)))) | |
990 | |
991 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
992 ;; Default patterns for various modes. | |
993 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
994 | |
995 ;;; do I need this? I changed the defconst to a defvar because defconst is | |
996 ;;; inappropriate, but I don't know why I wanted hilit-patterns-alist to be | |
997 ;;; reset on every reload... | |
998 | |
999 (setq hilit-patterns-alist nil) | |
1000 | |
1001 (defun hilit-associate (alist key val) | |
1002 "creates, or destructively replaces, the pair (key . val) in alist" | |
1003 (let ((oldentry (assq key (eval alist)))) | |
1004 (if oldentry | |
1005 (setcdr oldentry val) | |
1006 (set alist (cons (cons key val) (eval alist)))))) | |
1007 | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1008 (defun hilit-set-mode-patterns (modelist patterns |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1009 &optional parse-fn case-fold) |
4390 | 1010 "Sets the default highlighting patterns for MODE to PATTERNS. |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1011 See the variable hilit-mode-enable-list. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1012 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1013 Takes optional arguments PARSE-FN and CASE-FOLD." |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1014 ;; change pattern |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1015 (mapcar (function (lambda (p) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1016 (and (stringp (car p)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1017 (null (nth 1 p)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1018 (setcar (cdr p) 0)))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1019 patterns) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1020 (setq patterns (cons case-fold patterns)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1021 |
4251 | 1022 (or (consp modelist) (setq modelist (list modelist))) |
1023 (let (ok (flip (eq (car hilit-mode-enable-list) 'not))) | |
1024 (mapcar (function | |
1025 (lambda (m) | |
1026 (setq ok (or (null hilit-mode-enable-list) | |
1027 (memq m hilit-mode-enable-list))) | |
1028 (and flip (setq ok (not ok))) | |
1029 (and ok | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1030 (progn |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1031 (and parse-fn |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1032 (hilit-associate 'hilit-parser-alist m parse-fn)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1033 (hilit-associate 'hilit-patterns-alist m patterns))))) |
4251 | 1034 modelist))) |
1035 | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1036 (defun hilit-add-pattern (pstart pend face &optional mode first) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1037 "Highlight pstart with face for the current major-mode. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1038 Optionally, place the new pattern first in the pattern list" |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1039 (interactive "sPattern start regex: \nsPattern end regex (default none): \nxFace: ") |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1040 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1041 (and (equal pstart "") (error "Must specify starting regex")) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1042 (cond ((equal pend "") (setq pend 0)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1043 ((string-match "^[0-9]+$" pend) (setq pend (string-to-int pend)))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1044 (or mode (setq mode major-mode)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1045 (let ((old-patterns (cdr (assq mode hilit-patterns-alist))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1046 (new-pat (list pstart pend face))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1047 (cond ((not old-patterns) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1048 (hilit-set-mode-patterns mode (list new-pat))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1049 (first |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1050 (setcdr old-patterns (cons new-pat (cdr old-patterns)))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1051 (t |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1052 (nconc old-patterns (list new-pat))))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1053 (and (interactive-p) (hilit-rehighlight-buffer))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1054 |
4251 | 1055 (defun hilit-string-find (qchar) |
1056 "looks for a string and returns (start . end) or NIL. The argument QCHAR | |
1057 is the character that would precede a character constant double quote. | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1058 Finds strings delimited by double quotes. The first double quote may not be |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1059 preceded by QCHAR and the closing double quote may not be preceded by an odd |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1060 number of backslashes." |
4251 | 1061 (let (st en) |
1062 (while (and (search-forward "\"" nil t) | |
1063 (eq qchar (char-after (1- (setq st (match-beginning 0))))))) | |
1064 (while (and (search-forward "\"" nil t) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1065 (save-excursion |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1066 (setq en (point)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1067 (forward-char -1) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1068 (skip-chars-backward "\\\\") |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1069 (forward-char 1) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1070 (not (zerop (% (- en (point)) 2)))))) |
4251 | 1071 (and en (cons st en)))) |
1072 | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1073 ;; return types on same line... |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1074 ;; ("^[a-zA-z].*\\(\\w\\|[$_]\\)+\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1075 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1076 ;; On another note, a working pattern for grabbing function definitions for C is |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1077 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1078 ;; ("^[a-zA-Z_]+.*[;{]$" nil ForestGreen) ; global defns ( start at col 1 ) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1079 ;; ("^[a-zA-Z_]+.*(" ")" defun) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1080 ;; ; defuns assumed to start at col 1, not with # or { |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1081 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1082 ;; this will make external declarations/definitions green, and function |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1083 ;; definitions the defun face. Hmmm - seems to work for me anyway. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1084 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1085 (let ((comments '(("/\\*" "\\*/" comment))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1086 (c++-comments '(("//.*$" nil comment) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1087 ("^/.*$" nil comment))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1088 (strings '((hilit-string-find ?' string))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1089 (preprocessor '(("^#[ \t]*\\(undef\\|define\\).*$" "[^\\]$" define) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1090 ("^#.*$" nil include)))) |
4251 | 1091 |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1092 (hilit-set-mode-patterns |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1093 '(c-mode c++-c-mode elec-c-mode) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1094 (append |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1095 comments strings preprocessor |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1096 '( |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1097 ;; function decls are expected to have types on the previous line |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1098 ("^\\(\\w\\|[$_]\\)+\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1099 ("^\\(typedef\\|struct\\|union\\|enum\\).*$" nil decl) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1100 ;; datatype -- black magic regular expression |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1101 ("[ \n\t({]\\(\\(const\\|register\\|volatile\\|unsigned\\|extern\\|static\\)\\s +\\)*\\(\\(\\w\\|[$_]\\)+_t\\|float\\|double\\|void\\|char\\|short\\|int\\|long\\|FILE\\|\\(\\(struct\\|union\\|enum\\)\\([ \t]+\\(\\w\\|[$_]\\)*\\)\\)\\)\\(\\s +\\*+)?\\|[ \n\t;()]\\)" nil type) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1102 ;; key words |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1103 ("[^_]\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\)\\>[^_]" 1 keyword) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1104 ))) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1105 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1106 (hilit-set-mode-patterns |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1107 'c++-mode |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1108 (append |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1109 comments c++-comments strings preprocessor |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1110 '( |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1111 ;; function decls are expected to have types on the previous line |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1112 ("^\\(\\(\\w\\|[$_]\\)+::\\)?\\(\\w\\|[$_]\\)+\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1113 ("^\\(\\(\\w\\|[$_]\\)+[ \t]*::[ \t]*\\)?\\(\\(\\w\\|[$_]\\)+\\|operator.*\\)\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1114 ("^\\(template\\|typedef\\|struct\\|union\\|class\\|enum\\|public\\|private\\|protected\\).*$" nil decl) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1115 ;; datatype -- black magic regular expression |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1116 ("[ \n\t({]\\(\\(const\\|register\\|volatile\\|unsigned\\|extern\\|static\\)\\s +\\)*\\(\\(\\w\\|[$_]\\)+_t\\|float\\|double\\|void\\|char\\|short\\|int\\|long\\|FILE\\|\\(\\(struct\\|union\\|enum\\|class\\)\\([ \t]+\\(\\w\\|[$_]\\)*\\)\\)\\)\\(\\s +\\*+)?\\|[ \n\t;()]\\)" nil type) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1117 ;; key words |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1118 ("[^_]\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\|public\\|protected\\|private\\|delete\\|new\\)\\>[^_]" |
8389
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1119 1 keyword)))) |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1120 |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1121 (hilit-set-mode-patterns |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1122 '(objc-mode objective-C-mode) |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1123 (append |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1124 comments c++-comments strings preprocessor |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1125 '( |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1126 ;; function decls are expected to have types on the previous line |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1127 ("^\\(\\(\\w\\|[$_]\\)+::\\)?\\(\\w\\|[$_]\\)+\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1128 ("^\\(\\(\\w\\|[$_]\\)+[ \t]*::[ \t]*\\)?\\(\\(\\w\\|[$_]\\)+\\|operator.*\\)\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1129 |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1130 ("^\\(template\\|typedef\\|struct\\|union\\|class\\|enum\\|public\\|private\\|protected\\).*$" nil decl) |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1131 ;; datatype -- black magic regular expression |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1132 ("[ \n\t({]\\(\\(const\\|register\\|volatile\\|unsigned\\|extern\\|static\\)\\s +\\)*\\(\\(\\w\\|[$_]\\)+_t\\|float\\|double\\|void\\|char\\|short\\|int\\|long\\|FILE\\|\\(\\(struct\\|union\\|enum\\|class\\)\\([ \t]+\\(\\w\\|[$_]\\)*\\)\\)\\)\\(\\s +\\*+)?\\|[ \n\t;()]\\)" nil type) |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1133 ;; key words |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1134 ("[^_]\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\|public\\|protected\\|private\\|interface\\|implementation\\|end\\|super\\|self\\)\\>[^_]" |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1135 1 keyword)))) |
298183d131b1
Specify patterns for objc-mode.
Richard M. Stallman <rms@gnu.org>
parents:
7349
diff
changeset
|
1136 ) |
4251 | 1137 |
1138 (hilit-set-mode-patterns | |
1139 'perl-mode | |
1140 '(("\\s #.*$" nil comment) | |
1141 ("^#.*$" nil comment) | |
1142 ("\"[^\\\"]*\\(\\\\\\(.\\|\n\\)[^\\\"]*\\)*\"" nil string) | |
1143 ("^\\(__....?__\\|\\s *\\sw+:\\)" nil label) | |
1144 ("^require.*$" nil include) | |
1145 ("^package.*$" nil decl) | |
1146 ("^\\s *sub\\s +\\(\\w\\|[_']\\)+" nil defun) | |
1147 ("\\b\\(do\\|if\\|unless\\|while\\|until\\|else\\|elsif\\|for\\|foreach\\|continue\\|next\\|redo\\|last\\|goto\\|return\\|die\\|exit\\)\\b" nil keyword))) | |
1148 | |
1149 (hilit-set-mode-patterns | |
1150 'ada-mode | |
1151 '(;; comments | |
1152 ("--.*$" nil comment) | |
1153 ;; main structure | |
1154 ("[ \t\n]procedure[ \t]" "\\([ \t]\\(is\\|renames\\)\\|);\\)" glob-struct) | |
1155 ("[ \t\n]task[ \t]" "[ \t]is" glob-struct) | |
1156 ("[ \t\n]function[ \t]" "return[ \t]+[A-Za-z_0-9]+[ \t]*\\(is\\|;\\|renames\\)" glob-struct) | |
1157 ("[ \t\n]package[ \t]" "[ \t]\\(is\\|renames\\)" glob-struct) | |
1158 ;; if there is nothing before "private", it is part of the structure | |
1159 ("^[ \t]*private[ \t\n]" nil glob-struct) | |
1160 ;; if there is no indentation before the "end", then it is most | |
1161 ;; probably the end of the package | |
1162 ("^end.*$" ";" glob-struct) | |
1163 ;; program structure -- "null", "delay" and "terminate" omitted | |
1164 ("[ \n\t]\\(in\\|out\\|select\\|if\\|else\\|case\\|when\\|and\\|or\\|not\\|accept\\|loop\\|do\\|then\\|elsif\\|else\\|for\\|while\\|exit\\)[ \n\t;]" nil struct) | |
1165 ;; block structure | |
1166 ("[ \n\t]\\(begin\\|end\\|declare\\|exception\\|generic\\|raise\\|return\\|package\\|body\\)[ \n\t;]" nil struct) | |
1167 ;; type declaration | |
1168 ("^[ \t]*\\(type\\|subtype\\).*$" ";" decl) | |
1169 ("[ \t]+is record.*$" "end record;" decl) | |
1170 ;; "pragma", "with", and "use" are close to C cpp directives | |
1171 ("^[ \t]*\\(with\\|pragma\\|use\\)" ";" include) | |
1172 ;; nice for named parameters, but not so beautiful in case statements | |
1173 ("[A-Za-z_0-9.]+[ \t]*=>" nil named-param) | |
1174 ;; string constants probably not everybody likes this one | |
1175 ("\"" ".*\"" string))) | |
1176 | |
1177 (hilit-set-mode-patterns | |
1178 'fortran-mode | |
1179 '(("^[*Cc].*$" nil comment) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1180 ("'[^'\n]*'" nil string) |
4251 | 1181 ("\\(^[ \t]*[0-9]+\\|[ \t]continue[ \t\n]\\|format\\)" nil define) |
1182 ("[ \t]\\(do\\|do[ \t]*[0-9]+\\|go[ \t]*to[ \t]*[0-9]+\\|end[ \t]*do\\|if\\|else[ \t]*if\\|then\\|else\\|end[ \t]*if\\)[ \t\n(]" nil define) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1183 ("[ \t]\\(call\\|program\\|subroutine\\|function\\|stop\\|return\\|end\\|include\\)[ \t\n]" nil include) |
4251 | 1184 ("[ \t]\\(parameter[\t\n ]*([^)]*)\\|data\\|save\\|common[ \t\n]*/[^/]*/\\)" |
1185 nil decl) | |
1186 ("^ ." nil type) | |
1187 ("implicit[ \t]*none" nil decl) | |
1188 ("\\([ \t]\\|implicit[ \t]*\\)\\(dimension\\|integer\\|real\\|double[ \t]*precision\\|character\\|logical\\|complex\\|double[ \t]*complex\\)\\([*][0-9]*\\|[ \t\n]\\)" nil keyword) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1189 ) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1190 nil 'case-insensitive) |
4251 | 1191 |
1192 (hilit-set-mode-patterns | |
1193 '(m2-mode modula-2-mode) | |
1194 '(("(\\*" "\\*)" comment) | |
1195 (hilit-string-find ?\\ string) | |
1196 ("^[ \t]*PROCEDURE[ \t]+\\w+[^ \t(;]*" nil defun) | |
1197 ("\\<\\(RECORD\\|ARRAY\\|OF\\|POINTER\\|TO\\|BEGIN\\|END\\|FOR\\|IF\\|THEN\\|ELSE\\|ELSIF\\|CASE\\|WHILE\\|DO\\|MODULE\\|FROM\\|RETURN\\|IMPORT\\|EXPORT\\|VAR\\|LOOP\\|UNTIL\\|\\DEFINITION\\|IMPLEMENTATION\\|AND\\|OR\\|NOT\\|CONST\\|TYPE\\|QUALIFIED\\)\\>" nil keyword) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1198 ) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1199 nil 'case-insensitive) |
4251 | 1200 |
1201 (hilit-set-mode-patterns 'prolog-mode | |
1202 '(("/\\*" "\\*/" comment) | |
1203 ("%.*$" nil comment) | |
1204 (":-" nil defun) | |
1205 ("!" nil label) | |
1206 ("\"[^\\\"]*\\(\\\\\\(.\\|\n\\)[^\\\"]*\\)*\"" nil string) | |
1207 ("\\b\\(is\\|mod\\)\\b" nil keyword) | |
1208 ("\\(->\\|-->\\|;\\|==\\|\\\\==\\|=<\\|>=\\|<\\|>\\|=\\|\\\\=\\|=:=\\|=\\\.\\\.\\|\\\\\\\+\\)" nil decl) | |
1209 ("\\(\\\[\\||\\|\\\]\\)" nil include))) | |
1210 | |
1211 (hilit-set-mode-patterns | |
1212 '( | |
1213 LaTeX-mode japanese-LaTeX-mode SliTeX-mode | |
1214 japanese-SliTeX-mode FoilTeX-mode latex-mode | |
1215 ) | |
1216 '( | |
1217 ;; comments | |
1218 ("[^\\]%.*$" nil comment) | |
1219 | |
1220 ;; the following two match \foo[xx]{xx} or \foo*{xx} or \foo{xx} | |
1221 ("\\\\\\(sub\\)*\\(paragraph\\|section\\)\\(\*\\|\\[.*\\]\\)?{" "}" | |
1222 keyword) | |
1223 ("\\\\\\(chapter\\|part\\)\\(\*\\|\\[.*\\]\\)?{" "}" keyword) | |
1224 ("\\\\footnote\\(mark\\|text\\)?{" "}" keyword) | |
1225 ("\\\\[a-z]+box" nil keyword) | |
1226 ("\\\\\\(v\\|h\\)space\\(\*\\)?{" "}" keyword) | |
1227 | |
1228 ;; (re-)define new commands/environments/counters | |
1229 ("\\\\\\(re\\)?new\\(environment\\|command\\){" "}" defun) | |
1230 ("\\\\new\\(length\\|theorem\\|counter\\){" "}" defun) | |
1231 | |
1232 ;; various declarations/definitions | |
1233 ("\\\\\\(setlength\\|settowidth\\|addtolength\\|setcounter\\|addtocounter\\)" nil define) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1234 ("\\\\\\(title\\|author\\|date\\|thanks\\){" "}" define) |
4251 | 1235 |
1236 ("\\\\documentstyle\\(\\[.*\\]\\)?{" "}" decl) | |
1237 ("\\\\\\(begin\\|end\\|nofiles\\|includeonly\\){" "}" decl) | |
1238 ("\\\\\\(raggedright\\|makeindex\\|makeglossary\\|maketitle\\)\\b" nil | |
1239 decl) | |
1240 ("\\\\\\(pagestyle\\|thispagestyle\\|pagenumbering\\){" "}" decl) | |
1241 ("\\\\\\(normalsize\\|small\\|footnotesize\\|scriptsize\\|tiny\\|large\\|Large\\|LARGE\\|huge\\|Huge\\)\\b" nil decl) | |
1242 ("\\\\\\(appendix\\|tableofcontents\\|listoffigures\\|listoftables\\)\\b" | |
1243 nil decl) | |
1244 ("\\\\\\(bf\\|em\\|it\\|rm\\|sf\\|sl\\|ss\\|tt\\)\\b" nil decl) | |
1245 | |
1246 ;; label-like things | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1247 ("\\\\item\\(\\[[^]]*\\]\\)?" nil label) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1248 ("\\\\caption\\(\\[[^]]*\\]\\)?{" "}" label) |
4251 | 1249 |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1250 ;; formulas |
6364
59663885e8c7
(LaTeX patterns): Don't match \( and \[ following a \.
Richard M. Stallman <rms@gnu.org>
parents:
4739
diff
changeset
|
1251 ("[^\\]\\\\(" "\\\\)" formula) ; \( \) |
59663885e8c7
(LaTeX patterns): Don't match \( and \[ following a \.
Richard M. Stallman <rms@gnu.org>
parents:
4739
diff
changeset
|
1252 ("[^\\]\\\\\\[" "\\\\\\]" formula) ; \[ \] |
15469
c34d5f499094
(LaTeX-mode): Change handling of escaped $.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
1253 ("[^\\$]\\(\\$\\(\\$[^$]*\\$\\|[^$]*\\)\\$\\)" 1 formula) ; '$...$' or '$$...$$' |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1254 |
4251 | 1255 ;; things that bring in external files |
1256 ("\\\\\\(include\\|input\\|bibliography\\){" "}" include) | |
1257 | |
4390 | 1258 ;; "wysiwyg" emphasis -- these don't work with nested expressions |
1259 ;; ("{\\\\\\(em\\|it\\|sl\\)" "}" italic) | |
1260 ;; ("{\\\\bf" "}" bold) | |
4251 | 1261 |
1262 ("``" "''" string) | |
1263 | |
1264 ;; things that do some sort of cross-reference | |
1265 ("\\\\\\(\\(no\\)?cite\\|\\(page\\)?ref\\|label\\|index\\|glossary\\){" "}" crossref) | |
1266 )) | |
1267 | |
1268 (hilit-set-mode-patterns | |
1269 'bibtex-mode | |
1270 '(;;(";.*$" nil comment) | |
1271 ("%.*$" nil comment) | |
1272 ("@[a-zA-Z]+" nil keyword) | |
1273 ("{[ \t]*[-a-z:_A-Z0-9]+," nil label) ; is wrong sometimes | |
1274 ("^[ \t]*[a-zA-Z]+[ \t]*=" nil define))) | |
1275 | |
1276 (hilit-set-mode-patterns | |
1277 'compilation-mode | |
4390 | 1278 '( |
1279 ("^[-_.\"A-Za-z0-9]+\\(:\\|, line \\)[0-9]+: warning:.*$" nil warning) | |
1280 ("^[-_.\"A-Za-z0-9]+\\(:\\|, line \\)[0-9]+:.*$" nil error) | |
1281 )) | |
4251 | 1282 |
1283 (hilit-set-mode-patterns | |
1284 'makefile-mode | |
1285 '(("^#.*$" nil comment) | |
1286 ("[^$]#.*$" nil comment) | |
1287 ;; rules | |
4390 | 1288 ("^[^ \t\n]*%[^ \t\n]*[ \t]*::?[ \t]*[^ \t\n]*[ \t]*\\(#.*\\)?$" nil rule) |
4251 | 1289 ("^[.][A-Za-z][A-Za-z]?\..*$" nil rule) |
1290 ;; variable definition | |
4390 | 1291 ("^[_A-Za-z0-9]+[ \t]*\+?=" nil define) |
1292 ("\\( \\|:=\\)[_A-Za-z0-9]+[ \t]*\\+=" nil define) | |
4251 | 1293 ;; variable references |
4390 | 1294 ("\\$\\([^ \t\n{(]\\|[{(]@?[_A-Za-z0-9:.,%/=]+[)}]\\)" nil keyword) |
1295 ("^[A-Za-z0-9.,/_-]+[ \t]*:.*$" nil defun) | |
4251 | 1296 ("^include " nil include))) |
1297 | |
1298 (let* ((header-patterns '(("^Subject:.*$" nil msg-subject) | |
1299 ("^From:.*$" nil msg-from) | |
1300 ("^--text follows this line--$" nil msg-separator) | |
1301 ("^[A-Za-z][A-Za-z0-9-]+:" nil msg-header))) | |
4390 | 1302 (body-patterns '(("^\\(In article\\|[ \t]*\\w*[]<>}|]\\).*$" |
4251 | 1303 nil msg-quote))) |
1304 (message-patterns (append header-patterns body-patterns))) | |
1305 (hilit-set-mode-patterns 'msg-header header-patterns) | |
1306 (hilit-set-mode-patterns 'msg-body body-patterns) | |
4390 | 1307 (hilit-set-mode-patterns '(vm-mode text-mode mail-mode rmail-mode |
1308 gnus-article-mode news-reply-mode mh-show-mode) | |
1309 message-patterns | |
1310 'hilit-rehighlight-message)) | |
4251 | 1311 |
1312 (hilit-set-mode-patterns | |
1313 'gnus-group-mode | |
13400 | 1314 '(("^ U.*$" nil gnus-group-unsubscribed) |
1315 ("^\\*? +[01]?[0-9]:.*$" nil gnus-group-empty) | |
4251 | 1316 ("^ +[2-9][0-9]:.*$" nil gnus-group-full) |
1317 ("^ +[0-9][0-9][0-9]+:.*$" nil gnus-group-overflowing))) | |
1318 | |
1319 (hilit-set-mode-patterns | |
1320 'vm-summary-mode | |
1321 '(("^ .*$" nil summary-seen) | |
1322 ("^->.*$" nil summary-current) | |
1323 ("^ D.*$" nil summary-deleted) | |
1324 ("^ U.*$" nil summary-unread) | |
1325 ("^ N.*$" nil summary-new))) | |
1326 | |
1327 | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1328 ;;; this will match only comments w/ an even (zero is even) number of quotes... |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1329 ;;; which is still inadequate because it matches comments in multi-line strings |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1330 ;;; how anal do you want to get about never highlighting comments in strings? |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1331 ;;; I could twiddle with this forever and still it wouldn't be perfect. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1332 ;;; (";\\([^\"\n]*\"[^\"\n]*\"\\)*[^\"\n]*$" nil comment) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1333 |
4251 | 1334 (hilit-set-mode-patterns |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1335 '(emacs-lisp-mode lisp-interaction-mode) |
4251 | 1336 '( |
1337 (";.*" nil comment) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1338 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1339 ;;; This almost works...but I think I'll stick with the parser function |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1340 ;;;("[^?]\\(\"\\(\"\\||\\([^\"]+\\|[\\]\\([\\][\\]\\)*\"\\)*\"\\)\\)" 1 string) |
4251 | 1341 (hilit-string-find ?\\ string) |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1342 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1343 ("^\\s *(def\\(un\\|macro\\|advice\\|alias\\|subst\\)[ \t\n]" |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1344 "\\()\\|nil\\)" defun) |
4251 | 1345 ("^\\s *(defvar\\s +\\S +" nil decl) |
1346 ("^\\s *(defconst\\s +\\S +" nil define) | |
1347 ("^\\s *(\\(provide\\|require\\|\\(auto\\)?load\\).*$" nil include) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1348 ("\\s *\\&\\(rest\\|optional\\)\\s *" nil keyword) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1349 ("(\\(let\\*?\\|cond\\|if\\|or\\|and\\|map\\(car\\|concat\\)\\|prog[n1*]?\\|while\\|lambda\\|function\\|set\\([qf]\\|car\\|cdr\\)?\\|nconc\\|eval-when-compile\\|condition-case\\|unwind-protect\\|catch\\|throw\\|error\\)[ \t\n]" 1 keyword) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1350 )) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1351 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1352 (hilit-set-mode-patterns |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1353 '(lisp-mode ilisp-mode) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1354 '( |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1355 (";.*" nil comment) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1356 ("#|" "|#" comment) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1357 ;;; This almost works...but I think I'll stick with the parser function |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1358 ;;;("[^?]\\(\"\\(\"\\||\\([^\"]+\\|[\\]\\([\\][\\]\\)*\"\\)*\"\\)\\)" 1 string) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1359 (hilit-string-find ?\\ string) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1360 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1361 ;; this is waaaaaaaay too slow |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1362 ;; ("^\\s *(def\\(un\\|macro\\|advice\\|alias\\|method\\|subst\\)\\s \\S +[ \t\n]+\\(nil\\|(\\(([^()]*)\\|[^()]+\\)*)\\)" nil defun) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1363 ("^\\s *(def\\(un\\|macro\\|advice\\|subst\\|method\\)\\s " "\\()\\|nil\\)" defun) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1364 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1365 ("^\\s *(\\(def\\(var\\|type\\|parameter\\)\\|declare\\)\\s +\\S +" nil decl) |
9522
f26cd3c14187
(hilit-set-mode-patterns - lisp-mode): Fix regexp
Richard M. Stallman <rms@gnu.org>
parents:
8443
diff
changeset
|
1366 ("^\\s *(def\\(const\\(ant\\)?\\|class\\|struct\\)\\s \\S +[ \t\n]+" nil define) |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1367 ("^\\s *(\\(provide\\|require\\|\\(auto\\)?load\\).*$" nil include) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1368 ("[ \t]\\&\\(key\\|rest\\|optional\\|aux\\)\\s *" nil keyword) |
9522
f26cd3c14187
(hilit-set-mode-patterns - lisp-mode): Fix regexp
Richard M. Stallman <rms@gnu.org>
parents:
8443
diff
changeset
|
1369 ("(\\(let\\*?\\|locally\\|cond\\|if\\*?\\|or\\|and\\|map\\(car\\|c[ao]n\\)?\\|prog[nv1*]?\\|while\\|when\\|unless\\|do\\(\\*\\|list\\|times\\)\\|list\\|lambda\\|function\\|values\\|set\\([qf]\\|car\\|cdr\\)?\\|rplac[ad]\\|nconc\\|block\\|go\\|return\\(-from\\)?\\|[ec]?\\(type\\)?case\\|multiple-value-\\(bind\\|setq\\|list\\|call\\|prog1\\)\\|unwind-protect\\|handler-case\\|catch\\|throw\\|eval-when\\(-compile\\)?\\)[ \t\n]" 1 keyword) |
4251 | 1370 )) |
1371 | |
1372 | |
1373 (hilit-set-mode-patterns | |
1374 'plain-tex-mode | |
1375 '(("^%%.*$" nil comment) | |
1376 ("{\\\\em\\([^}]+\\)}" nil comment) | |
1377 ("\\(\\\\\\w+\\)" nil keyword) | |
1378 ("{\\\\bf\\([^}]+\\)}" nil keyword) | |
1379 ("^[ \t\n]*\\\\def[\\\\@]\\(\\w+\\)" nil defun) | |
1380 ("\\\\\\(begin\\|end\\){\\([A-Za-z0-9\\*]+\\)}" nil defun) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1381 ;; ("[^\\\\]\\$\\([^$]*\\)\\$" nil string) |
4251 | 1382 ("\\$\\([^$]*\\)\\$" nil string) |
1383 )) | |
1384 | |
1385 ;; Reasonable extensions would include smarter parameter handling for such | |
1386 ;; things as the .IX and .I macros, which alternate the handling of following | |
1387 ;; arguments. | |
1388 | |
1389 (hilit-set-mode-patterns | |
1390 'nroff-mode | |
1391 '(("^\\.[\\\][\\\"].*$" nil comment) | |
1392 ("^\\.so .*$" nil include) | |
1393 ("^\\.[ST]H.*$" nil defun) | |
1394 ;; ("^[^\\.].*\"[^\\\"]*\\(\\\\\\(.\\)[^\\\"]*\\)*\"" nil string) | |
1395 ("\"" "[^\\]\"" string) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1396 ("^\\.[A-Z12\\\\].*$" nil define) |
4251 | 1397 ("\\([\\\][^ ]*\\)" nil keyword) |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1398 ("^\\.[A-Z].*$" nil keyword)) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1399 nil 'case-insensitive) |
4251 | 1400 |
1401 (hilit-set-mode-patterns | |
1402 'texinfo-mode | |
1403 '(("^\\(@c\\|@comment\\)\\>.*$" nil comment) | |
1404 ("@\\(emph\\|strong\\|b\\|i\\){[^}]+}" nil comment) | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1405 ;; seems broken |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1406 ;; ("\\$[^$]*\\$" nil string) |
4251 | 1407 ("@\\(file\\|kbd\\|key\\){[^}]+}" nil string) |
1408 ("^\\*.*$" nil defun) | |
1409 ("@\\(if\\w+\\|format\\|item\\)\\b.*$" nil defun) | |
1410 ("@end +[A-Za-z0-9]+[ \t]*$" nil defun) | |
1411 ("@\\(samp\\|code\\|var\\){[^}]+}" nil defun) | |
1412 ("@\\w+\\({[^}]+}\\)?" nil keyword) | |
1413 )) | |
1414 | |
1415 (hilit-set-mode-patterns | |
1416 'dired-mode | |
1417 (append | |
1418 '(("^D.*$" nil dired-deleted) | |
1419 ("^\\*.*$" nil dired-marked) | |
1420 ("^ d.*$" nil dired-directory) | |
1421 ("^ l.*$" nil dired-link) | |
1422 ("^ -.*#.*#$" nil dired-ignored)) | |
1423 (list (cons | |
1424 (concat "^ .*\\(" | |
1425 (mapconcat 'regexp-quote completion-ignored-extensions "\\|") | |
1426 "\\)$") | |
1427 '(nil dired-ignored))))) | |
1428 | |
1429 (hilit-set-mode-patterns | |
1430 'jargon-mode | |
1431 '(("^:[^:]*:" nil jargon-entry) | |
1432 ("{[^}]*}+" nil jargon-xref))) | |
1433 | |
1434 (hilit-set-mode-patterns | |
1435 'Info-mode | |
1436 '(("^\\* [^:]+:+" nil jargon-entry) | |
1437 ("\\*[Nn]ote\\b[^:]+:+" nil jargon-xref) | |
1438 (" \\(Next\\|Prev\\|Up\\):" nil jargon-xref) | |
1439 ("- \\(Variable\\|Function\\|Macro\\|Command\\|Special Form\\|User Option\\):.*$" | |
1440 nil jargon-keyword))) ; lisp manual | |
1441 | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1442 (hilit-set-mode-patterns |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1443 'calendar-mode |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1444 '(("[A-Z][a-z]+ [0-9]+" nil define) ; month and year |
9522
f26cd3c14187
(hilit-set-mode-patterns - lisp-mode): Fix regexp
Richard M. Stallman <rms@gnu.org>
parents:
8443
diff
changeset
|
1445 ("S M Tu W Th F S" nil label))) ; week days |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1446 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1447 (hilit-set-mode-patterns |
10133 | 1448 'asm-mode |
1449 '(("/\\*" "\\*/" comment) | |
1450 ("^#[ \t]*\\(undef\\|define\\).*$" "[^\\]$" define) | |
1451 ("^#.*$" nil include) | |
1452 ;; labels | |
1453 ("^.+:" nil defun) | |
1454 ;; assembler directives | |
1455 ("^[ \t]*\\..*$" nil decl) | |
1456 ;; register names | |
1457 ("\\$[a-z0-9]+" nil string) | |
1458 ;; mnemonics | |
1459 ("^[ \t]*[a-z]+" nil struct))) | |
1460 | |
1461 (hilit-set-mode-patterns | |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1462 'pascal-mode |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1463 '(("(\\*" "\\*)" comment) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1464 ("{" "}" comment) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1465 ;; Doesn't work when there are strings in comments.... |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1466 ;; ("'[^']*'" nil string) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1467 ("^#.*$" nil include) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1468 ("^[ \t]*\\(procedure\\|function\\)[ \t]+\\w+[^ \t(;]*" nil defun) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1469 ("\\<\\(program\\|begin\\|end\\)\\>" nil defun) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1470 ("\\<\\(external\\|forward\\)\\>" nil include) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1471 ("\\<\\(label\\|const\\|type\\|var\\)\\>" nil define) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1472 ("\\<\\(record\\|array\\|file\\)\\>" nil type) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1473 ("\\<\\(of\\|to\\|for\\|if\\|then\\|else\\|case\\|while\\|do\\|until\\|and\\|or\\|not\\|with\\|repeat\\)\\>" nil keyword) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1474 ) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1475 nil 'case-insensitive) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1476 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1477 (hilit-set-mode-patterns |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1478 'icon-mode |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1479 '(("#.*$" nil comment) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1480 ("\"[^\\\"]*\\(\\\\.[^\\\"]*\\)*\"" nil string) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1481 ;; charsets: these do not work because of a conflict with strings |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1482 ;; ("'[^\\']*\\(\\\\.[^\\']*\\)*'" nil string) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1483 ("^[ \t]*procedure[ \t]+\\w+[ \t]*(" ")" defun) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1484 ("^[ \t]*record.*(" ")" include) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1485 ("^[ \t]*\\(global\\|link\\)[ \t\n]+[A-Za-z_0-9]+\\([ \t\n]*,[ \t\n]*[A-Za-z_0-9]+\\)*" nil include) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1486 ("^[ \t]*\\(local\\|static\\)[ \t\n]+[A-Za-z_0-9]+\\([ \t\n]*,[ \t\n]*[A-Za-z_0-9]+\\)*" nil decl) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1487 ("\\<\\(initial\\|end\\)\\>" nil glob-struct) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1488 ("\\<\\(while\\|until\\|return\\|every\\|if\\|then\\|else\\|to\\|case\\|of\\|suspend\\|create\\|do\\|repeat\\|break\\)\\>" nil keyword) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1489 )) |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1490 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1491 ;; as you can see, I had two similar problems for Pascal and Icon. In |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1492 ;; Pascal, strings are delimited with ' and an embedded quote is doubled, |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1493 ;; thus string syntax would be extremely simple. However, if a string |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1494 ;; occurs within a comment, the following text is considered a string. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1495 ;; |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1496 ;; In Icon, strings are similar to C ones, but there are also charsets, |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1497 ;; delimited with simple quotes. I could not manage to use both regexps at |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1498 ;; the same time. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1499 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1500 ;; The problem I have with my patterns for Icon is that this language has a |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1501 ;; string similar constant to the C one (but a string can be cut on several |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1502 ;; lines, if terminated by a dash and continued with initial blanks, like |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1503 ;; this: |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1504 ;; "This is a somewhat long - |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1505 ;; string, written on three - |
13958
a6908f13121e
(hilit-submit-feedback): Fix message spelling.
Karl Heuer <kwzh@gnu.org>
parents:
13400
diff
changeset
|
1506 ;; successive lines" |
4739
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1507 ;; in order to insert a double quote in a string, you have to escape it |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1508 ;; with a \), bu also a character set constant (named a charset), which |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1509 ;; uses single quotes instead of double ones. It would seem intuitive to |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1510 ;; highlight both constants in the same way. |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1511 |
e248ce46bca8
- (hilit-rehighlight-region): added (save-restriction (widen))
Richard M. Stallman <rms@gnu.org>
parents:
4390
diff
changeset
|
1512 |
4251 | 1513 (provide 'hilit19) |
1514 | |
1515 ;;; hilit19 ends here. |