annotate lisp/hilit19.el @ 18690:df8ab82c73f3

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