diff options
| -rw-r--r-- | lisp/hilit19.el | 544 |
1 files changed, 385 insertions, 159 deletions
diff --git a/lisp/hilit19.el b/lisp/hilit19.el index 960fdafd98b..2bf5f920a43 100644 --- a/lisp/hilit19.el +++ b/lisp/hilit19.el | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | ;; hilit19.el (Release 2.7) -- customizable highlighting for Emacs19. | 1 | ;; hilit19.el (Release 2.19) -- 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> |
| @@ -39,12 +39,12 @@ | |||
| 39 | ;; | 39 | ;; |
| 40 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 40 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 41 | ;; | 41 | ;; |
| 42 | ;; hilit19.el,v 2.7 1993/07/30 02:43:01 stig Release | 42 | ;; hilit19.el,v 2.19 1993/09/08 18:44:10 stig Release |
| 43 | ;; | 43 | ;; |
| 44 | ;; LCD Archive Entry: | 44 | ;; LCD Archive Entry: |
| 45 | ;; hilit19|Jonathan Stigelman|Stig@netcom.com| | 45 | ;; hilit19|Jonathan Stigelman|Stig@netcom.com| |
| 46 | ;; Comprehensive (and comparatively fast) regex-based highlighting for Emacs 19| | 46 | ;; Comprehensive (and comparatively fast) regex-based highlighting for Emacs 19| |
| 47 | ;; 1993/07/30 02:43:01|Release 2.7|~/packages/hilit19.el.Z| | 47 | ;; 1993/09/08 18:44:10|Release 2.19|~/packages/hilit19.el.Z| |
| 48 | ;; | 48 | ;; |
| 49 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 49 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 50 | ;; | 50 | ;; |
| @@ -97,12 +97,14 @@ | |||
| 97 | ;; SETUP -- Are you using the right font for Emacs? | 97 | ;; SETUP -- Are you using the right font for Emacs? |
| 98 | ;; | 98 | ;; |
| 99 | ;; Emacs cannot properly find bold and italic fonts unless you specify a | 99 | ;; Emacs cannot properly find bold and italic fonts unless you specify a |
| 100 | ;; verbose X11 font name. Here's a good font menu: | 100 | ;; verbose X11 font name. If you specify a font for emacs in your |
| 101 | ;; .Xdefaults, it *MUST* be specified using the long form of the font name. | ||
| 102 | ;; Here's a good font menu: | ||
| 101 | ;; | 103 | ;; |
| 102 | ;; (setq | 104 | ;; (setq |
| 103 | ;; x-fixed-font-alist | 105 | ;; x-fixed-font-alist |
| 104 | ;; '("Font Menu" | 106 | ;; '("Font Menu" |
| 105 | ;; ("Fonts" | 107 | ;; ("Misc" |
| 106 | ;; ("6x12" "-misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-*-1") | 108 | ;; ("6x12" "-misc-fixed-medium-r-semicondensed--12-110-75-75-c-60-*-1") |
| 107 | ;; ("6x13" "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-*-1") | 109 | ;; ("6x13" "-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-*-1") |
| 108 | ;; ("lucida 13" | 110 | ;; ("lucida 13" |
| @@ -133,15 +135,8 @@ | |||
| 133 | ;; * When more than one size of font is used in different frames, only one | 135 | ;; * When more than one size of font is used in different frames, only one |
| 134 | ;; font size can have bold & italic properties. | 136 | ;; font size can have bold & italic properties. |
| 135 | ;; | 137 | ;; |
| 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. | 138 | ;; * unbalanced, unescaped double quote characters can confuse hilit19. |
| 144 | ;; This will be fixed, so don't bug me about it. | 139 | ;; This will be fixed someday, so don't bug me about it. |
| 145 | ;; | 140 | ;; |
| 146 | ;; * ALTHOUGH HILIT19 IS FASTER THAN FONT-LOCK-MODE... | 141 | ;; * ALTHOUGH HILIT19 IS FASTER THAN FONT-LOCK-MODE... |
| 147 | ;; For various reasons, the speed of the package could still stand to be | 142 | ;; For various reasons, the speed of the package could still stand to be |
| @@ -170,12 +165,89 @@ | |||
| 170 | ;; Alon Albert <alon@milcse.rtsg.mot.com>, advice & patches | 165 | ;; Alon Albert <alon@milcse.rtsg.mot.com>, advice & patches |
| 171 | ;; dana@thumper.bellcore.com (Dana A. Chee), working on the multi-frame bug | 166 | ;; dana@thumper.bellcore.com (Dana A. Chee), working on the multi-frame bug |
| 172 | ;; derway@ndc.com (Don Erway), for breaking it... | 167 | ;; derway@ndc.com (Don Erway), for breaking it... |
| 168 | ;; moss_r@summer.chem.su.oz.au (Richard Moss), first pass at add-pattern | ||
| 169 | ;; Olivier Lecarme <ol@aiguemarine.unice.fr>, Pascal & Icon patterns | ||
| 173 | ;; | 170 | ;; |
| 174 | ;; With suggestions and minor regex patches from numerous others... | 171 | ;; With suggestions and minor regex patches from numerous others... |
| 175 | ;; | 172 | ;; |
| 176 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 173 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 177 | ;; | 174 | ;; |
| 178 | ;; hilit19.el,v | 175 | ;; hilit19.el,v |
| 176 | ;; Revision 2.19 1993/09/08 18:44:10 stig | ||
| 177 | ;; installed patch for elusive bug in hilit-rehighlight-region that caused | ||
| 178 | ;; hilit-unhighlight-region to hang in an infinite loop. | ||
| 179 | ;; | ||
| 180 | ;; Revision 2.18 1993/08/27 03:51:00 stig | ||
| 181 | ;; minor mods to lisp-mode and c/c++ mode patterns | ||
| 182 | ;; | ||
| 183 | ;; Revision 2.17 1993/08/25 02:19:17 stig | ||
| 184 | ;; work-around for bug in next-overlay-change that caused dired and jargon-mode | ||
| 185 | ;; to hang in an endless loop. Perhaps other modes were doing this too. | ||
| 186 | ;; | ||
| 187 | ;; Revision 2.16 1993/08/22 19:46:00 stig | ||
| 188 | ;; bug fix for next-overlay-change and accompanying change to | ||
| 189 | ;; hilit-unhighlight-region | ||
| 190 | ;; | ||
| 191 | ;; Revision 2.15 1993/08/20 12:16:22 stig | ||
| 192 | ;; minor change to fortran patterns | ||
| 193 | ;; | ||
| 194 | ;; Revision 2.14 1993/08/17 14:12:10 stig | ||
| 195 | ;; added default face mapping for 'formula' which is needed for new latex | ||
| 196 | ;; patterns. | ||
| 197 | ;; | ||
| 198 | ;; twiddled the calendar-mode patterns a bit. | ||
| 199 | ;; | ||
| 200 | ;; Revision 2.13 1993/08/16 04:33:54 stig | ||
| 201 | ;; hilit-set-mode-patterns was screwing up two part patterns. it doesn't now. | ||
| 202 | ;; | ||
| 203 | ;; Revision 2.12 1993/08/16 00:16:41 stig | ||
| 204 | ;; changed references to default-bold-italic to just bold-italic because the | ||
| 205 | ;; font for that face is maintained by emacs. | ||
| 206 | ;; | ||
| 207 | ;; the pattern matcher now starts it's searches from the end of the most | ||
| 208 | ;; recently highlighted region (which is not necessarily the end of the most | ||
| 209 | ;; recently matched regex). | ||
| 210 | ;; | ||
| 211 | ;; multiple errors in pattern matcher now just give an error instead of lots of | ||
| 212 | ;; annoying messages and dings. | ||
| 213 | ;; | ||
| 214 | ;; no longer use vm-summary-mode-hooks. | ||
| 215 | ;; | ||
| 216 | ;; some code moved from hilit-highlight-region to hilit-set-mode-patterns. | ||
| 217 | ;; This will affect you if you pass your patterns directly to | ||
| 218 | ;; hilit-highlight-region....use a pseudo-mode instead. | ||
| 219 | ;; | ||
| 220 | ;; pattern changes to C/C++, latex, texinfo, fortran, nroff, etc. | ||
| 221 | ;; | ||
| 222 | ;; Revision 2.11 1993/08/13 12:12:37 stig | ||
| 223 | ;; removed some crufty commented-out code | ||
| 224 | ;; | ||
| 225 | ;; diverged lisp-mode and emacs-lisp-mode...also added lisp keywords. | ||
| 226 | ;; | ||
| 227 | ;; Revision 2.10 1993/08/13 09:47:06 stig | ||
| 228 | ;; added calendar-mode, icon-mode and pascal-mode patterns | ||
| 229 | ;; | ||
| 230 | ;; commented out hilit-toggle-highlight because I want to phase it out entirely | ||
| 231 | ;; | ||
| 232 | ;; Revision 2.9 1993/08/13 08:44:22 stig | ||
| 233 | ;; added optional case-fold argument to hilit-set-mode-patterns, this case-fold | ||
| 234 | ;; parameter is now stored in hilit-patterns-alist. | ||
| 235 | ;; | ||
| 236 | ;; Revision 2.8 1993/08/12 22:05:03 stig | ||
| 237 | ;; fixed some typos in documentation | ||
| 238 | ;; | ||
| 239 | ;; twiddled some of the color defaults for dark backgrounds | ||
| 240 | ;; | ||
| 241 | ;; always get 'mono color defaults if (not (x-display-color-p)) | ||
| 242 | ;; | ||
| 243 | ;; added hilit-rehighlight-buffer-quietly to dired-after-readin-hook | ||
| 244 | ;; | ||
| 245 | ;; fixed bug in hilit-string-find that mishandled strings of the form: "\\" | ||
| 246 | ;; | ||
| 247 | ;; NEW FUNCTION: hilit-add-mode-pattern... kinda like add-hook for patterns | ||
| 248 | ;; | ||
| 249 | ;; fixed minor pattern bugs for latex-mode and emacs-lisp-mode | ||
| 250 | ;; | ||
| 179 | ;; Revision 2.7 1993/07/30 02:43:01 stig | 251 | ;; Revision 2.7 1993/07/30 02:43:01 stig |
| 180 | ;; added const to the list of modifiers for C/C++ types | 252 | ;; added const to the list of modifiers for C/C++ types |
| 181 | ;; | 253 | ;; |
| @@ -255,7 +327,7 @@ | |||
| 255 | "* T if we should highlight all buffers as we find 'em, nil to disable | 327 | "* T if we should highlight all buffers as we find 'em, nil to disable |
| 256 | automatic highlighting by the find-file hook.") | 328 | automatic highlighting by the find-file hook.") |
| 257 | 329 | ||
| 258 | (defvar hilit-auto-highlight-maxout 57000 | 330 | (defvar hilit-auto-highlight-maxout 60000 ; hilit19 keeps getting bigger... |
| 259 | "* auto-highlight is disabled in buffers larger than this") | 331 | "* auto-highlight is disabled in buffers larger than this") |
| 260 | 332 | ||
| 261 | (defvar hilit-auto-rehighlight t | 333 | (defvar hilit-auto-rehighlight t |
| @@ -308,11 +380,14 @@ like to make this more universal?") | |||
| 308 | (defvar hilit-patterns-alist nil | 380 | (defvar hilit-patterns-alist nil |
| 309 | "alist of major-mode values and default highlighting patterns | 381 | "alist of major-mode values and default highlighting patterns |
| 310 | 382 | ||
| 311 | A hilighting pattern is a list of the form (start end face), where | 383 | A highlighting pattern is a list of the form (start end face), where |
| 312 | start is a regex, end is a regex (or nil if it's not needed) and face | 384 | start is a regex, end is either a regex or a match number for start, and face |
| 313 | is the name of an entry in hilit-face-translation-table, the name of a face, | 385 | is the name of an entry in hilit-face-translation-table, the name of a face, |
| 314 | or nil (which disables the pattern). | 386 | or nil (which disables the pattern). |
| 315 | 387 | ||
| 388 | Each entry in the alist is of the form: | ||
| 389 | (mode . (case-fold pattern [pattern ...])) | ||
| 390 | |||
| 316 | See the hilit-lookup-face-create documentation for valid face names.") | 391 | See the hilit-lookup-face-create documentation for valid face names.") |
| 317 | 392 | ||
| 318 | (defvar hilit-predefined-face-list (face-list) | 393 | (defvar hilit-predefined-face-list (face-list) |
| @@ -321,19 +396,21 @@ See the hilit-lookup-face-create documentation for valid face names.") | |||
| 321 | If hilit19 is dumped into emacs at your site, you may have to set this in | 396 | If hilit19 is dumped into emacs at your site, you may have to set this in |
| 322 | your init file.") | 397 | your init file.") |
| 323 | 398 | ||
| 399 | (eval-when-compile (setq byte-optimize t)) | ||
| 400 | |||
| 324 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 401 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 325 | ;; Use this to report bugs: | 402 | ;; Use this to report bugs: |
| 326 | 403 | ||
| 327 | (eval-when-compile (require 'reporter)) ; no compilation gripes | 404 | (eval-when-compile (require 'reporter)) ; no compilation gripes |
| 328 | 405 | ||
| 329 | (defun hilit-submit-feeback () | 406 | (defun hilit-submit-feedback () |
| 330 | "Submit feedback on hilit19 to the author: Stig@netcom.com" | 407 | "Submit feedback on hilit19 to the author: Stig@netcom.com" |
| 331 | (interactive) | 408 | (interactive) |
| 332 | (require 'reporter) | 409 | (require 'reporter) |
| 333 | (and (y-or-n-p "Do you really want to submit a report on hilit19? ") | 410 | (and (y-or-n-p "Do you really want to submit a report on hilit19? ") |
| 334 | (reporter-submit-bug-report | 411 | (reporter-submit-bug-report |
| 335 | "Jonathan Stigelman <Stig@netcom.com>" | 412 | "Jonathan Stigelman <Stig@netcom.com>" |
| 336 | "hilit19.el (Release 2.7)" | 413 | "hilit19.el (Release 2.19)" |
| 337 | (and (y-or-n-p "Do you need to include a dump hilit variables? ") | 414 | (and (y-or-n-p "Do you need to include a dump hilit variables? ") |
| 338 | (append | 415 | (append |
| 339 | '( | 416 | '( |
| @@ -361,15 +438,15 @@ your init file.") | |||
| 361 | "This is (check all that apply, and delete what's irrelevant):\n" | 438 | "This is (check all that apply, and delete what's irrelevant):\n" |
| 362 | " [ ] a _MASSIVE_THANK_YOU_ for writing hilit19.el\n" | 439 | " [ ] a _MASSIVE_THANK_YOU_ for writing hilit19.el\n" |
| 363 | " [ ] An invitation to attend the next Hackers Conference\n" | 440 | " [ ] An invitation to attend the next Hackers Conference\n" |
| 364 | " [ ] my DONATION to your vacation fund (prototype digital cash)\n" | ||
| 365 | " [ ] You're a RIGHTEOUS HACKER, what are your rates?\n" | 441 | " [ ] You're a RIGHTEOUS HACKER, what are your rates?\n" |
| 366 | " [ ] I've used the force and read the source, but I'M CONFUSED\n" | 442 | " [ ] I've used the force and read the source, but I'M CONFUSED\n" |
| 367 | " [ ] a PATCH (diff -cw oldversion newversion) to fix a problem\n" | 443 | " [ ] a PATCH. (output of 'diff -uw old.el new.el' or 'diff -cw')\n" |
| 368 | " [ ] a REPRODUCABLE BUG that I do not believe to be an EMACS bug\n" | 444 | " [ ] a SERIOUS AND REPRODUCABLE BUG that is not an EMACS bug\n" |
| 369 | " - I *swear* that it's not already mentioned in the KNOWN BUGS\n" | 445 | " - I *swear* that it's not already mentioned in the KNOWN BUGS\n" |
| 370 | " - Also, I have checked netcom.com:/pub/stig/src/hilit19.el.gz\n" | 446 | " - I HAVE CHECKED netcom.com:/pub/stig/src/Beta/hilit19.el.gz\n" |
| 371 | " for a newer release that fixes the problem.\n" | 447 | " for a newer release that fixes the problem.\n" |
| 372 | " [ ] ADVICE -- or an unfulfilled desire that I suspect you share\n" | 448 | " >> I HAVE ALSO CHECKED netcom.com:/pub/stig/src/Beta/hl319.el.gz\n" |
| 449 | " This is the alpha version...what will become hilit19 (Beta 3.0).\n" | ||
| 373 | "\n" | 450 | "\n" |
| 374 | "Hey Stig, I *know* you're busy but...\n")))) | 451 | "Hey Stig, I *know* you're busy but...\n")))) |
| 375 | 452 | ||
| @@ -382,13 +459,13 @@ your init file.") | |||
| 382 | '( | 459 | '( |
| 383 | ;; used for C/C++ and elisp and perl | 460 | ;; used for C/C++ and elisp and perl |
| 384 | (comment firebrick-italic moccasin italic) | 461 | (comment firebrick-italic moccasin italic) |
| 385 | (include purple Plum1 default-bold-italic) | 462 | (include purple Plum1 bold-italic) |
| 386 | (define ForestGreen-bold green bold) | 463 | (define ForestGreen-bold green bold) |
| 387 | (defun blue-bold cyan-bold default-bold-italic) | 464 | (defun blue-bold cyan-bold bold-italic) |
| 388 | (decl RoyalBlue cyan bold) | 465 | (decl RoyalBlue cyan bold) |
| 389 | (type nil yellow nil) | 466 | (type nil yellow nil) |
| 390 | (keyword RoyalBlue cyan default-bold-italic) | 467 | (keyword RoyalBlue cyan bold-italic) |
| 391 | (label red-bold orange-underlined underline) | 468 | (label red-underline orange-underlined underline) |
| 392 | (string grey40 orange underline) | 469 | (string grey40 orange underline) |
| 393 | 470 | ||
| 394 | ;; some further faces for Ada | 471 | ;; some further faces for Ada |
| @@ -398,40 +475,41 @@ your init file.") | |||
| 398 | 475 | ||
| 399 | ;; and anotherone for LaTeX | 476 | ;; and anotherone for LaTeX |
| 400 | (crossref DarkGoldenrod Goldenrod underline) | 477 | (crossref DarkGoldenrod Goldenrod underline) |
| 478 | (formula Goldenrod DarkGoldenrod underline) | ||
| 401 | 479 | ||
| 402 | ;; compilation buffers | 480 | ;; compilation buffers |
| 403 | (active-error default/pink-bold default/DeepPink-bold bold-underline) | 481 | (active-error default/pink-bold default/DeepPink-bold default-underline) |
| 404 | (error red-bold yellow bold) | 482 | (error red-bold yellow bold) |
| 405 | (warning blue-italic green italic) | 483 | (warning blue-italic green italic) |
| 406 | 484 | ||
| 407 | ;; Makefiles (some faces borrowed from C/C++ too) | 485 | ;; Makefiles (some faces borrowed from C/C++ too) |
| 408 | (rule blue-bold-underline cyan-underline bold-underline) | 486 | (rule blue-bold-underline cyan-underline default-bold-underline) |
| 409 | 487 | ||
| 410 | ;; VM, GNUS and Text mode | 488 | ;; VM, GNUS and Text mode |
| 411 | (msg-subject blue-bold yellow bold) | 489 | (msg-subject blue-bold yellow bold) |
| 412 | (msg-from purple-bold SeaGreen bold) | 490 | (msg-from purple-bold green bold) |
| 413 | (msg-header firebrick-bold cyan italic) | 491 | (msg-header firebrick-bold cyan italic) |
| 414 | (msg-separator black/tan-bold lightblue nil) | 492 | (msg-separator black/tan-bold black/lightblue nil) |
| 415 | (msg-quote ForestGreen green italic) | 493 | (msg-quote ForestGreen pink italic) |
| 416 | 494 | ||
| 417 | (summary-seen grey40 white nil) | 495 | (summary-seen grey40 white nil) |
| 418 | (summary-killed grey50 white nil) | 496 | (summary-killed grey50 white nil) |
| 419 | (summary-Xed OliveDrab2 green nil) | 497 | (summary-Xed OliveDrab2 green nil) |
| 420 | (summary-deleted firebrick white italic) | 498 | (summary-deleted firebrick white italic) |
| 421 | (summary-unread RoyalBlue yellow bold) | 499 | (summary-unread RoyalBlue yellow bold) |
| 422 | (summary-new blue-bold yellow-bold default-bold-italic) | 500 | (summary-new blue-bold yellow-bold bold-italic) |
| 423 | (summary-current default/skyblue-bold green/LightGrey-bold reverse-default) | 501 | (summary-current default/skyblue-bold green/dimgrey-bold reverse-default) |
| 424 | 502 | ||
| 425 | (gnus-group-unsubscribed grey50 white nil) | 503 | (gnus-group-unsubscribed grey50 white nil) |
| 426 | (gnus-group-empty nil yellow nil) | 504 | (gnus-group-empty nil nil nil) |
| 427 | (gnus-group-full ForestGreen green italic) | 505 | (gnus-group-full ForestGreen green italic) |
| 428 | (gnus-group-overflowing firebrick orange default-bold-italic) | 506 | (gnus-group-overflowing firebrick red bold-italic) |
| 429 | 507 | ||
| 430 | ;; dired mode | 508 | ;; dired mode |
| 431 | (dired-directory blue-bold cyan bold) | 509 | (dired-directory blue-bold cyan bold) |
| 432 | (dired-link firebrick-italic green italic) | 510 | (dired-link firebrick-italic green italic) |
| 433 | (dired-ignored ForestGreen moccasin nil) | 511 | (dired-ignored ForestGreen moccasin nil) |
| 434 | (dired-deleted red-bold-italic orange default-bold-italic) | 512 | (dired-deleted red-bold-italic orange bold-italic) |
| 435 | (dired-marked purple Plum1 nil) | 513 | (dired-marked purple Plum1 nil) |
| 436 | 514 | ||
| 437 | ;; Info-mode, and jargon-mode.el and prep.ai.mit.edu:/pub/gnu/jargon* | 515 | ;; Info-mode, and jargon-mode.el and prep.ai.mit.edu:/pub/gnu/jargon* |
| @@ -439,11 +517,18 @@ your init file.") | |||
| 439 | (jargon-xref purple-bold Plum1 italic) | 517 | (jargon-xref purple-bold Plum1 italic) |
| 440 | (jargon-keyword firebrick-underline yellow underline) | 518 | (jargon-keyword firebrick-underline yellow underline) |
| 441 | ) | 519 | ) |
| 442 | "alist of default faces (face . (light-default dark-default mono-default))") | 520 | "alist of default faces (face . (light-default dark-default mono-default)) |
| 521 | |||
| 522 | There is no way for the user to modify this table such that it will have any | ||
| 523 | effect upon the translations used by hilit19. Instead, use the function | ||
| 524 | hilit-translate AFTER hilit19 has been loaded. | ||
| 525 | |||
| 526 | See also the documentation for hilit-lookup-face-create.") | ||
| 443 | 527 | ||
| 444 | (defconst hilit-face-translation-table | 528 | (defconst hilit-face-translation-table |
| 445 | (let ((index (or (cdr (assq hilit-background-mode | 529 | (let ((index (or (and (x-display-color-p) |
| 446 | '((light . 1) (dark . 2)))) | 530 | (cdr (assq hilit-background-mode |
| 531 | '((light . 1) (dark . 2))))) | ||
| 447 | 3))) | 532 | 3))) |
| 448 | (mapcar (function (lambda (x) (cons (car x) (nth index x)))) | 533 | (mapcar (function (lambda (x) (cons (car x) (nth index x)))) |
| 449 | hilit-default-face-table)) | 534 | hilit-default-face-table)) |
| @@ -583,11 +668,12 @@ The optional 5th arg, PROP is a property to set instead of 'hilit." | |||
| 583 | "Unhighlights the region from START to END, optionally in a QUIET way" | 668 | "Unhighlights the region from START to END, optionally in a QUIET way" |
| 584 | (interactive "r") | 669 | (interactive "r") |
| 585 | (or quietly hilit-quietly (message "Unhighlighting")) | 670 | (or quietly hilit-quietly (message "Unhighlighting")) |
| 586 | (while (< start end) | 671 | (let ((lstart 0)) |
| 587 | (mapcar (function (lambda (ovr) | 672 | (while (and start (> start lstart) (< start end)) |
| 588 | (and (overlay-get ovr 'hilit) (delete-overlay ovr)))) | 673 | (mapcar (function (lambda (ovr) |
| 589 | (overlays-at start)) | 674 | (and (overlay-get ovr 'hilit) (delete-overlay ovr)))) |
| 590 | (setq start (next-overlay-change start))) | 675 | (overlays-at start)) |
| 676 | (setq lstart start start (next-overlay-change start)))) | ||
| 591 | (or quietly hilit-quietly (message "Done unhighlighting"))) | 677 | (or quietly hilit-quietly (message "Done unhighlighting"))) |
| 592 | 678 | ||
| 593 | ;;;; These functions use text properties instead of overlays. Text properties | 679 | ;;;; These functions use text properties instead of overlays. Text properties |
| @@ -625,12 +711,13 @@ non-nil." | |||
| 625 | ((symbolp patterns) | 711 | ((symbolp patterns) |
| 626 | (setq patterns (cdr (assq patterns hilit-patterns-alist))))) | 712 | (setq patterns (cdr (assq patterns hilit-patterns-alist))))) |
| 627 | ;; txt prop: (setq patterns (reverse patterns)) | 713 | ;; txt prop: (setq patterns (reverse patterns)) |
| 628 | (let ((prio (length patterns)) | 714 | (let ((case-fold-search (car patterns)) |
| 629 | (case-fold-search nil) | 715 | (prio (1- (length patterns))) |
| 630 | ;; txt prop: (buffer-read-only nil) | 716 | ;; txt prop: (buffer-read-only nil) |
| 631 | ;; txt prop: (bm (buffer-modified-p)) | 717 | ;; txt prop: (bm (buffer-modified-p)) |
| 632 | p pstart pend face mstart) | 718 | p pstart pend face mstart (puke-count 0)) |
| 633 | ;; txt prop: (unwind-protect | 719 | ;; txt prop: (unwind-protect |
| 720 | (setq patterns (cdr patterns)) ; remove case-fold from head of pattern | ||
| 634 | (save-excursion | 721 | (save-excursion |
| 635 | (save-restriction | 722 | (save-restriction |
| 636 | (narrow-to-region start end) | 723 | (narrow-to-region start end) |
| @@ -643,9 +730,9 @@ non-nil." | |||
| 643 | nil | 730 | nil |
| 644 | (or quietly hilit-quietly | 731 | (or quietly hilit-quietly |
| 645 | (message "highlighting %d: %s%s" prio pstart | 732 | (message "highlighting %d: %s%s" prio pstart |
| 646 | (if pend (concat " ... " pend) ""))) | 733 | (if (stringp pend) (concat " ... " pend) ""))) |
| 647 | (goto-char (point-min)) | 734 | (goto-char (point-min)) |
| 648 | (condition-case nil | 735 | (condition-case msg |
| 649 | (cond | 736 | (cond |
| 650 | ((symbolp pstart) | 737 | ((symbolp pstart) |
| 651 | ;; inner loop -- special function to find pattern | 738 | ;; inner loop -- special function to find pattern |
| @@ -661,18 +748,20 @@ non-nil." | |||
| 661 | (hilit-region-set-face mstart (match-end 0) | 748 | (hilit-region-set-face mstart (match-end 0) |
| 662 | face prio) | 749 | face prio) |
| 663 | (forward-char 1)))) | 750 | (forward-char 1)))) |
| 664 | (t | 751 | ((numberp pend) |
| 665 | (or (numberp pend) (setq pend 0)) | ||
| 666 | ;; inner loop -- just one regex to match whole pattern | 752 | ;; inner loop -- just one regex to match whole pattern |
| 667 | (while (re-search-forward pstart nil t nil) | 753 | (while (re-search-forward pstart nil t nil) |
| 754 | (goto-char (match-end pend)) | ||
| 668 | (hilit-region-set-face (match-beginning pend) | 755 | (hilit-region-set-face (match-beginning pend) |
| 669 | (match-end pend) face prio)))) | 756 | (match-end pend) face prio))) |
| 670 | (error (message "Unbalanced delimiters? Barfed on '%s'" | 757 | (t (error "malformed pattern"))) |
| 671 | pstart) | 758 | (error (if (> (setq puke-count (1+ puke-count)) 1) |
| 672 | (ding) (sit-for 4)))) | 759 | (error msg) |
| 760 | (message "Error: '%s'" msg) | ||
| 761 | (ding) (sit-for 4))))) | ||
| 673 | (setq prio (1- prio) | 762 | (setq prio (1- prio) |
| 674 | patterns (cdr patterns))) | 763 | patterns (cdr patterns))) |
| 675 | )) | 764 | )) |
| 676 | (or quietly hilit-quietly (message "")) ; "Done highlighting" | 765 | (or quietly hilit-quietly (message "")) ; "Done highlighting" |
| 677 | ;; txt prop: (set-buffer-modified-p bm)) ; unwind protection | 766 | ;; txt prop: (set-buffer-modified-p bm)) ; unwind protection |
| 678 | )) | 767 | )) |
| @@ -680,10 +769,12 @@ non-nil." | |||
| 680 | (defun hilit-rehighlight-region (start end &optional quietly) | 769 | (defun hilit-rehighlight-region (start end &optional quietly) |
| 681 | "Re-highlights the region, optionally in a QUIET way" | 770 | "Re-highlights the region, optionally in a QUIET way" |
| 682 | (interactive "r") | 771 | (interactive "r") |
| 683 | (setq start (apply 'min start (mapcar 'overlay-start (overlays-at start))) | 772 | (save-restriction |
| 684 | end (apply 'max end (mapcar 'overlay-end (overlays-at end)))) | 773 | (widen) |
| 685 | (hilit-unhighlight-region start end quietly) | 774 | (setq start (apply 'min start (mapcar 'overlay-start (overlays-at start))) |
| 686 | (hilit-highlight-region start end nil quietly)) | 775 | end (apply 'max end (mapcar 'overlay-end (overlays-at end)))) |
| 776 | (hilit-unhighlight-region start end quietly) | ||
| 777 | (hilit-highlight-region start end nil quietly))) | ||
| 687 | 778 | ||
| 688 | (defun hilit-rehighlight-buffer (&optional quietly) | 779 | (defun hilit-rehighlight-buffer (&optional quietly) |
| 689 | "Re-highlights the buffer, optionally in a QUIET way" | 780 | "Re-highlights the buffer, optionally in a QUIET way" |
| @@ -708,16 +799,19 @@ non-nil." | |||
| 708 | 799 | ||
| 709 | (defalias 'hilit-highlight-buffer 'hilit-rehighlight-buffer) | 800 | (defalias 'hilit-highlight-buffer 'hilit-rehighlight-buffer) |
| 710 | 801 | ||
| 711 | (defun hilit-toggle-highlight (arg) | 802 | ;; Well, I want to remove this function...there's one sure way to find out if |
| 712 | "Locally toggle highlighting. With arg, forces highlighting off." | 803 | ;; anyone uses it or not...and that's to comment it out. |
| 713 | (interactive "P") | 804 | ;; |
| 714 | ;; FIXME -- this loses numeric information in hilit-auto-rehighlight | 805 | ;; (defun hilit-toggle-highlight (arg) |
| 715 | (setq hilit-auto-rehighlight | 806 | ;; "Locally toggle highlighting. With arg, forces highlighting off." |
| 716 | (and (not arg) (not hilit-auto-rehighlight))) | 807 | ;; (interactive "P") |
| 717 | (if hilit-auto-rehighlight | 808 | ;; ;; FIXME -- this loses numeric information in hilit-auto-rehighlight |
| 718 | (hilit-rehighlight-buffer) | 809 | ;; (setq hilit-auto-rehighlight |
| 719 | (hilit-unhighlight-region (point-min) (point-max))) | 810 | ;; (and (not arg) (not hilit-auto-rehighlight))) |
| 720 | (message "Rehighlighting is set to %s" hilit-auto-rehighlight)) | 811 | ;; (if hilit-auto-rehighlight |
| 812 | ;; (hilit-rehighlight-buffer) | ||
| 813 | ;; (hilit-unhighlight-region (point-min) (point-max))) | ||
| 814 | ;; (message "Rehighlighting is set to %s" hilit-auto-rehighlight)) | ||
| 721 | 815 | ||
| 722 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 816 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| 723 | ;; HOOKS | 817 | ;; HOOKS |
| @@ -754,18 +848,6 @@ prefix argument if that is specified. | |||
| 754 | (if st | 848 | (if st |
| 755 | (hilit-rehighlight-region st en quietly)))) | 849 | (hilit-rehighlight-region st en quietly)))) |
| 756 | 850 | ||
| 757 | ;; (defun hilit-rehighlight-yank-region () | ||
| 758 | ;; "Rehighlights from the beginning of the line where the region starts to | ||
| 759 | ;; the end of the line where the region ends. This could flake out on | ||
| 760 | ;; multi-line highlights (like C comments and lisp strings.)" | ||
| 761 | ;; (if hilit-auto-rehighlight | ||
| 762 | ;; (hilit-rehighlight-region | ||
| 763 | ;; (save-excursion (goto-char (region-beginning)) | ||
| 764 | ;; (beginning-of-line) (point)) | ||
| 765 | ;; (save-excursion (goto-char (region-end)) | ||
| 766 | ;; (end-of-line) (point)) | ||
| 767 | ;; t))) | ||
| 768 | |||
| 769 | (defun hilit-recenter (arg) | 851 | (defun hilit-recenter (arg) |
| 770 | "Recenter, then rehighlight according to hilit-auto-rehighlight. If called | 852 | "Recenter, then rehighlight according to hilit-auto-rehighlight. If called |
| 771 | with an unspecified prefix argument (^U but no number), then a rehighlight of | 853 | with an unspecified prefix argument (^U but no number), then a rehighlight of |
| @@ -776,14 +858,6 @@ the entire buffer is forced." | |||
| 776 | (sit-for 0) | 858 | (sit-for 0) |
| 777 | (hilit-repaint-command (consp arg))) | 859 | (hilit-repaint-command (consp arg))) |
| 778 | 860 | ||
| 779 | ;; (defun hilit-redraw-display (arg) | ||
| 780 | ;; "Rehighlights according to the value of hilit-auto-rehighlight, a prefix | ||
| 781 | ;; arg forces a rehighlight of the whole buffer. Otherwise just like | ||
| 782 | ;; redraw-display." | ||
| 783 | ;; (interactive "P") | ||
| 784 | ;; (hilit-redraw-internal arg) | ||
| 785 | ;; (redraw-display)) | ||
| 786 | |||
| 787 | (defun hilit-yank (arg) | 861 | (defun hilit-yank (arg) |
| 788 | "Yank with rehighlighting" | 862 | "Yank with rehighlighting" |
| 789 | (interactive "*P") | 863 | (interactive "*P") |
| @@ -898,12 +972,9 @@ the entire buffer is forced." | |||
| 898 | (lambda (hook) | 972 | (lambda (hook) |
| 899 | (add-hook hook 'hilit-rehighlight-buffer-quietly))) | 973 | (add-hook hook 'hilit-rehighlight-buffer-quietly))) |
| 900 | '( | 974 | '( |
| 901 | compilation-parse-hook | ||
| 902 | |||
| 903 | Info-select-hook ; FIXME -- phase this out later | ||
| 904 | Info-selection-hook | 975 | Info-selection-hook |
| 905 | 976 | ||
| 906 | vm-summary-mode-hooks | 977 | ;; runs too early vm-summary-mode-hooks |
| 907 | vm-summary-pointer-hook | 978 | vm-summary-pointer-hook |
| 908 | vm-preview-message-hook | 979 | vm-preview-message-hook |
| 909 | vm-show-message-hook | 980 | vm-show-message-hook |
| @@ -915,9 +986,11 @@ the entire buffer is forced." | |||
| 915 | rmail-show-message-hook | 986 | rmail-show-message-hook |
| 916 | mail-setup-hook | 987 | mail-setup-hook |
| 917 | mh-show-mode-hook | 988 | mh-show-mode-hook |
| 989 | |||
| 990 | dired-after-readin-hook | ||
| 918 | )) | 991 | )) |
| 919 | 992 | ||
| 920 | ;; rehilight only the visible part of the summary buffer for speed. | 993 | ;; rehighlight only visible part of summary buffer for speed. |
| 921 | (add-hook 'gnus-mark-article-hook | 994 | (add-hook 'gnus-mark-article-hook |
| 922 | (function | 995 | (function |
| 923 | (lambda () | 996 | (lambda () |
| @@ -956,9 +1029,20 @@ the entire buffer is forced." | |||
| 956 | (setcdr oldentry val) | 1029 | (setcdr oldentry val) |
| 957 | (set alist (cons (cons key val) (eval alist)))))) | 1030 | (set alist (cons (cons key val) (eval alist)))))) |
| 958 | 1031 | ||
| 959 | (defun hilit-set-mode-patterns (modelist patterns &optional parse-fn) | 1032 | (defun hilit-set-mode-patterns (modelist patterns |
| 1033 | &optional parse-fn case-fold) | ||
| 960 | "Sets the default highlighting patterns for MODE to PATTERNS. | 1034 | "Sets the default highlighting patterns for MODE to PATTERNS. |
| 961 | See the variable hilit-mode-enable-list." | 1035 | See the variable hilit-mode-enable-list. |
| 1036 | |||
| 1037 | Takes optional arguments PARSE-FN and CASE-FOLD." | ||
| 1038 | ;; change pattern | ||
| 1039 | (mapcar (function (lambda (p) | ||
| 1040 | (and (stringp (car p)) | ||
| 1041 | (null (nth 1 p)) | ||
| 1042 | (setcar (cdr p) 0)))) | ||
| 1043 | patterns) | ||
| 1044 | (setq patterns (cons case-fold patterns)) | ||
| 1045 | |||
| 962 | (or (consp modelist) (setq modelist (list modelist))) | 1046 | (or (consp modelist) (setq modelist (list modelist))) |
| 963 | (let (ok (flip (eq (car hilit-mode-enable-list) 'not))) | 1047 | (let (ok (flip (eq (car hilit-mode-enable-list) 'not))) |
| 964 | (mapcar (function | 1048 | (mapcar (function |
| @@ -967,59 +1051,96 @@ See the variable hilit-mode-enable-list." | |||
| 967 | (memq m hilit-mode-enable-list))) | 1051 | (memq m hilit-mode-enable-list))) |
| 968 | (and flip (setq ok (not ok))) | 1052 | (and flip (setq ok (not ok))) |
| 969 | (and ok | 1053 | (and ok |
| 970 | (progn | 1054 | (progn |
| 971 | (and parse-fn | 1055 | (and parse-fn |
| 972 | (hilit-associate 'hilit-parser-alist m parse-fn)) | 1056 | (hilit-associate 'hilit-parser-alist m parse-fn)) |
| 973 | (hilit-associate 'hilit-patterns-alist m patterns))))) | 1057 | (hilit-associate 'hilit-patterns-alist m patterns))))) |
| 974 | modelist))) | 1058 | modelist))) |
| 975 | 1059 | ||
| 1060 | (defun hilit-add-pattern (pstart pend face &optional mode first) | ||
| 1061 | "Highlight pstart with face for the current major-mode. | ||
| 1062 | Optionally, place the new pattern first in the pattern list" | ||
| 1063 | (interactive "sPattern start regex: \nsPattern end regex (default none): \nxFace: ") | ||
| 1064 | |||
| 1065 | (and (equal pstart "") (error "Must specify starting regex")) | ||
| 1066 | (cond ((equal pend "") (setq pend 0)) | ||
| 1067 | ((string-match "^[0-9]+$" pend) (setq pend (string-to-int pend)))) | ||
| 1068 | (or mode (setq mode major-mode)) | ||
| 1069 | (let ((old-patterns (cdr (assq mode hilit-patterns-alist))) | ||
| 1070 | (new-pat (list pstart pend face))) | ||
| 1071 | (cond ((not old-patterns) | ||
| 1072 | (hilit-set-mode-patterns mode (list new-pat))) | ||
| 1073 | (first | ||
| 1074 | (setcdr old-patterns (cons new-pat (cdr old-patterns)))) | ||
| 1075 | (t | ||
| 1076 | (nconc old-patterns (list new-pat))))) | ||
| 1077 | (and (interactive-p) (hilit-rehighlight-buffer))) | ||
| 1078 | |||
| 976 | (defun hilit-string-find (qchar) | 1079 | (defun hilit-string-find (qchar) |
| 977 | "looks for a string and returns (start . end) or NIL. The argument QCHAR | 1080 | "looks for a string and returns (start . end) or NIL. The argument QCHAR |
| 978 | is the character that would precede a character constant double quote. | 1081 | is the character that would precede a character constant double quote. |
| 979 | Finds [^QCHAR]\" ... [^\\]\"" | 1082 | Finds strings delimited by double quotes. The first double quote may not be |
| 1083 | preceded by QCHAR and the closing double quote may not be preceded by an odd | ||
| 1084 | number of backslashes." | ||
| 980 | (let (st en) | 1085 | (let (st en) |
| 981 | (while (and (search-forward "\"" nil t) | 1086 | (while (and (search-forward "\"" nil t) |
| 982 | (eq qchar (char-after (1- (setq st (match-beginning 0))))))) | 1087 | (eq qchar (char-after (1- (setq st (match-beginning 0))))))) |
| 983 | (while (and (search-forward "\"" nil t) | 1088 | (while (and (search-forward "\"" nil t) |
| 984 | (eq ?\\ (char-after (- (setq en (point)) 2))))) | 1089 | (save-excursion |
| 1090 | (setq en (point)) | ||
| 1091 | (forward-char -1) | ||
| 1092 | (skip-chars-backward "\\\\") | ||
| 1093 | (forward-char 1) | ||
| 1094 | (not (zerop (% (- en (point)) 2)))))) | ||
| 985 | (and en (cons st en)))) | 1095 | (and en (cons st en)))) |
| 986 | 1096 | ||
| 987 | (hilit-set-mode-patterns | 1097 | ;; return types on same line... |
| 988 | '(c-mode c++-c-mode elec-c-mode) | 1098 | ;; ("^[a-zA-z].*\\(\\w\\|[$_]\\)+\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) |
| 989 | '(("/\\*" "\\*/" comment) | ||
| 990 | ; ("\"" "[^\\]\"" string) | ||
| 991 | (hilit-string-find ?' string) | ||
| 992 | ;; declaration | ||
| 993 | ("^#[ \t]*\\(undef\\|define\\).*$" nil define) | ||
| 994 | ("^#.*$" nil include) | ||
| 995 | ;; function decls are expected to have types on the previous line | ||
| 996 | ("^\\(\\w\\|[$_]\\)+\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) | ||
| 997 | ("^\\(typedef\\|struct\\|union\\|enum\\).*$" nil decl) | ||
| 998 | ;; datatype -- black magic regular expression | ||
| 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) | ||
| 1000 | ;; key words | ||
| 1001 | ("[^_]\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\)\\>[^_]" 1 keyword) | ||
| 1002 | )) | ||
| 1003 | 1099 | ||
| 1004 | (hilit-set-mode-patterns | 1100 | ;; On another note, a working pattern for grabbing function definitions for C is |
| 1005 | 'c++-mode | 1101 | ;; |
| 1006 | '(("/\\*" "\\*/" comment) | 1102 | ;; ("^[a-zA-Z_]+.*[;{]$" nil ForestGreen) ; global defns ( start at col 1 ) |
| 1007 | ("//.*$" nil comment) | 1103 | ;; ("^[a-zA-Z_]+.*(" ")" defun) |
| 1008 | ("^/.*$" nil comment) | 1104 | ;; ; defuns assumed to start at col 1, not with # or { |
| 1009 | ; ("\"" "[^\\]\"" string) | 1105 | ;; |
| 1010 | (hilit-string-find ?' string) | 1106 | ;; this will make external declarations/definitions green, and function |
| 1011 | ;; declaration | 1107 | ;; definitions the defun face. Hmmm - seems to work for me anyway. |
| 1012 | ("^#[ \t]*\\(undef\\|define\\).*$" nil define) | 1108 | |
| 1013 | ("^#.*$" nil include) | 1109 | (let ((comments '(("/\\*" "\\*/" comment))) |
| 1014 | ;; function decls are expected to have types on the previous line | 1110 | (c++-comments '(("//.*$" nil comment) |
| 1015 | ("^\\(\\(\\w\\|[$_]\\)+::\\)?\\(\\w\\|[$_]\\)+\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) | 1111 | ("^/.*$" nil comment))) |
| 1016 | ("^\\(\\(\\w\\|[$_]\\)+[ \t]*::[ \t]*\\)?\\(\\(\\w\\|[$_]\\)+\\|operator.*\\)\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) | 1112 | (strings '((hilit-string-find ?' string))) |
| 1017 | ("^\\(template\\|typedef\\|struct\\|union\\|class\\|enum\\|public\\|private\\|protected\\).*$" nil decl) | 1113 | (preprocessor '(("^#[ \t]*\\(undef\\|define\\).*$" "[^\\]$" define) |
| 1018 | ;; datatype -- black magic regular expression | 1114 | ("^#.*$" nil include)))) |
| 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) | 1115 | |
| 1020 | ;; key words | 1116 | (hilit-set-mode-patterns |
| 1021 | ("[^_]\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\|public\\|protected\\|private\\|delete\\|new\\)\\>[^_]" | 1117 | '(c-mode c++-c-mode elec-c-mode) |
| 1022 | 1 keyword))) | 1118 | (append |
| 1119 | comments strings preprocessor | ||
| 1120 | '( | ||
| 1121 | ;; function decls are expected to have types on the previous line | ||
| 1122 | ("^\\(\\w\\|[$_]\\)+\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) | ||
| 1123 | ("^\\(typedef\\|struct\\|union\\|enum\\).*$" nil decl) | ||
| 1124 | ;; datatype -- black magic regular expression | ||
| 1125 | ("[ \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) | ||
| 1126 | ;; key words | ||
| 1127 | ("[^_]\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\)\\>[^_]" 1 keyword) | ||
| 1128 | ))) | ||
| 1129 | |||
| 1130 | (hilit-set-mode-patterns | ||
| 1131 | 'c++-mode | ||
| 1132 | (append | ||
| 1133 | comments c++-comments strings preprocessor | ||
| 1134 | '( | ||
| 1135 | ;; function decls are expected to have types on the previous line | ||
| 1136 | ("^\\(\\(\\w\\|[$_]\\)+::\\)?\\(\\w\\|[$_]\\)+\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) | ||
| 1137 | ("^\\(\\(\\w\\|[$_]\\)+[ \t]*::[ \t]*\\)?\\(\\(\\w\\|[$_]\\)+\\|operator.*\\)\\s *\\(\\(\\w\\|[$_]\\)+\\s *((\\|(\\)[^)]*)+" nil defun) | ||
| 1138 | ("^\\(template\\|typedef\\|struct\\|union\\|class\\|enum\\|public\\|private\\|protected\\).*$" nil decl) | ||
| 1139 | ;; datatype -- black magic regular expression | ||
| 1140 | ("[ \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) | ||
| 1141 | ;; key words | ||
| 1142 | ("[^_]\\<\\(return\\|goto\\|if\\|else\\|case\\|default\\|switch\\|break\\|continue\\|while\\|do\\|for\\|public\\|protected\\|private\\|delete\\|new\\)\\>[^_]" | ||
| 1143 | 1 keyword))))) | ||
| 1023 | 1144 | ||
| 1024 | (hilit-set-mode-patterns | 1145 | (hilit-set-mode-patterns |
| 1025 | 'perl-mode | 1146 | 'perl-mode |
| @@ -1063,16 +1184,17 @@ Finds [^QCHAR]\" ... [^\\]\"" | |||
| 1063 | (hilit-set-mode-patterns | 1184 | (hilit-set-mode-patterns |
| 1064 | 'fortran-mode | 1185 | 'fortran-mode |
| 1065 | '(("^[*Cc].*$" nil comment) | 1186 | '(("^[*Cc].*$" nil comment) |
| 1066 | ("[ \t]\\(call\\|program\\|subroutine\\|function\\|stop\\|return\\|end\\|include\\)[ \t\n]" nil include) | 1187 | ("'[^'\n]*'" nil string) |
| 1067 | ("\\(^[ \t]*[0-9]+\\|[ \t]continue[ \t\n]\\|format\\)" nil define) | 1188 | ("\\(^[ \t]*[0-9]+\\|[ \t]continue[ \t\n]\\|format\\)" nil define) |
| 1068 | ("[ \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) | 1189 | ("[ \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) |
| 1190 | ("[ \t]\\(call\\|program\\|subroutine\\|function\\|stop\\|return\\|end\\|include\\)[ \t\n]" nil include) | ||
| 1069 | ("[ \t]\\(parameter[\t\n ]*([^)]*)\\|data\\|save\\|common[ \t\n]*/[^/]*/\\)" | 1191 | ("[ \t]\\(parameter[\t\n ]*([^)]*)\\|data\\|save\\|common[ \t\n]*/[^/]*/\\)" |
| 1070 | nil decl) | 1192 | nil decl) |
| 1071 | ("^ ." nil type) | 1193 | ("^ ." nil type) |
| 1072 | ("implicit[ \t]*none" nil decl) | 1194 | ("implicit[ \t]*none" nil decl) |
| 1073 | ("\\([ \t]\\|implicit[ \t]*\\)\\(dimension\\|integer\\|real\\|double[ \t]*precision\\|character\\|logical\\|complex\\|double[ \t]*complex\\)\\([*][0-9]*\\|[ \t\n]\\)" nil keyword) | 1195 | ("\\([ \t]\\|implicit[ \t]*\\)\\(dimension\\|integer\\|real\\|double[ \t]*precision\\|character\\|logical\\|complex\\|double[ \t]*complex\\)\\([*][0-9]*\\|[ \t\n]\\)" nil keyword) |
| 1074 | ("'[^'\n]*'" nil string) | 1196 | ) |
| 1075 | )) | 1197 | nil 'case-insensitive) |
| 1076 | 1198 | ||
| 1077 | (hilit-set-mode-patterns | 1199 | (hilit-set-mode-patterns |
| 1078 | '(m2-mode modula-2-mode) | 1200 | '(m2-mode modula-2-mode) |
| @@ -1080,7 +1202,8 @@ Finds [^QCHAR]\" ... [^\\]\"" | |||
| 1080 | (hilit-string-find ?\\ string) | 1202 | (hilit-string-find ?\\ string) |
| 1081 | ("^[ \t]*PROCEDURE[ \t]+\\w+[^ \t(;]*" nil defun) | 1203 | ("^[ \t]*PROCEDURE[ \t]+\\w+[^ \t(;]*" nil defun) |
| 1082 | ("\\<\\(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) | 1204 | ("\\<\\(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) |
| 1083 | )) | 1205 | ) |
| 1206 | nil 'case-insensitive) | ||
| 1084 | 1207 | ||
| 1085 | (hilit-set-mode-patterns 'prolog-mode | 1208 | (hilit-set-mode-patterns 'prolog-mode |
| 1086 | '(("/\\*" "\\*/" comment) | 1209 | '(("/\\*" "\\*/" comment) |
| @@ -1115,7 +1238,7 @@ Finds [^QCHAR]\" ... [^\\]\"" | |||
| 1115 | 1238 | ||
| 1116 | ;; various declarations/definitions | 1239 | ;; various declarations/definitions |
| 1117 | ("\\\\\\(setlength\\|settowidth\\|addtolength\\|setcounter\\|addtocounter\\)" nil define) | 1240 | ("\\\\\\(setlength\\|settowidth\\|addtolength\\|setcounter\\|addtocounter\\)" nil define) |
| 1118 | ("\\\\\\(\\|title\\|author\\|date\\|thanks\\){" "}" define) | 1241 | ("\\\\\\(title\\|author\\|date\\|thanks\\){" "}" define) |
| 1119 | 1242 | ||
| 1120 | ("\\\\documentstyle\\(\\[.*\\]\\)?{" "}" decl) | 1243 | ("\\\\documentstyle\\(\\[.*\\]\\)?{" "}" decl) |
| 1121 | ("\\\\\\(begin\\|end\\|nofiles\\|includeonly\\){" "}" decl) | 1244 | ("\\\\\\(begin\\|end\\|nofiles\\|includeonly\\){" "}" decl) |
| @@ -1128,10 +1251,14 @@ Finds [^QCHAR]\" ... [^\\]\"" | |||
| 1128 | ("\\\\\\(bf\\|em\\|it\\|rm\\|sf\\|sl\\|ss\\|tt\\)\\b" nil decl) | 1251 | ("\\\\\\(bf\\|em\\|it\\|rm\\|sf\\|sl\\|ss\\|tt\\)\\b" nil decl) |
| 1129 | 1252 | ||
| 1130 | ;; label-like things | 1253 | ;; label-like things |
| 1131 | ("\\\\item\\[" "\\]" label) | 1254 | ("\\\\item\\(\\[[^]]*\\]\\)?" nil label) |
| 1132 | ("\\\\item\\b" nil label) | 1255 | ("\\\\caption\\(\\[[^]]*\\]\\)?{" "}" label) |
| 1133 | ("\\\\caption\\(\\[.*\\]\\)?{" "}" label) | 1256 | |
| 1134 | 1257 | ;; formulas | |
| 1258 | ("\\\\(" "\\\\)" formula) ; \( \) | ||
| 1259 | ("\\\\\\[" "\\\\\\]" formula) ; \[ \] | ||
| 1260 | ("[^$]\\($\\($[^$]*\\$\\|[^$]*\\)\\$\\)" 1 formula) ; '$...$' or '$$...$$' | ||
| 1261 | |||
| 1135 | ;; things that bring in external files | 1262 | ;; things that bring in external files |
| 1136 | ("\\\\\\(include\\|input\\|bibliography\\){" "}" include) | 1263 | ("\\\\\\(include\\|input\\|bibliography\\){" "}" include) |
| 1137 | 1264 | ||
| @@ -1215,17 +1342,48 @@ Finds [^QCHAR]\" ... [^\\]\"" | |||
| 1215 | ("^ N.*$" nil summary-new))) | 1342 | ("^ N.*$" nil summary-new))) |
| 1216 | 1343 | ||
| 1217 | 1344 | ||
| 1345 | ;;; this will match only comments w/ an even (zero is even) number of quotes... | ||
| 1346 | ;;; which is still inadequate because it matches comments in multi-line strings | ||
| 1347 | ;;; how anal do you want to get about never highlighting comments in strings? | ||
| 1348 | ;;; I could twiddle with this forever and still it wouldn't be perfect. | ||
| 1349 | ;;; (";\\([^\"\n]*\"[^\"\n]*\"\\)*[^\"\n]*$" nil comment) | ||
| 1350 | |||
| 1218 | (hilit-set-mode-patterns | 1351 | (hilit-set-mode-patterns |
| 1219 | '(emacs-lisp-mode lisp-mode) | 1352 | '(emacs-lisp-mode lisp-interaction-mode) |
| 1220 | '( | 1353 | '( |
| 1221 | (";.*" nil comment) | 1354 | (";.*" nil comment) |
| 1222 | ;;; ("^;.*$" nil comment) | 1355 | |
| 1223 | ;;; ("\\s ;+[ ;].*$" nil comment) | 1356 | ;;; This almost works...but I think I'll stick with the parser function |
| 1357 | ;;;("[^?]\\(\"\\(\"\\||\\([^\"]+\\|[\\]\\([\\][\\]\\)*\"\\)*\"\\)\\)" 1 string) | ||
| 1224 | (hilit-string-find ?\\ string) | 1358 | (hilit-string-find ?\\ string) |
| 1225 | ("^\\s *(def\\(un\\|macro\\|advice\\|subst\\)\\s " "\\()\\|nil\\)" defun) | 1359 | |
| 1360 | ("^\\s *(def\\(un\\|macro\\|advice\\|alias\\|subst\\)[ \t\n]" | ||
| 1361 | "\\()\\|nil\\)" defun) | ||
| 1226 | ("^\\s *(defvar\\s +\\S +" nil decl) | 1362 | ("^\\s *(defvar\\s +\\S +" nil decl) |
| 1227 | ("^\\s *(defconst\\s +\\S +" nil define) | 1363 | ("^\\s *(defconst\\s +\\S +" nil define) |
| 1228 | ("^\\s *(\\(provide\\|require\\|\\(auto\\)?load\\).*$" nil include) | 1364 | ("^\\s *(\\(provide\\|require\\|\\(auto\\)?load\\).*$" nil include) |
| 1365 | ("\\s *\\&\\(rest\\|optional\\)\\s *" nil keyword) | ||
| 1366 | ("(\\(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) | ||
| 1367 | )) | ||
| 1368 | |||
| 1369 | (hilit-set-mode-patterns | ||
| 1370 | '(lisp-mode ilisp-mode) | ||
| 1371 | '( | ||
| 1372 | (";.*" nil comment) | ||
| 1373 | ("#|" "|#" comment) | ||
| 1374 | ;;; This almost works...but I think I'll stick with the parser function | ||
| 1375 | ;;;("[^?]\\(\"\\(\"\\||\\([^\"]+\\|[\\]\\([\\][\\]\\)*\"\\)*\"\\)\\)" 1 string) | ||
| 1376 | (hilit-string-find ?\\ string) | ||
| 1377 | |||
| 1378 | ;; this is waaaaaaaay too slow | ||
| 1379 | ;; ("^\\s *(def\\(un\\|macro\\|advice\\|alias\\|method\\|subst\\)\\s \\S +[ \t\n]+\\(nil\\|(\\(([^()]*)\\|[^()]+\\)*)\\)" nil defun) | ||
| 1380 | ("^\\s *(def\\(un\\|macro\\|advice\\|subst\\|method\\)\\s " "\\()\\|nil\\)" defun) | ||
| 1381 | |||
| 1382 | ("^\\s *(\\(def\\(var\\|type\\|parameter\\)\\|declare\\)\\s +\\S +" nil decl) | ||
| 1383 | ("^\\s *(def\\(const\\(ant\\)?\\|class\\|struct\\)\\s \\S +[ \t\n]+\\((\\(([^()]*)\\|[^()]+\\)*)\\)?" nil define) | ||
| 1384 | ("^\\s *(\\(provide\\|require\\|\\(auto\\)?load\\).*$" nil include) | ||
| 1385 | ("[ \t]\\&\\(key\\|rest\\|optional\\|aux\\)\\s *" nil keyword) | ||
| 1386 | ("(\\(let\\*?\\|locally\\|cond\\|if\\*?\\|or\\|and\\|map\\(car\\|c[ao]n\\)?\\|prog[nv1*]?\\|while\\|when\\|unless\\|do\\(\\*\\|list\\|times\\)\\|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) | ||
| 1229 | )) | 1387 | )) |
| 1230 | 1388 | ||
| 1231 | 1389 | ||
| @@ -1237,7 +1395,7 @@ Finds [^QCHAR]\" ... [^\\]\"" | |||
| 1237 | ("{\\\\bf\\([^}]+\\)}" nil keyword) | 1395 | ("{\\\\bf\\([^}]+\\)}" nil keyword) |
| 1238 | ("^[ \t\n]*\\\\def[\\\\@]\\(\\w+\\)" nil defun) | 1396 | ("^[ \t\n]*\\\\def[\\\\@]\\(\\w+\\)" nil defun) |
| 1239 | ("\\\\\\(begin\\|end\\){\\([A-Za-z0-9\\*]+\\)}" nil defun) | 1397 | ("\\\\\\(begin\\|end\\){\\([A-Za-z0-9\\*]+\\)}" nil defun) |
| 1240 | ; ("[^\\\\]\\$\\([^$]*\\)\\$" nil string) | 1398 | ;; ("[^\\\\]\\$\\([^$]*\\)\\$" nil string) |
| 1241 | ("\\$\\([^$]*\\)\\$" nil string) | 1399 | ("\\$\\([^$]*\\)\\$" nil string) |
| 1242 | )) | 1400 | )) |
| 1243 | 1401 | ||
| @@ -1252,16 +1410,17 @@ Finds [^QCHAR]\" ... [^\\]\"" | |||
| 1252 | ("^\\.[ST]H.*$" nil defun) | 1410 | ("^\\.[ST]H.*$" nil defun) |
| 1253 | ;; ("^[^\\.].*\"[^\\\"]*\\(\\\\\\(.\\)[^\\\"]*\\)*\"" nil string) | 1411 | ;; ("^[^\\.].*\"[^\\\"]*\\(\\\\\\(.\\)[^\\\"]*\\)*\"" nil string) |
| 1254 | ("\"" "[^\\]\"" string) | 1412 | ("\"" "[^\\]\"" string) |
| 1255 | ("^\\.[A-Za-z12\\\\].*$" nil define) | 1413 | ("^\\.[A-Z12\\\\].*$" nil define) |
| 1256 | ("\\([\\\][^ ]*\\)" nil keyword) | 1414 | ("\\([\\\][^ ]*\\)" nil keyword) |
| 1257 | ("^\\.[a-zA-Z].*$" nil keyword))) | 1415 | ("^\\.[A-Z].*$" nil keyword)) |
| 1416 | nil 'case-insensitive) | ||
| 1258 | 1417 | ||
| 1259 | (hilit-set-mode-patterns | 1418 | (hilit-set-mode-patterns |
| 1260 | 'texinfo-mode | 1419 | 'texinfo-mode |
| 1261 | '(("^\\(@c\\|@comment\\)\\>.*$" nil comment) | 1420 | '(("^\\(@c\\|@comment\\)\\>.*$" nil comment) |
| 1262 | ("@\\(emph\\|strong\\|b\\|i\\){[^}]+}" nil comment) | 1421 | ("@\\(emph\\|strong\\|b\\|i\\){[^}]+}" nil comment) |
| 1263 | ; seems broken | 1422 | ;; seems broken |
| 1264 | ; ("\\$[^$]*\\$" nil string) | 1423 | ;; ("\\$[^$]*\\$" nil string) |
| 1265 | ("@\\(file\\|kbd\\|key\\){[^}]+}" nil string) | 1424 | ("@\\(file\\|kbd\\|key\\){[^}]+}" nil string) |
| 1266 | ("^\\*.*$" nil defun) | 1425 | ("^\\*.*$" nil defun) |
| 1267 | ("@\\(if\\w+\\|format\\|item\\)\\b.*$" nil defun) | 1426 | ("@\\(if\\w+\\|format\\|item\\)\\b.*$" nil defun) |
| @@ -1297,6 +1456,73 @@ Finds [^QCHAR]\" ... [^\\]\"" | |||
| 1297 | ("- \\(Variable\\|Function\\|Macro\\|Command\\|Special Form\\|User Option\\):.*$" | 1456 | ("- \\(Variable\\|Function\\|Macro\\|Command\\|Special Form\\|User Option\\):.*$" |
| 1298 | nil jargon-keyword))) ; lisp manual | 1457 | nil jargon-keyword))) ; lisp manual |
| 1299 | 1458 | ||
| 1459 | (hilit-set-mode-patterns | ||
| 1460 | 'calendar-mode | ||
| 1461 | '(("[A-Z][a-z]+ [0-9]+" nil define) ; month and year | ||
| 1462 | ("S M Tu W Th F S" nil label) ; week days | ||
| 1463 | ("[0-9]+\\*" nil defun) ; holidays | ||
| 1464 | ("[0-9]+\\+" nil comment) ; diary days | ||
| 1465 | )) | ||
| 1466 | |||
| 1467 | (hilit-set-mode-patterns | ||
| 1468 | 'pascal-mode | ||
| 1469 | '(("(\\*" "\\*)" comment) | ||
| 1470 | ("{" "}" comment) | ||
| 1471 | ;; Doesn't work when there are strings in comments.... | ||
| 1472 | ;; ("'[^']*'" nil string) | ||
| 1473 | ("^#.*$" nil include) | ||
| 1474 | ("^[ \t]*\\(procedure\\|function\\)[ \t]+\\w+[^ \t(;]*" nil defun) | ||
| 1475 | ("\\<\\(program\\|begin\\|end\\)\\>" nil defun) | ||
| 1476 | ("\\<\\(external\\|forward\\)\\>" nil include) | ||
| 1477 | ("\\<\\(label\\|const\\|type\\|var\\)\\>" nil define) | ||
| 1478 | ("\\<\\(record\\|array\\|file\\)\\>" nil type) | ||
| 1479 | ("\\<\\(of\\|to\\|for\\|if\\|then\\|else\\|case\\|while\\|do\\|until\\|and\\|or\\|not\\|with\\|repeat\\)\\>" nil keyword) | ||
| 1480 | ) | ||
| 1481 | nil 'case-insensitive) | ||
| 1482 | |||
| 1483 | (hilit-set-mode-patterns | ||
| 1484 | 'icon-mode | ||
| 1485 | '(("#.*$" nil comment) | ||
| 1486 | ("\"[^\\\"]*\\(\\\\.[^\\\"]*\\)*\"" nil string) | ||
| 1487 | ;; charsets: these do not work because of a conflict with strings | ||
| 1488 | ;; ("'[^\\']*\\(\\\\.[^\\']*\\)*'" nil string) | ||
| 1489 | ("^[ \t]*procedure[ \t]+\\w+[ \t]*(" ")" defun) | ||
| 1490 | ("^[ \t]*record.*(" ")" include) | ||
| 1491 | ("^[ \t]*\\(global\\|link\\)[ \t\n]+[A-Za-z_0-9]+\\([ \t\n]*,[ \t\n]*[A-Za-z_0-9]+\\)*" nil include) | ||
| 1492 | ("^[ \t]*\\(local\\|static\\)[ \t\n]+[A-Za-z_0-9]+\\([ \t\n]*,[ \t\n]*[A-Za-z_0-9]+\\)*" nil decl) | ||
| 1493 | ("\\<\\(initial\\|end\\)\\>" nil glob-struct) | ||
| 1494 | ("\\<\\(while\\|until\\|return\\|every\\|if\\|then\\|else\\|to\\|case\\|of\\|suspend\\|create\\|do\\|repeat\\|break\\)\\>" nil keyword) | ||
| 1495 | )) | ||
| 1496 | |||
| 1497 | ;; as you can see, I had two similar problems for Pascal and Icon. In | ||
| 1498 | ;; Pascal, strings are delimited with ' and an embedded quote is doubled, | ||
| 1499 | ;; thus string syntax would be extremely simple. However, if a string | ||
| 1500 | ;; occurs within a comment, the following text is considered a string. | ||
| 1501 | ;; | ||
| 1502 | ;; In Icon, strings are similar to C ones, but there are also charsets, | ||
| 1503 | ;; delimited with simple quotes. I could not manage to use both regexps at | ||
| 1504 | ;; the same time. | ||
| 1505 | |||
| 1506 | ;; The problem I have with my patterns for Icon is that this language has a | ||
| 1507 | ;; string similar constant to the C one (but a string can be cut on several | ||
| 1508 | ;; lines, if terminated by a dash and continued with initial blanks, like | ||
| 1509 | ;; this: | ||
| 1510 | ;; "This is a somewhat long - | ||
| 1511 | ;; string, written on three - | ||
| 1512 | ;; succesive lines" | ||
| 1513 | ;; in order to insert a double quote in a string, you have to escape it | ||
| 1514 | ;; with a \), bu also a character set constant (named a charset), which | ||
| 1515 | ;; uses single quotes instead of double ones. It would seem intuitive to | ||
| 1516 | ;; highlight both constants in the same way. | ||
| 1517 | |||
| 1518 | |||
| 1300 | (provide 'hilit19) | 1519 | (provide 'hilit19) |
| 1301 | 1520 | ||
| 1302 | ;;; hilit19 ends here. | 1521 | ;;; hilit19 ends here. |
| 1522 | |||
| 1523 | |||
| 1524 | ;; __________________________________________________________________________ | ||
| 1525 | ;; Stig@netcom.com netcom.com:/pub/stig/00-PGP-KEY | ||
| 1526 | ;; It's hard to be cutting-edge at your own pace... 32 DF B9 19 AE 28 D1 7A | ||
| 1527 | ;; Bullet-proof code cannot stand up to teflon bugs. A3 9D 0B 1A 33 13 4D 7F | ||
| 1528 | |||