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