diff options
| author | Richard M. Stallman | 1993-08-01 06:26:18 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-08-01 06:26:18 +0000 |
| commit | 280a6a9f189e512c3de4e22ed146b4f4701d6765 (patch) | |
| tree | d5472c27e8e7363c5d23d85d62b8202f8c5d085e | |
| parent | cf3623c64c2288f344416115c3ebf0a2bb7c7106 (diff) | |
| download | emacs-280a6a9f189e512c3de4e22ed146b4f4701d6765.tar.gz emacs-280a6a9f189e512c3de4e22ed146b4f4701d6765.zip | |
Version 2.7 from stig.
| -rw-r--r-- | lisp/hilit19.el | 689 |
1 files changed, 268 insertions, 421 deletions
diff --git a/lisp/hilit19.el b/lisp/hilit19.el index f4187154323..960fdafd98b 100644 --- a/lisp/hilit19.el +++ b/lisp/hilit19.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;; hilit19.el, Beta 1.9 -- customizable highlighting for Emacs19. | 1 | ;; hilit19.el (Release 2.7) -- customizable highlighting for Emacs19. |
| 2 | ;; Copyright (c) 1993 Free Software Foundation, Inc. | 2 | ;; Copyright (c) 1993 Free Software Foundation, Inc. |
| 3 | ;; | 3 | ;; |
| 4 | ;; Author: Jonathan Stigelman <Stig@netcom.com> | 4 | ;; Author: Jonathan Stigelman <Stig@netcom.com> |
| 5 | ;; Keywords: faces | 5 | ;; Keywords: faces |
| 6 | ;; | 6 | ;; |
| 7 | ;; This program is free software; you can redistribute it and/or modify | 7 | ;; This program is free software; you can redistribute it and/or modify |
| @@ -21,13 +21,15 @@ | |||
| 21 | 21 | ||
| 22 | ;;; Commentary: | 22 | ;;; Commentary: |
| 23 | 23 | ||
| 24 | ;; hilit19.el, Beta 1.9 -- customizable highlighting for Emacs19. | 24 | ;; Hilit19.el is a customizable highlighting package for Emacs19. It supports |
| 25 | ;; Supports not only source code highlighting, but also rmail, VM, and gnus. | 25 | ;; not only source code highlighting, but also Info, RMAIL, VM, gnus... |
| 26 | 26 | ;; Hilit19 knows (or thinks it knows) how to highlight emacs buffers in | |
| 27 | ;; WHERE TO GET THE LATEST VERSION OF HILIT19.EL (possibly beta), | 27 | ;; about 25 different modes. |
| 28 | ;; | ||
| 29 | ;; WHERE TO GET THE LATEST VERSIONS OF HILIT19.EL (beta and release), | ||
| 28 | ;; PLUS LOTS OF OTHER *WAY COOL* STUFF VIA ANONYMOUS FTP: | 30 | ;; PLUS LOTS OF OTHER *WAY COOL* STUFF VIA ANONYMOUS FTP: |
| 29 | ;; | 31 | ;; |
| 30 | ;; netcom.com:/pub/stig/src/hilit19.el.gz | 32 | ;; netcom.com:/pub/stig/src/{Beta,Release}/hilit19.el.gz |
| 31 | ;; | 33 | ;; |
| 32 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 34 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 33 | ;; | 35 | ;; |
| @@ -37,15 +39,12 @@ | |||
| 37 | ;; | 39 | ;; |
| 38 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 40 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 39 | ;; | 41 | ;; |
| 40 | 42 | ;; hilit19.el,v 2.7 1993/07/30 02:43:01 stig Release | |
| 41 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 42 | ;; | ||
| 43 | ;; $Id: hilit19.el,v 1.34 1993/07/23 05:18:37 stig Exp stig $ | ||
| 44 | ;; | 43 | ;; |
| 45 | ;; LCD Archive Entry: | 44 | ;; LCD Archive Entry: |
| 46 | ;; emacs19/hilit19.el|Jonathan Stigelman|Stig@netcom.com | 45 | ;; hilit19|Jonathan Stigelman|Stig@netcom.com| |
| 47 | ;; |Comprehensive (and comparatively fast) regex-based highlighting for Emacs 19 | 46 | ;; Comprehensive (and comparatively fast) regex-based highlighting for Emacs 19| |
| 48 | ;; Thu Jul 22 21:03:46 1993|Beta 1.9|| | 47 | ;; 1993/07/30 02:43:01|Release 2.7|~/packages/hilit19.el.Z| |
| 49 | ;; | 48 | ;; |
| 50 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 49 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 51 | ;; | 50 | ;; |
| @@ -73,10 +72,20 @@ | |||
| 73 | ;; | 72 | ;; |
| 74 | ;; SETUP -- In your .emacs: | 73 | ;; SETUP -- In your .emacs: |
| 75 | ;; | 74 | ;; |
| 76 | ;; (require 'hilit19) ; not intended to be autoloaded | 75 | ;; |
| 77 | ;; | 76 | ;; (cond (window-system |
| 78 | ;; (setq hilit-mode-enable-list '(not text-mode)) | 77 | ;; (setq hilit-mode-enable-list '(not text-mode) |
| 79 | ;; | 78 | ;; hilit-background-mode 'light |
| 79 | ;; hilit-inhibit-hooks nil | ||
| 80 | ;; hilit-inhibit-rebinding nil) | ||
| 81 | ;; | ||
| 82 | ;; (require 'hilit19) | ||
| 83 | ;; )) | ||
| 84 | ;; | ||
| 85 | ;; If you like font-lock-mode and want to use both packages, then you can | ||
| 86 | ;; disable hilit for the modes in which you want to use font-lock by listing | ||
| 87 | ;; said modes in hilit-mode-enable-list. | ||
| 88 | ;; | ||
| 80 | ;; (hilit-translate type 'RoyalBlue ; enable highlighting in C/C++ | 89 | ;; (hilit-translate type 'RoyalBlue ; enable highlighting in C/C++ |
| 81 | ;; string nil) ; disable string highlighting | 90 | ;; string nil) ; disable string highlighting |
| 82 | ;; | 91 | ;; |
| @@ -121,15 +130,25 @@ | |||
| 121 | ;; | 130 | ;; |
| 122 | ;; KNOWN BUGS/TO DO LIST/HELP WANTED/APPLY WITHIN | 131 | ;; KNOWN BUGS/TO DO LIST/HELP WANTED/APPLY WITHIN |
| 123 | ;; | 132 | ;; |
| 124 | ;; * unbalanced double quote characters can confuse hilit19. This will be | 133 | ;; * When more than one size of font is used in different frames, only one |
| 125 | ;; fixed, so don't bug me about it. | 134 | ;; font size can have bold & italic properties. |
| 135 | ;; | ||
| 136 | ;; * When identifiers such as remove_switch_entry, ar highlighted in C/C++, | ||
| 137 | ;; imbedded keywords--"switch" in this case--are highlighted. I don't | ||
| 138 | ;; personally see this problem because I modify the syntax for C/C++ so that | ||
| 139 | ;; ?_ is a word character "w". This also means that forward-word skips over | ||
| 140 | ;; entire variables. This will be fixed when I generalize the highlighting | ||
| 141 | ;; patterns. | ||
| 142 | ;; | ||
| 143 | ;; * unbalanced, unescaped double quote characters can confuse hilit19. | ||
| 144 | ;; This will be fixed, so don't bug me about it. | ||
| 126 | ;; | 145 | ;; |
| 127 | ;; * ALTHOUGH HILIT19 IS FASTER THAN FONT-LOCK-MODE, for various reasons, | 146 | ;; * ALTHOUGH HILIT19 IS FASTER THAN FONT-LOCK-MODE... |
| 128 | ;; the speed of the package could still stand to be improved. If you care | 147 | ;; For various reasons, the speed of the package could still stand to be |
| 129 | ;; to do a little profiling and make things tighter... | 148 | ;; improved. If you care to do a little profiling and make things tighter... |
| 130 | ;; | 149 | ;; |
| 131 | ;; * hilit-toggle-highlight is flaky in large buffers where auto-rehighlight | 150 | ;; * hilit-toggle-highlight is flaky when auto-rehighlight is neither t nor nil. |
| 132 | ;; is numeric after toggling twice, it loses it's numeric value | 151 | ;; Does anyone actually USE this? I think I might just remove it. |
| 133 | ;; | 152 | ;; |
| 134 | ;; PROJECTS THAT YOU CAN TAKE OVER BECAUSE I DON'T MUCH CARE ABOUT THEM... | 153 | ;; PROJECTS THAT YOU CAN TAKE OVER BECAUSE I DON'T MUCH CARE ABOUT THEM... |
| 135 | ;; | 154 | ;; |
| @@ -140,135 +159,66 @@ | |||
| 140 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 159 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 141 | ;; | 160 | ;; |
| 142 | ;; Thanks to the following people for their input: | 161 | ;; Thanks to the following people for their input: |
| 143 | ;; ebert@enpc.enpc.fr (Rolf EBERT), ada, LaTeX & bibtex highlights | 162 | ;; ebert@enpc.enpc.fr (Rolf EBERT), ada, LaTeX & bibtex highlights |
| 144 | ;; Vivek Khera <khera@cs.duke.edu>, gnus hooks + random advice & patches | 163 | ;; Vivek Khera <khera@cs.duke.edu>, gnus hooks + random advice & patches |
| 145 | ;; brian@athe.WUstl.EDU (Brian Dunford-Shore), prolog highlights | 164 | ;; brian@athe.WUstl.EDU (Brian Dunford-Shore), prolog highlights |
| 146 | ;; John Ladwig <jladwig@soils.umn.edu>, 1st pass nroff highlights | 165 | ;; John Ladwig <jladwig@soils.umn.edu>, 1st pass nroff highlights |
| 147 | ;; campo@sunthpi3.difi.unipi.it (Massimo Campostrini), fortran highlights | 166 | ;; campo@sunthpi3.difi.unipi.it (Massimo Campostrini), fortran highlights |
| 148 | ;; jayb@laplace.MATH.ColoState.EDU (Jay Bourland), 1st pass dired | 167 | ;; jayb@laplace.MATH.ColoState.EDU (Jay Bourland), 1st pass dired |
| 149 | ;; Yoshio Turner <yoshio@CS.UCLA.EDU>, modula 2 highlights | 168 | ;; Yoshio Turner <yoshio@CS.UCLA.EDU>, modula 2 highlights |
| 150 | ;; Fritz Knabe <knabe@ecrc.de>, advice & patches | 169 | ;; Fritz Knabe <knabe@ecrc.de>, advice & patches |
| 151 | ;; Alon Albert <alon@milcse.rtsg.mot.com>, advice & patches | 170 | ;; Alon Albert <alon@milcse.rtsg.mot.com>, advice & patches |
| 152 | ;; dana@thumper.bellcore.com (Dana A. Chee), for breaking it... | 171 | ;; dana@thumper.bellcore.com (Dana A. Chee), working on the multi-frame bug |
| 153 | ;; derway@ndc.com (Don Erway), for breaking it... | 172 | ;; derway@ndc.com (Don Erway), for breaking it... |
| 154 | ;; | 173 | ;; |
| 155 | ;; With suggestions and minor regex patches from numerous others... | 174 | ;; With suggestions and minor regex patches from numerous others... |
| 156 | ;; | 175 | ;; |
| 157 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 176 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 158 | ;; | 177 | ;; |
| 159 | ;; HISTORY | 178 | ;; hilit19.el,v |
| 179 | ;; Revision 2.7 1993/07/30 02:43:01 stig | ||
| 180 | ;; added const to the list of modifiers for C/C++ types | ||
| 160 | ;; | 181 | ;; |
| 161 | ;; V1.9 21-July-1993 Stig@netcom.com | 182 | ;; Revision 2.6 1993/07/30 00:30:54 stig |
| 162 | ;; better documentation and added the function hilit-submit-feedback. | 183 | ;; now permit selection of arbitrary subexpressions for highlighting... |
| 163 | ;; no longer rebind ^L, now C-S-l (control shift l) repaints the buffer | 184 | ;; fixed keyword patterns for C/C++ using this technique. |
| 164 | ;; multi-line highlights no longer cause problems when | ||
| 165 | ;; hilit-auto-rehighlight is 'visible | ||
| 166 | ;; added hilit-predefined-face-list... | ||
| 167 | ;; changed name of hilit-mode-alist to hilit-patterns-alist | ||
| 168 | ;; added hilit-message-quietly to mail-setup-hook | ||
| 169 | ;; added hilit-parser-alist which can be used to apply different patterns to | ||
| 170 | ;; different parts of a buffer. This could be integrated in a far more | ||
| 171 | ;; elegant manner, but it presently serves the purpose of not applying | ||
| 172 | ;; message header patterns to message bodies in mail-mode and it's kin. | ||
| 173 | ;; hilit-set-mode-patterns now takes a list of modes and an optional parse-fn | ||
| 174 | ;; V1.8 19-July-1993 Stig@netcom.com | ||
| 175 | ;; changed hilit-translate to be a macro so that now it mirrors setq | ||
| 176 | ;; now permit multiple layers of face-translation... | ||
| 177 | ;; hilit-lookup-face-create now parses background colors | ||
| 178 | ;; added code to check for face changes and recopy the fonts from 'default | ||
| 179 | ;; when necessary. this can be disabled if you never change fonts. | ||
| 180 | ;; you should be able to change fonts, redraw, and have all of your | ||
| 181 | ;; bold & italic faces back to normal. Should work in new frames as well. | ||
| 182 | ;; fixed typo for one of the vm hooks and included the magic patch to | ||
| 183 | ;; vm5.33 that keeps the summary window up to date. | ||
| 184 | ;; got rid of the annoying dings and delays when colors aren't available | ||
| 185 | ;; set case-fold-search to nil in highlighting-region function | ||
| 186 | ;; fixed minor bug in hilit-rehighlight-message-quietly | ||
| 187 | ;; patches to Info, LaTeX, fortran, nroff, & c++ patterns | ||
| 188 | ;; modula-2-mode support | ||
| 189 | ;; improved gnus-mark-article-hook | ||
| 190 | ;; moved timecard-mode highlights to timecard-mode itself | ||
| 191 | ;; V1.7 12-July-1993 Stig@netcom.com | ||
| 192 | ;; fix to dired patterns | ||
| 193 | ;; punted on the dual functionality in hilit-auto-highlight and added | ||
| 194 | ;; hilit-mode-enable-list, which permits users to specifically lock out | ||
| 195 | ;; modes by preventing them from being added into the hilit-mode-list | ||
| 196 | ;; incorporated defaults for dark backgrounds (see hilit-background-mode) | ||
| 197 | ;; incorporated fortran highlighting patterns | ||
| 198 | ;; patches to ada-mode and msg-header regexes | ||
| 199 | ;; added msg-separator pattern | ||
| 200 | ;; changed dired-backup to dired ignored which (which is derived from the | ||
| 201 | ;; variable completion-ignored-extensions) | ||
| 202 | ;; V1.6 5-July-1993 Stig@netcom.com | ||
| 203 | ;; added dired patterns | ||
| 204 | ;; fixed minor typo bug in mail patterns | ||
| 205 | ;; added profiling hook | ||
| 206 | ;; V1.5 5-July-1993 Stig@netcom.com | ||
| 207 | ;; changed behavior of hilit-recenter to more closely match that of recenter | ||
| 208 | ;; hilit-auto-highlight can now be a list of major-modes to highlight on find | ||
| 209 | ;; reverted to using overlays...the cost of text-properties is too high, IMHO | ||
| 210 | ;; added 'visible option to hilit-auto-rehighlight variable | ||
| 211 | ;; now highlighting support for info pages (see patch below) | ||
| 212 | ;; added hilit-yank and hilit-yank-pop which replace their analogues | ||
| 213 | ;; wrote special parsing function for strings...bug squished...faster too | ||
| 214 | ;; tuned the texinfo patterns for better performance | ||
| 215 | ;; nroff support | ||
| 216 | ;; V1.4 2-July-1993 Stig@netcom.com | ||
| 217 | ;; more efficient highlighting for news and mail | ||
| 218 | ;; switched to text properties (this may be temporary) | ||
| 219 | ;; changed regular expressions for c*mode to accomodate syntax tables | ||
| 220 | ;; minor mod to Ada parameter regexp | ||
| 221 | ;; now catch regex stack overflows and print an error | ||
| 222 | ;; string matching now uses start and end expressions to prevent overflows | ||
| 223 | ;; V1.3 28-June-1993 Stig@netcom.com | ||
| 224 | ;; added support for hexadecimal color specification under X | ||
| 225 | ;; added hilit-translate for simple color translations | ||
| 226 | ;; changed coverage of hilit-quietly...when it's quiet, it's always quiet. | ||
| 227 | ;; removed extra call to unhighlight-region in rehighlight-buffer | ||
| 228 | ;; automatically installs hooks, unless hilit-inhibit-hooks set before load | ||
| 229 | ;; installed fixes for latex | ||
| 230 | ;; V1.2 28-June-1993 Stig@netcom.com | ||
| 231 | ;; partially fixed bug in hilit-toggle-highlight | ||
| 232 | ;; added string highlighting | ||
| 233 | ;; fixed bug in hilit-lookup-face-create | ||
| 234 | ;; additions for Ada, Tex, LaTeX, and Texinfo (is scribe next? =) | ||
| 235 | ;; now highlight template decls in C++ | ||
| 236 | ;; added reverse-* intelligence to hilit-lookup-face-create | ||
| 237 | ;; imported wysiwyg (overstrike replacement) stuff from my hacks to man.el | ||
| 238 | ;; sketched out a stub of a wysiwyg write file hook, care to finish it? | ||
| 239 | ;; V1.1 25-June-1993 Stig@netcom.com | ||
| 240 | ;; replaced last vestiges of original hilit.el | ||
| 241 | ;; now map default modes to major-mode values | ||
| 242 | ;; reworked face allocation so that colors don't get tied up | ||
| 243 | ;; rewrote some comments that I'd put in earlier but somehow managed to nuke | ||
| 244 | ;; V1.0 22-June-1993 Stig@netcom.com | ||
| 245 | ;; incrementally replaced just about everything...simpler, cleaner, & faster | ||
| 246 | ;; extended highlight coverage for C/C++ modes (highlight more things) | ||
| 247 | ;; added layer of indirection to face selection | ||
| 248 | |||
| 249 | ;;;;;; THIS WILL ALLOW INFO PAGES TO BE HILIGHTED: | ||
| 250 | ;; | 185 | ;; |
| 251 | ;; *** 19.15/info.el Sat Jun 19 14:47:06 1993 | 186 | ;; Revision 2.5 1993/07/28 05:02:56 stig |
| 252 | ;; --- 19/info.el Sun Jul 4 03:33:12 1993 | 187 | ;; improvements to makefile regular expressions |
| 253 | ;; *************** | 188 | ;; removed about 130 lines just by compacting the big defconst for |
| 254 | ;; *** 475,481 **** | 189 | ;; hilit-face-translation-table into a mapcar and defining a separate table |
| 255 | ;; (setq active-expression | 190 | ;; of default faces. |
| 256 | ;; (read (current-buffer)))))) | 191 | ;; |
| 257 | ;; (point-max))) | 192 | ;; Revision 2.4 1993/07/27 14:09:05 stig |
| 258 | ;; ! (if Info-enable-active-nodes (eval active-expression))))) | 193 | ;; documented another "known problem" to "head off gripe mail at the pass." |
| 259 | ;; | 194 | ;; |
| 260 | ;; (defun Info-set-mode-line () | 195 | ;; Revision 2.3 1993/07/27 02:15:49 stig |
| 261 | ;; (setq mode-line-buffer-identification | 196 | ;; (hilit-lookup-face-create) incorporated patch which improves it's behavior |
| 262 | ;; --- 475,482 ---- | 197 | ;; with more than one frame... Still can't have bold on the same face in two |
| 263 | ;; (setq active-expression | 198 | ;; differrent fonts sizes at the same time... |
| 264 | ;; (read (current-buffer)))))) | 199 | ;; |
| 265 | ;; (point-max))) | 200 | ;; Revision 2.2 1993/07/27 02:02:59 stig |
| 266 | ;; ! (if Info-enable-active-nodes (eval active-expression))) | 201 | ;; vastly improved the makefile patterns |
| 267 | ;; ! (run-hooks 'Info-select-hook))) | 202 | ;; added hook for mh-show-mode |
| 268 | ;; | ||
| 269 | ;; (defun Info-set-mode-line () | ||
| 270 | ;; (setq mode-line-buffer-identification | ||
| 271 | ;; | 203 | ;; |
| 204 | ;; Revision 2.1 1993/07/24 17:46:21 stig | ||
| 205 | ;; Phasing out Info-select-hook... Version 19.18 will use Info-selection-hook. | ||
| 206 | ;; | ||
| 207 | ;; Revision 2.0 1993/07/24 13:50:10 stig | ||
| 208 | ;; better documentation and added the function hilit-submit-feedback. | ||
| 209 | ;; C-S-l (control shift l) repaints the buffer. Other bindings are optional. | ||
| 210 | ;; multi-line highlights no longer cause problems when | ||
| 211 | ;; hilit-auto-rehighlight is 'visible | ||
| 212 | ;; added hilit-predefined-face-list... | ||
| 213 | ;; changed name of hilit-mode-alist to hilit-patterns-alist | ||
| 214 | ;; added hilit-message-quietly to mail-setup-hook | ||
| 215 | ;; added hilit-parser-alist which can be used to apply different patterns to | ||
| 216 | ;; different parts of a buffer. This could be integrated in a far more | ||
| 217 | ;; elegant manner, but it presently serves the purpose of not applying | ||
| 218 | ;; message header patterns to message bodies in mail-mode and it's kin. | ||
| 219 | ;; hilit-set-mode-patterns now takes a list of modes and an optional parse-fn | ||
| 220 | ;; | ||
| 221 | |||
| 272 | ;;;;;; AND THIS CAN BE APPLIED TO VM 5.33L_19 | 222 | ;;;;;; AND THIS CAN BE APPLIED TO VM 5.33L_19 |
| 273 | ;; | 223 | ;; |
| 274 | ;; *** ../site/vm5.33L_19/vm-summary.el Fri Jun 4 22:17:11 1993 | 224 | ;; *** ../site/vm5.33L_19/vm-summary.el Fri Jun 4 22:17:11 1993 |
| @@ -301,20 +251,6 @@ | |||
| 301 | (defvar hilit-quietly nil | 251 | (defvar hilit-quietly nil |
| 302 | "* If non-nil, this inhibits progress indicators during highlighting") | 252 | "* If non-nil, this inhibits progress indicators during highlighting") |
| 303 | 253 | ||
| 304 | (defvar hilit-inhibit-hooks nil | ||
| 305 | "* If non-nil, this inhibits installation of hooks for Info, gnus, & vm.") | ||
| 306 | |||
| 307 | (defvar hilit-background-mode 'light | ||
| 308 | "* 'mono inhibits color, 'dark or 'light indicate the background brightness.") | ||
| 309 | |||
| 310 | (defvar hilit-mode-enable-list nil | ||
| 311 | "* If a list of modes to exclusively enable or specifically disable. | ||
| 312 | The sense of the list is negated if it begins with the symbol 'not'. | ||
| 313 | Set this variable before you load hilit19. | ||
| 314 | |||
| 315 | Ex: (perl-mode jargon-mode c-mode) ; just perl, C, and jargon modes | ||
| 316 | (not text-mode) ; all modes except text mode") | ||
| 317 | |||
| 318 | (defvar hilit-auto-highlight t | 254 | (defvar hilit-auto-highlight t |
| 319 | "* T if we should highlight all buffers as we find 'em, nil to disable | 255 | "* T if we should highlight all buffers as we find 'em, nil to disable |
| 320 | automatic highlighting by the find-file hook.") | 256 | automatic highlighting by the find-file hook.") |
| @@ -324,24 +260,42 @@ Ex: (perl-mode jargon-mode c-mode) ; just perl, C, and jargon modes | |||
| 324 | 260 | ||
| 325 | (defvar hilit-auto-rehighlight t | 261 | (defvar hilit-auto-rehighlight t |
| 326 | "* If this is non-nil, then hilit-redraw and hilit-recenter will also | 262 | "* If this is non-nil, then hilit-redraw and hilit-recenter will also |
| 327 | rehighlight part or all of the current buffer. T will rehighlights the | 263 | rehighlight part or all of the current buffer. T will rehighlight the |
| 328 | whole buffer, a NUMBER will rehighlight that many lines before and | 264 | whole buffer, a NUMBER will rehighlight that many lines before and after |
| 329 | after the cursor, or the symbol 'visible' will rehighlight only the visible | 265 | the cursor, and the symbol 'visible' will rehighlight only the visible |
| 330 | portion of the current buffer.") | 266 | portion of the current buffer. This variable is buffer-local.") |
| 331 | 267 | ||
| 332 | (make-variable-buffer-local 'hilit-auto-rehighlight) | 268 | (make-variable-buffer-local 'hilit-auto-rehighlight) |
| 333 | (setq-default hilit-auto-rehighlight t) | ||
| 334 | 269 | ||
| 335 | (defvar hilit-auto-rehighlight-fallback '(20000 . 100) | 270 | (defvar hilit-auto-rehighlight-fallback '(20000 . 100) |
| 336 | "* Cons of the form (THRESHOLD . FALLBACK), where FALLBACK is assigned to | 271 | "* Cons of the form (THRESHOLD . FALLBACK), where FALLBACK is assigned to |
| 337 | hilit-auto-rehighlight if the size of a newly opened buffer is larger than | 272 | hilit-auto-rehighlight if the size of a newly opened buffer is larger than |
| 338 | THRESHOLD.") | 273 | THRESHOLD.") |
| 339 | 274 | ||
| 340 | (defvar hilit-face-check t | 275 | (defvar hilit-face-check t |
| 341 | "* T slows down highlighting but permits the user to change fonts without | 276 | "* T slows down highlighting but permits the user to change fonts without |
| 342 | losing bold and italic faces... T causes hilit-lookup-face-create to dig | 277 | losing bold and italic faces... T causes hilit-lookup-face-create to dig |
| 343 | through the frame parameters for the current window every time it's called. | 278 | through the frame parameters for the current window every time it's called. |
| 344 | If you never change fonts in emacs, set this to NIL.") | 279 | If you never change fonts in emacs, set this to NIL.") |
| 280 | |||
| 281 | ;; Variables which must be set before loading hilit19. | ||
| 282 | |||
| 283 | (defvar hilit-inhibit-rebinding nil | ||
| 284 | "If non-nil, this inhibits replacement of recenter, yank, and yank-pop.") | ||
| 285 | |||
| 286 | (defvar hilit-inhibit-hooks nil | ||
| 287 | "If non-nil, this inhibits installation of hooks for Info, gnus, & vm.") | ||
| 288 | |||
| 289 | (defvar hilit-background-mode 'light | ||
| 290 | "'mono inhibits color, 'dark or 'light indicate the background brightness.") | ||
| 291 | |||
| 292 | (defvar hilit-mode-enable-list nil | ||
| 293 | "If a list of modes to exclusively enable or specifically disable. | ||
| 294 | The sense of the list is negated if it begins with the symbol 'not'. | ||
| 295 | Set this variable before you load hilit19. | ||
| 296 | |||
| 297 | Ex: (perl-mode jargon-mode c-mode) ; just perl, C, and jargon modes | ||
| 298 | (not text-mode) ; all modes except text mode") | ||
| 345 | 299 | ||
| 346 | ;; Variables that are not generally modified directly | 300 | ;; Variables that are not generally modified directly |
| 347 | 301 | ||
| @@ -362,7 +316,7 @@ or nil (which disables the pattern). | |||
| 362 | See the hilit-lookup-face-create documentation for valid face names.") | 316 | See the hilit-lookup-face-create documentation for valid face names.") |
| 363 | 317 | ||
| 364 | (defvar hilit-predefined-face-list (face-list) | 318 | (defvar hilit-predefined-face-list (face-list) |
| 365 | "List of faces which with hilit-lookup-face-create will NOT tamper. | 319 | "List of faces with which hilit-lookup-face-create will NOT tamper. |
| 366 | 320 | ||
| 367 | If hilit19 is dumped into emacs at your site, you may have to set this in | 321 | If hilit19 is dumped into emacs at your site, you may have to set this in |
| 368 | your init file.") | 322 | your init file.") |
| @@ -370,14 +324,16 @@ your init file.") | |||
| 370 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 324 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 371 | ;; Use this to report bugs: | 325 | ;; Use this to report bugs: |
| 372 | 326 | ||
| 327 | (eval-when-compile (require 'reporter)) ; no compilation gripes | ||
| 328 | |||
| 373 | (defun hilit-submit-feeback () | 329 | (defun hilit-submit-feeback () |
| 374 | "Submit via mail a bug report on stig-paren" | 330 | "Submit feedback on hilit19 to the author: Stig@netcom.com" |
| 375 | (interactive) | 331 | (interactive) |
| 376 | (require 'reporter) | 332 | (require 'reporter) |
| 377 | (and (y-or-n-p "Do you really want to submit a report on hilit19? ") | 333 | (and (y-or-n-p "Do you really want to submit a report on hilit19? ") |
| 378 | (reporter-submit-bug-report | 334 | (reporter-submit-bug-report |
| 379 | "Jonathan Stigelman <Stig@netcom.com>" | 335 | "Jonathan Stigelman <Stig@netcom.com>" |
| 380 | "hilit19.el Beta 1.9 ($Revision: 1.34 $)" | 336 | "hilit19.el (Release 2.7)" |
| 381 | (and (y-or-n-p "Do you need to include a dump hilit variables? ") | 337 | (and (y-or-n-p "Do you need to include a dump hilit variables? ") |
| 382 | (append | 338 | (append |
| 383 | '( | 339 | '( |
| @@ -395,14 +351,16 @@ your init file.") | |||
| 395 | )))) | 351 | )))) |
| 396 | (function | 352 | (function |
| 397 | (lambda () | 353 | (lambda () |
| 398 | (insert "\nFrame Configuration:\n====================\n" | 354 | (and (y-or-n-p "Is this a problem with font display? ") |
| 399 | (prin1-to-string (frame-configuration-to-register ?F)) | 355 | (insert "\nFrame Configuration:\n====================\n" |
| 400 | "\n" | 356 | (prin1-to-string (frame-configuration-to-register ?F)) |
| 401 | ))) | 357 | "\n" |
| 358 | )))) | ||
| 402 | nil | 359 | nil |
| 403 | (concat | 360 | (concat |
| 404 | "This is (check all that apply, or delete those that don't):\n" | 361 | "This is (check all that apply, and delete what's irrelevant):\n" |
| 405 | " [ ] a _MASSIVE_THANK_YOU_ for writing hilit19.el\n" | 362 | " [ ] a _MASSIVE_THANK_YOU_ for writing hilit19.el\n" |
| 363 | " [ ] An invitation to attend the next Hackers Conference\n" | ||
| 406 | " [ ] my DONATION to your vacation fund (prototype digital cash)\n" | 364 | " [ ] my DONATION to your vacation fund (prototype digital cash)\n" |
| 407 | " [ ] You're a RIGHTEOUS HACKER, what are your rates?\n" | 365 | " [ ] You're a RIGHTEOUS HACKER, what are your rates?\n" |
| 408 | " [ ] I've used the force and read the source, but I'M CONFUSED\n" | 366 | " [ ] I've used the force and read the source, but I'M CONFUSED\n" |
| @@ -413,211 +371,83 @@ your init file.") | |||
| 413 | " for a newer release that fixes the problem.\n" | 371 | " for a newer release that fixes the problem.\n" |
| 414 | " [ ] ADVICE -- or an unfulfilled desire that I suspect you share\n" | 372 | " [ ] ADVICE -- or an unfulfilled desire that I suspect you share\n" |
| 415 | "\n" | 373 | "\n" |
| 416 | "Hey Stig, do you do anything besides hack emacs?\n")))) | 374 | "Hey Stig, I *know* you're busy but...\n")))) |
| 417 | 375 | ||
| 418 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 376 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 419 | ;; | 377 | ;; |
| 420 | ;; These faces are either a valid face name, or nil | 378 | ;; These faces are either a valid face name, or nil |
| 421 | ;; if you want to change them, you must do so AFTER hilit19 is loaded | 379 | ;; if you want to change them, you must do so AFTER hilit19 is loaded |
| 422 | 380 | ||
| 423 | (defconst hilit-face-translation-table | 381 | (defconst hilit-default-face-table |
| 424 | (cond ((and (eq hilit-background-mode 'light) (x-display-color-p)) | 382 | '( |
| 425 | ;; COLOR DEFAULTS for LIGHT backgrounds | 383 | ;; used for C/C++ and elisp and perl |
| 426 | '( | 384 | (comment firebrick-italic moccasin italic) |
| 427 | ;; used for C/C++ and elisp and perl | 385 | (include purple Plum1 default-bold-italic) |
| 428 | (comment . firebrick-italic) | 386 | (define ForestGreen-bold green bold) |
| 429 | (include . purple) | 387 | (defun blue-bold cyan-bold default-bold-italic) |
| 430 | (define . ForestGreen-bold) | 388 | (decl RoyalBlue cyan bold) |
| 431 | (defun . blue-bold) | 389 | (type nil yellow nil) |
| 432 | (decl . RoyalBlue) | 390 | (keyword RoyalBlue cyan default-bold-italic) |
| 433 | (type . nil) | 391 | (label red-bold orange-underlined underline) |
| 434 | (keyword . RoyalBlue) | 392 | (string grey40 orange underline) |
| 435 | (label . red-bold) | 393 | |
| 436 | (string . grey40) | 394 | ;; some further faces for Ada |
| 437 | 395 | (struct black-bold white-bold bold) | |
| 438 | ;; some further faces for Ada | 396 | (glob-struct magenta Plum1 default-bold-underline) |
| 439 | (struct . black-bold) | 397 | (named-param DarkGoldenrod Goldenrod underline) |
| 440 | (glob-struct . magenta) | ||
| 441 | (named-param . DarkGoldenrod) | ||
| 442 | 398 | ||
| 443 | ;; and anotherone for LaTeX | 399 | ;; and anotherone for LaTeX |
| 444 | (crossref . DarkGoldenrod) | 400 | (crossref DarkGoldenrod Goldenrod underline) |
| 445 | 401 | ||
| 446 | (wysiwyg-bold . bold) | 402 | ;; compilation buffers |
| 447 | (wysiwyg-underline . underline) | 403 | (active-error default/pink-bold default/DeepPink-bold bold-underline) |
| 448 | 404 | (error red-bold yellow bold) | |
| 449 | ;; compilation buffers | 405 | (warning blue-italic green italic) |
| 450 | (error . red-bold) | 406 | |
| 451 | (warning . firebrick) | 407 | ;; Makefiles (some faces borrowed from C/C++ too) |
| 452 | 408 | (rule blue-bold-underline cyan-underline bold-underline) | |
| 453 | ;; Makefiles (some faces borrowed from C/C++ too) | 409 | |
| 454 | (rule . blue-bold) | 410 | ;; VM, GNUS and Text mode |
| 455 | 411 | (msg-subject blue-bold yellow bold) | |
| 456 | ;; VM, GNUS and Text mode | 412 | (msg-from purple-bold SeaGreen bold) |
| 457 | (msg-subject . blue-bold) | 413 | (msg-header firebrick-bold cyan italic) |
| 458 | (msg-from . purple-bold) | 414 | (msg-separator black/tan-bold lightblue nil) |
| 459 | (msg-header . firebrick-bold) | 415 | (msg-quote ForestGreen green italic) |
| 460 | (msg-separator . black/tan-bold) | 416 | |
| 461 | (msg-quote . ForestGreen) | 417 | (summary-seen grey40 white nil) |
| 462 | 418 | (summary-killed grey50 white nil) | |
| 463 | (summary-seen . grey40) | 419 | (summary-Xed OliveDrab2 green nil) |
| 464 | (summary-killed . grey50) | 420 | (summary-deleted firebrick white italic) |
| 465 | (summary-Xed . OliveDrab2) | 421 | (summary-unread RoyalBlue yellow bold) |
| 466 | (summary-current . default/skyblue-bold) | 422 | (summary-new blue-bold yellow-bold default-bold-italic) |
| 467 | (summary-deleted . firebrick) | 423 | (summary-current default/skyblue-bold green/LightGrey-bold reverse-default) |
| 468 | (summary-unread . RoyalBlue) | 424 | |
| 469 | (summary-new . blue-bold) | 425 | (gnus-group-unsubscribed grey50 white nil) |
| 470 | 426 | (gnus-group-empty nil yellow nil) | |
| 471 | (gnus-group-unsubscribed . grey50) | 427 | (gnus-group-full ForestGreen green italic) |
| 472 | (gnus-group-empty . nil) | 428 | (gnus-group-overflowing firebrick orange default-bold-italic) |
| 473 | (gnus-group-full . ForestGreen) | 429 | |
| 474 | (gnus-group-overflowing . firebrick) | 430 | ;; dired mode |
| 475 | 431 | (dired-directory blue-bold cyan bold) | |
| 476 | ;; dired mode | 432 | (dired-link firebrick-italic green italic) |
| 477 | (dired-directory . blue-bold) | 433 | (dired-ignored ForestGreen moccasin nil) |
| 478 | (dired-link . firebrick-italic) | 434 | (dired-deleted red-bold-italic orange default-bold-italic) |
| 479 | (dired-ignored . ForestGreen) | 435 | (dired-marked purple Plum1 nil) |
| 480 | (dired-deleted . red-bold-italic) | ||
| 481 | (dired-marked . purple) | ||
| 482 | |||
| 483 | ;; see jargon-mode.el and prep.ai.mit.edu:/pub/gnu/jargon*.txt | ||
| 484 | (jargon-entry . blue-bold) | ||
| 485 | (jargon-xref . purple-bold) | ||
| 486 | ;; really used for Info-mode | ||
| 487 | (jargon-keyword . firebrick-underline) | ||
| 488 | )) | ||
| 489 | ((and (eq hilit-background-mode 'dark) (x-display-color-p)) | ||
| 490 | ;; COLOR DEFAULTS for DARK backgrounds | ||
| 491 | '( | ||
| 492 | ;; used for C/C++ and elisp and perl | ||
| 493 | (comment . moccasin) | ||
| 494 | (include . Plum1) | ||
| 495 | (define . green) | ||
| 496 | (defun . cyan-bold) | ||
| 497 | (decl . cyan) | ||
| 498 | (type . yellow) | ||
| 499 | (keyword . cyan) | ||
| 500 | (label . orange-underlined) | ||
| 501 | (string . orange) | ||
| 502 | |||
| 503 | ;; some further faces for Ada | ||
| 504 | (struct . white-bold) | ||
| 505 | (glob-struct . Plum1) | ||
| 506 | (named-param . Goldenrod) | ||
| 507 | |||
| 508 | ;; and anotherone for LaTeX | ||
| 509 | (crossref . Goldenrod) | ||
| 510 | |||
| 511 | (wysiwyg-bold . bold) | ||
| 512 | (wysiwyg-underline . underline) | ||
| 513 | |||
| 514 | ;; compilation buffers | ||
| 515 | (error . yellow) | ||
| 516 | (warning . green) | ||
| 517 | |||
| 518 | ;; Makefiles (some faces borrowed from C/C++ too) | ||
| 519 | (rule . cyan) | ||
| 520 | |||
| 521 | ;; VM, GNUS and Text mode | ||
| 522 | (msg-subject . yellow) | ||
| 523 | (msg-from . SeaGreen2) | ||
| 524 | (msg-header . cyan) | ||
| 525 | (msg-separator . lightblue) | ||
| 526 | (msg-quote . green) | ||
| 527 | |||
| 528 | (summary-seen . white) | ||
| 529 | (summary-killed . white) | ||
| 530 | (summary-Xed . green) | ||
| 531 | (summary-current . green-bold) | ||
| 532 | (summary-deleted . white) | ||
| 533 | (summary-unread . yellow) | ||
| 534 | (summary-new . yellow-bold) | ||
| 535 | 436 | ||
| 536 | (gnus-group-unsubscribed . white) | 437 | ;; Info-mode, and jargon-mode.el and prep.ai.mit.edu:/pub/gnu/jargon* |
| 537 | (gnus-group-empty . yellow) | 438 | (jargon-entry blue-bold cyan bold) |
| 538 | (gnus-group-full . green) | 439 | (jargon-xref purple-bold Plum1 italic) |
| 539 | (gnus-group-overflowing . orange) | 440 | (jargon-keyword firebrick-underline yellow underline) |
| 540 | 441 | ) | |
| 541 | ;; dired mode | 442 | "alist of default faces (face . (light-default dark-default mono-default))") |
| 542 | (dired-directory . cyan) | 443 | |
| 543 | (dired-link . green) | 444 | (defconst hilit-face-translation-table |
| 544 | (dired-ignored . moccasin) | 445 | (let ((index (or (cdr (assq hilit-background-mode |
| 545 | (dired-deleted . orange) | 446 | '((light . 1) (dark . 2)))) |
| 546 | (dired-marked . Plum1) | 447 | 3))) |
| 547 | 448 | (mapcar (function (lambda (x) (cons (car x) (nth index x)))) | |
| 548 | ;; see jargon-mode.el and prep.ai.mit.edu:/pub/gnu/jargon*.txt | 449 | hilit-default-face-table)) |
| 549 | (jargon-entry . cyan) | 450 | "alist that maps symbolic face-names to real face names") |
| 550 | (jargon-xref . Plum1) | ||
| 551 | ;; really used for Info-mode | ||
| 552 | (jargon-keyword . yellow) | ||
| 553 | )) | ||
| 554 | (t | ||
| 555 | ;; MONO DEFAULTS -- you lose | ||
| 556 | '( | ||
| 557 | ;; used for C/C++ and elisp and perl | ||
| 558 | (comment . italic) | ||
| 559 | (include . default-bold-italic) | ||
| 560 | (define . bold) | ||
| 561 | (defun . default-bold-italic) | ||
| 562 | (decl . bold) | ||
| 563 | (type . nil) | ||
| 564 | (keyword . default-bold-italic) | ||
| 565 | (label . underline) | ||
| 566 | (string . underline) | ||
| 567 | |||
| 568 | ;; some further faces for Ada | ||
| 569 | (struct . bold) | ||
| 570 | (named-param . underline) | ||
| 571 | (glob-struct . default-bold-underline) | ||
| 572 | |||
| 573 | ;; and another one for LaTeX | ||
| 574 | (crossref . underline) | ||
| 575 | |||
| 576 | (wysiwyg-bold . bold) | ||
| 577 | (wysiwyg-underline . underline) | ||
| 578 | |||
| 579 | ;; compilation buffers | ||
| 580 | (error . bold) | ||
| 581 | (warning . italic) | ||
| 582 | |||
| 583 | ;; Makefiles (some faces borrowed from C/C++ too) | ||
| 584 | (rule . bold) | ||
| 585 | |||
| 586 | ;; VM, GNUS and Text mode | ||
| 587 | (msg-subject . bold) | ||
| 588 | (msg-from . bold) | ||
| 589 | (msg-header . italic) | ||
| 590 | (msg-separator . nil) | ||
| 591 | (msg-quote . italic) | ||
| 592 | |||
| 593 | (summary-seen . nil) | ||
| 594 | (summary-killed . nil) | ||
| 595 | (summary-Xed . nil) | ||
| 596 | (summary-current . reverse-default) | ||
| 597 | (summary-unread . bold) | ||
| 598 | (summary-deleted . italic) | ||
| 599 | (summary-new . default-bold-italic) | ||
| 600 | |||
| 601 | (gnus-group-unsubscribed . nil) | ||
| 602 | (gnus-group-empty . nil) | ||
| 603 | (gnus-group-full . italic) | ||
| 604 | (gnus-group-overflowing . default-bold-italic) | ||
| 605 | |||
| 606 | ;; dired mode | ||
| 607 | (dired-directory . bold) | ||
| 608 | (dired-link . italic) | ||
| 609 | (dired-ignored . nil) | ||
| 610 | (dired-marked . nil) | ||
| 611 | (dired-deleted . default-bold-italic) | ||
| 612 | |||
| 613 | ;; see jargon-mode.el and prep.ai.mit.edu:/pub/gnu/jargon*.txt | ||
| 614 | (jargon-entry . bold) | ||
| 615 | (jargon-xref . italic) | ||
| 616 | ;; really used for Info-mode | ||
| 617 | (jargon-keyword . underline) | ||
| 618 | )) | ||
| 619 | ) | ||
| 620 | "alist that maps symbolic face-names to real face names") | ||
| 621 | 451 | ||
| 622 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 452 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 623 | ;; To translate one face to another... | 453 | ;; To translate one face to another... |
| @@ -630,20 +460,14 @@ value of its TO face. This is like setq for faces. | |||
| 630 | The function hilit-lookup-face-create will repeatedly translate until no more | 460 | The function hilit-lookup-face-create will repeatedly translate until no more |
| 631 | translations for the face exist in the translation table. | 461 | translations for the face exist in the translation table. |
| 632 | 462 | ||
| 633 | See the documentation for hilit-lookup-face-create for names of valid faces. | 463 | See the documentation for hilit-lookup-face-create for names of valid faces." |
| 634 | " | ||
| 635 | ;; can't have an interactive macro | ||
| 636 | ;; (interactive "SFace translate from: \nSFace translate to: ") | ||
| 637 | (or (zerop (% (length args) 2)) | 464 | (or (zerop (% (length args) 2)) |
| 638 | (error "wrong number of args")) | 465 | (error "wrong number of args")) |
| 639 | (let (cmdl from to) | 466 | (let (cmdl from to) |
| 640 | (while args | 467 | (while args |
| 641 | (setq from (car args) to (nth 1 args) args (nthcdr 2 args) | 468 | (setq from (car args) to (nth 1 args) args (nthcdr 2 args) |
| 642 | cmdl (cons (list 'hilit-associate ''hilit-face-translation-table | 469 | cmdl (cons (list 'hilit-associate ''hilit-face-translation-table |
| 643 | ;; this is for reverse compatibility... | 470 | (list 'quote from) to) |
| 644 | (if (and (consp from) (eq 'quote (car from))) | ||
| 645 | from | ||
| 646 | (list 'quote from)) to) | ||
| 647 | cmdl))) | 471 | cmdl))) |
| 648 | (cons 'progn cmdl))) | 472 | (cons 'progn cmdl))) |
| 649 | 473 | ||
| @@ -728,9 +552,17 @@ See the documentation for hilit-translate and hilit-face-translation-table." | |||
| 728 | (set-face-font face nil frame) | 552 | (set-face-font face nil frame) |
| 729 | (set-face-underline-p face (string-match "underline" fn)) | 553 | (set-face-underline-p face (string-match "underline" fn)) |
| 730 | (if (string-match ".*bold" fn) | 554 | (if (string-match ".*bold" fn) |
| 731 | (make-face-bold face frame 'noerr)) | 555 | (progn |
| 556 | ;; first, fix up this frame's face | ||
| 557 | (make-face-bold face frame 'noerr) | ||
| 558 | ;; now, fix up the face from the global list | ||
| 559 | (set-face-font face (face-font face frame) t))) | ||
| 732 | (if (string-match ".*italic" fn) | 560 | (if (string-match ".*italic" fn) |
| 733 | (make-face-italic face frame 'noerr)) | 561 | (progn |
| 562 | ;; first, fix up this frame's face | ||
| 563 | (make-face-italic face frame 'noerr) | ||
| 564 | ;; now, fix up the face from the global list | ||
| 565 | (set-face-font face (face-font face frame) t))) | ||
| 734 | )) | 566 | )) |
| 735 | ))) | 567 | ))) |
| 736 | face) | 568 | face) |
| @@ -821,7 +653,7 @@ non-nil." | |||
| 821 | (while (setq region (funcall pstart pend)) | 653 | (while (setq region (funcall pstart pend)) |
| 822 | (hilit-region-set-face (car region) (cdr region) | 654 | (hilit-region-set-face (car region) (cdr region) |
| 823 | face prio)))) | 655 | face prio)))) |
| 824 | (pend | 656 | ((stringp pend) |
| 825 | ;; inner loop -- regex-start ... regex-end | 657 | ;; inner loop -- regex-start ... regex-end |
| 826 | (while (re-search-forward pstart nil t nil) | 658 | (while (re-search-forward pstart nil t nil) |
| 827 | (goto-char (setq mstart (match-beginning 0))) | 659 | (goto-char (setq mstart (match-beginning 0))) |
| @@ -830,10 +662,11 @@ non-nil." | |||
| 830 | face prio) | 662 | face prio) |
| 831 | (forward-char 1)))) | 663 | (forward-char 1)))) |
| 832 | (t | 664 | (t |
| 665 | (or (numberp pend) (setq pend 0)) | ||
| 833 | ;; inner loop -- just one regex to match whole pattern | 666 | ;; inner loop -- just one regex to match whole pattern |
| 834 | (while (re-search-forward pstart nil t nil) | 667 | (while (re-search-forward pstart nil t nil) |
| 835 | (hilit-region-set-face (match-beginning 0) | 668 | (hilit-region-set-face (match-beginning pend) |
| 836 | (match-end 0) face prio)))) | 669 | (match-end pend) face prio)))) |
| 837 | (error (message "Unbalanced delimiters? Barfed on '%s'" | 670 | (error (message "Unbalanced delimiters? Barfed on '%s'" |
| 838 | pstart) | 671 | pstart) |
| 839 | (ding) (sit-for 4)))) | 672 | (ding) (sit-for 4)))) |
| @@ -956,7 +789,8 @@ the entire buffer is forced." | |||
| 956 | (interactive "*P") | 789 | (interactive "*P") |
| 957 | (let ((transient-mark-mode nil)) | 790 | (let ((transient-mark-mode nil)) |
| 958 | (yank arg) | 791 | (yank arg) |
| 959 | (hilit-rehighlight-region (region-beginning) (region-end) t) | 792 | (and hilit-auto-rehighlight |
| 793 | (hilit-rehighlight-region (region-beginning) (region-end) t)) | ||
| 960 | (setq this-command 'yank))) | 794 | (setq this-command 'yank))) |
| 961 | 795 | ||
| 962 | (defun hilit-yank-pop (arg) | 796 | (defun hilit-yank-pop (arg) |
| @@ -964,7 +798,8 @@ the entire buffer is forced." | |||
| 964 | (interactive "*p") | 798 | (interactive "*p") |
| 965 | (let ((transient-mark-mode nil)) | 799 | (let ((transient-mark-mode nil)) |
| 966 | (yank-pop arg) | 800 | (yank-pop arg) |
| 967 | (hilit-rehighlight-region (region-beginning) (region-end) t) | 801 | (and hilit-auto-rehighlight |
| 802 | (hilit-rehighlight-region (region-beginning) (region-end) t)) | ||
| 968 | (setq this-command 'yank))) | 803 | (setq this-command 'yank))) |
| 969 | 804 | ||
| 970 | ;;; this line highlighting stuff is untested. play with it only if you feel | 805 | ;;; this line highlighting stuff is untested. play with it only if you feel |
| @@ -1036,18 +871,23 @@ the entire buffer is forced." | |||
| 1036 | ;; Initialization. | 871 | ;; Initialization. |
| 1037 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 872 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 1038 | 873 | ||
| 1039 | (substitute-key-definition 'yank 'hilit-yank (current-global-map)) | 874 | (and (not hilit-inhibit-rebinding) |
| 1040 | (substitute-key-definition 'yank-pop 'hilit-yank-pop (current-global-map)) | 875 | window-system |
| 1041 | 876 | (progn | |
| 1042 | ;; (substitute-key-definition 'recenter 'hilit-recenter (current-global-map)) | 877 | (substitute-key-definition 'yank 'hilit-yank |
| 1043 | ;; (substitute-key-definition 'redraw-display 'hilit-redraw-display | 878 | (current-global-map)) |
| 1044 | ;; (current-global-map)) | 879 | (substitute-key-definition 'yank-pop 'hilit-yank-pop |
| 880 | (current-global-map)) | ||
| 881 | (substitute-key-definition 'recenter 'hilit-recenter | ||
| 882 | (current-global-map)))) | ||
| 1045 | 883 | ||
| 1046 | (global-set-key [?\C-\S-l] 'hilit-repaint-command) | 884 | (global-set-key [?\C-\S-l] 'hilit-repaint-command) |
| 1047 | 885 | ||
| 1048 | (and window-system | 886 | (and window-system |
| 1049 | (add-hook 'find-file-hooks 'hilit-find-file-hook t)) | 887 | (add-hook 'find-file-hooks 'hilit-find-file-hook t)) |
| 1050 | 888 | ||
| 889 | (eval-when-compile (require 'gnus)) ; no compilation gripes | ||
| 890 | |||
| 1051 | (and (not hilit-inhibit-hooks) | 891 | (and (not hilit-inhibit-hooks) |
| 1052 | window-system | 892 | window-system |
| 1053 | (condition-case c | 893 | (condition-case c |
| @@ -1058,17 +898,23 @@ the entire buffer is forced." | |||
| 1058 | (lambda (hook) | 898 | (lambda (hook) |
| 1059 | (add-hook hook 'hilit-rehighlight-buffer-quietly))) | 899 | (add-hook hook 'hilit-rehighlight-buffer-quietly))) |
| 1060 | '( | 900 | '( |
| 1061 | Info-select-hook | 901 | compilation-parse-hook |
| 902 | |||
| 903 | Info-select-hook ; FIXME -- phase this out later | ||
| 904 | Info-selection-hook | ||
| 905 | |||
| 1062 | vm-summary-mode-hooks | 906 | vm-summary-mode-hooks |
| 1063 | vm-summary-pointer-hook | 907 | vm-summary-pointer-hook |
| 1064 | gnus-summary-prepare-hook | ||
| 1065 | gnus-group-prepare-hook | ||
| 1066 | |||
| 1067 | vm-preview-message-hook | 908 | vm-preview-message-hook |
| 1068 | vm-show-message-hook | 909 | vm-show-message-hook |
| 910 | |||
| 1069 | gnus-article-prepare-hook | 911 | gnus-article-prepare-hook |
| 912 | gnus-summary-prepare-hook | ||
| 913 | gnus-group-prepare-hook | ||
| 914 | |||
| 1070 | rmail-show-message-hook | 915 | rmail-show-message-hook |
| 1071 | mail-setup-hook | 916 | mail-setup-hook |
| 917 | mh-show-mode-hook | ||
| 1072 | )) | 918 | )) |
| 1073 | 919 | ||
| 1074 | ;; rehilight only the visible part of the summary buffer for speed. | 920 | ;; rehilight only the visible part of the summary buffer for speed. |
| @@ -1111,7 +957,7 @@ the entire buffer is forced." | |||
| 1111 | (set alist (cons (cons key val) (eval alist)))))) | 957 | (set alist (cons (cons key val) (eval alist)))))) |
| 1112 | 958 | ||
| 1113 | (defun hilit-set-mode-patterns (modelist patterns &optional parse-fn) | 959 | (defun hilit-set-mode-patterns (modelist patterns &optional parse-fn) |
| 1114 | "Sets the default hilighting patterns for MODE to PATTERNS. | 960 | "Sets the default highlighting patterns for MODE to PATTERNS. |
| 1115 | See the variable hilit-mode-enable-list." | 961 | See the variable hilit-mode-enable-list." |
| 1116 | (or (consp modelist) (setq modelist (list modelist))) | 962 | (or (consp modelist) (setq modelist (list modelist))) |
| 1117 | (let (ok (flip (eq (car hilit-mode-enable-list) 'not))) | 963 | (let (ok (flip (eq (car hilit-mode-enable-list) 'not))) |
| @@ -1150,9 +996,9 @@ Finds [^QCHAR]\" ... [^\\]\"" | |||
| 1150 | ("^\\(\\w\\|[$_]\\)+\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) | 996 | ("^\\(\\w\\|[$_]\\)+\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) |
| 1151 | ("^\\(typedef\\|struct\\|union\\|enum\\).*$" nil decl) | 997 | ("^\\(typedef\\|struct\\|union\\|enum\\).*$" nil decl) |
| 1152 | ;; datatype -- black magic regular expression | 998 | ;; datatype -- black magic regular expression |
| 1153 | ("[ \n\t({]\\(\\(register\\|volatile\\|unsigned\\|extern\\|static\\)\\s +\\)*\\(\\(\\w\\|[$_]\\)+_t\\|float\\|double\\|void\\|char\\|short\\|int\\|long\\|FILE\\|\\(\\(struct\\|union\\|enum\\)\\([ \t]+\\(\\w\\|[$_]\\)*\\)\\)\\)\\(\\s +\\*+)?\\|[ \n\t;()]\\)" nil type) | 999 | ("[ \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) |
| 1154 | ;; key words | 1000 | ;; key words |
| 1155 | ("\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\)\\>" nil keyword) | 1001 | ("[^_]\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\)\\>[^_]" 1 keyword) |
| 1156 | )) | 1002 | )) |
| 1157 | 1003 | ||
| 1158 | (hilit-set-mode-patterns | 1004 | (hilit-set-mode-patterns |
| @@ -1170,10 +1016,10 @@ Finds [^QCHAR]\" ... [^\\]\"" | |||
| 1170 | ("^\\(\\(\\w\\|[$_]\\)+[ \t]*::[ \t]*\\)?\\(\\(\\w\\|[$_]\\)+\\|operator.*\\)\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) | 1016 | ("^\\(\\(\\w\\|[$_]\\)+[ \t]*::[ \t]*\\)?\\(\\(\\w\\|[$_]\\)+\\|operator.*\\)\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) |
| 1171 | ("^\\(template\\|typedef\\|struct\\|union\\|class\\|enum\\|public\\|private\\|protected\\).*$" nil decl) | 1017 | ("^\\(template\\|typedef\\|struct\\|union\\|class\\|enum\\|public\\|private\\|protected\\).*$" nil decl) |
| 1172 | ;; datatype -- black magic regular expression | 1018 | ;; datatype -- black magic regular expression |
| 1173 | ("[ \n\t({]\\(\\(register\\|volatile\\|unsigned\\|extern\\|static\\)\\s +\\)*\\(\\(\\w\\|[$_]\\)+_t\\|float\\|double\\|void\\|char\\|short\\|int\\|long\\|FILE\\|\\(\\(struct\\|union\\|enum\\|class\\)\\([ \t]+\\(\\w\\|[$_]\\)*\\)\\)\\)\\(\\s +\\*+)?\\|[ \n\t;()]\\)" nil type) | 1019 | ("[ \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) |
| 1174 | ;; key words | 1020 | ;; key words |
| 1175 | ("\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\|public\\|protected\\|private\\|delete\\|new\\)\\>" | 1021 | ("[^_]\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\|public\\|protected\\|private\\|delete\\|new\\)\\>[^_]" |
| 1176 | nil keyword))) | 1022 | 1 keyword))) |
| 1177 | 1023 | ||
| 1178 | (hilit-set-mode-patterns | 1024 | (hilit-set-mode-patterns |
| 1179 | 'perl-mode | 1025 | 'perl-mode |
| @@ -1289,9 +1135,9 @@ Finds [^QCHAR]\" ... [^\\]\"" | |||
| 1289 | ;; things that bring in external files | 1135 | ;; things that bring in external files |
| 1290 | ("\\\\\\(include\\|input\\|bibliography\\){" "}" include) | 1136 | ("\\\\\\(include\\|input\\|bibliography\\){" "}" include) |
| 1291 | 1137 | ||
| 1292 | ;; "wysiwyg" emphasis | 1138 | ;; "wysiwyg" emphasis -- these don't work with nested expressions |
| 1293 | ("{\\\\\\(em\\|it\\|sl\\)" "}" italic) | 1139 | ;; ("{\\\\\\(em\\|it\\|sl\\)" "}" italic) |
| 1294 | ("{\\\\bf" "}" bold) | 1140 | ;; ("{\\\\bf" "}" bold) |
| 1295 | 1141 | ||
| 1296 | ("``" "''" string) | 1142 | ("``" "''" string) |
| 1297 | 1143 | ||
| @@ -1309,38 +1155,39 @@ Finds [^QCHAR]\" ... [^\\]\"" | |||
| 1309 | 1155 | ||
| 1310 | (hilit-set-mode-patterns | 1156 | (hilit-set-mode-patterns |
| 1311 | 'compilation-mode | 1157 | 'compilation-mode |
| 1312 | '(("^[^ \t]*:[0-9]+:.*$" nil error) | 1158 | '( |
| 1313 | ("^[^ \t]*:[0-9]+: warning:.*$" nil warning))) | 1159 | ("^[-_.\"A-Za-z0-9]+\\(:\\|, line \\)[0-9]+: warning:.*$" nil warning) |
| 1160 | ("^[-_.\"A-Za-z0-9]+\\(:\\|, line \\)[0-9]+:.*$" nil error) | ||
| 1161 | )) | ||
| 1314 | 1162 | ||
| 1315 | (hilit-set-mode-patterns | 1163 | (hilit-set-mode-patterns |
| 1316 | 'makefile-mode | 1164 | 'makefile-mode |
| 1317 | '(("^#.*$" nil comment) | 1165 | '(("^#.*$" nil comment) |
| 1318 | ("[^$]#.*$" nil comment) | 1166 | ("[^$]#.*$" nil comment) |
| 1319 | ;; rules | 1167 | ;; rules |
| 1320 | ("^%.*$" nil rule) | 1168 | ("^[^ \t\n]*%[^ \t\n]*[ \t]*::?[ \t]*[^ \t\n]*[ \t]*\\(#.*\\)?$" nil rule) |
| 1321 | ("^[.][A-Za-z][A-Za-z]?\..*$" nil rule) | 1169 | ("^[.][A-Za-z][A-Za-z]?\..*$" nil rule) |
| 1322 | ;; variable definition | 1170 | ;; variable definition |
| 1323 | ("^[_A-Za-z0-9]+ *\+?=" nil define) | 1171 | ("^[_A-Za-z0-9]+[ \t]*\+?=" nil define) |
| 1324 | ("\\( \\|:=\\)[_A-Za-z0-9]+ *\\+=" nil define) | 1172 | ("\\( \\|:=\\)[_A-Za-z0-9]+[ \t]*\\+=" nil define) |
| 1325 | ;; variable references | 1173 | ;; variable references |
| 1326 | ("\$[_A-Za-z0-9]" nil type) | 1174 | ("\\$\\([^ \t\n{(]\\|[{(]@?[_A-Za-z0-9:.,%/=]+[)}]\\)" nil keyword) |
| 1327 | ("\${[_A-Za-z0-9]+}" nil type) | 1175 | ("^[A-Za-z0-9.,/_-]+[ \t]*:.*$" nil defun) |
| 1328 | ("\$\([_A-Za-z0-9]+\)" nil type) | ||
| 1329 | ("^include " nil include))) | 1176 | ("^include " nil include))) |
| 1330 | 1177 | ||
| 1331 | (let* ((header-patterns '(("^Subject:.*$" nil msg-subject) | 1178 | (let* ((header-patterns '(("^Subject:.*$" nil msg-subject) |
| 1332 | ("^From:.*$" nil msg-from) | 1179 | ("^From:.*$" nil msg-from) |
| 1333 | ("^--text follows this line--$" nil msg-separator) | 1180 | ("^--text follows this line--$" nil msg-separator) |
| 1334 | ("^[A-Za-z][A-Za-z0-9-]+:" nil msg-header))) | 1181 | ("^[A-Za-z][A-Za-z0-9-]+:" nil msg-header))) |
| 1335 | (body-patterns '(("^\\(In article\\|[ \t]*\\w*[]>}|]\\).*$" | 1182 | (body-patterns '(("^\\(In article\\|[ \t]*\\w*[]<>}|]\\).*$" |
| 1336 | nil msg-quote))) | 1183 | nil msg-quote))) |
| 1337 | (message-patterns (append header-patterns body-patterns))) | 1184 | (message-patterns (append header-patterns body-patterns))) |
| 1338 | (hilit-set-mode-patterns 'msg-header header-patterns) | 1185 | (hilit-set-mode-patterns 'msg-header header-patterns) |
| 1339 | (hilit-set-mode-patterns 'msg-body body-patterns) | 1186 | (hilit-set-mode-patterns 'msg-body body-patterns) |
| 1340 | (hilit-set-mode-patterns | 1187 | (hilit-set-mode-patterns '(vm-mode text-mode mail-mode rmail-mode |
| 1341 | '(vm-mode text-mode mail-mode rmail-mode gnus-article-mode news-reply-mode) | 1188 | gnus-article-mode news-reply-mode mh-show-mode) |
| 1342 | message-patterns | 1189 | message-patterns |
| 1343 | 'hilit-rehighlight-message)) | 1190 | 'hilit-rehighlight-message)) |
| 1344 | 1191 | ||
| 1345 | (hilit-set-mode-patterns | 1192 | (hilit-set-mode-patterns |
| 1346 | 'gnus-group-mode | 1193 | 'gnus-group-mode |