diff options
| author | Karoly Lorentey | 2005-06-15 12:57:51 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2005-06-15 12:57:51 +0000 |
| commit | ef85512e51f043d73788f00a2aed13cccde0682c (patch) | |
| tree | fc1fa1378533250f260ef8eaa9a84ae882d9df84 /lisp/font-lock.el | |
| parent | 8736257554f49445f7b4402ac7a9436b38ce6452 (diff) | |
| parent | ef88a9999004e6c26148c8d280d6a41f623d7249 (diff) | |
| download | emacs-ef85512e51f043d73788f00a2aed13cccde0682c.tar.gz emacs-ef85512e51f043d73788f00a2aed13cccde0682c.zip | |
Merged from miles@gnu.org--gnu-2005 (patch 80-82, 350-422)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-350
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-351
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-352
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-353
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-354
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-355
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-356
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-357
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-358
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-359
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-360
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-361
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-362
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-363
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-364
Remove "-face" suffix from widget faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365
Remove "-face" suffix from custom faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366
Remove "-face" suffix from change-log faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-367
Remove "-face" suffix from compilation faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-368
Remove "-face" suffix from diff-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-369
lisp/longlines.el (longlines-visible-face): Face removed
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-370
Remove "-face" suffix from woman faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-371
Remove "-face" suffix from whitespace-highlight face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372
Remove "-face" suffix from ruler-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-373
Remove "-face" suffix from show-paren faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-374
Remove "-face" suffix from log-view faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-375
Remove "-face" suffix from smerge faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-376
Remove "-face" suffix from show-tabs faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-377
Remove "-face" suffix from highlight-changes faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-378
Remove "-face" suffix from and downcase info faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-379
Remove "-face" suffix from pcvs faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-380
Update uses of renamed pcvs faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-381
Tweak ChangeLog
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-382
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-383
Remove "-face" suffix from strokes-char face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-384
Remove "-face" suffix from compare-windows face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-385
Remove "-face" suffix from calendar faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386
Remove "-face" suffix from diary-button face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387
Remove "-face" suffix from testcover faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-388
Remove "-face" suffix from viper faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389
Remove "-face" suffix from org faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-390
Remove "-face" suffix from sgml-namespace face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-391
Remove "-face" suffix from table-cell face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-392
Remove "-face" suffix from tex-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-393
Remove "-face" suffix from texinfo-heading face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394
Remove "-face" suffix from flyspell faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-395
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-396
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-397
Remove "-face" suffix from gomoku faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-398
Remove "-face" suffix from mpuz faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-399
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-400
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-401
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-402
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-403
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-404
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-405
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-406
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-407
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-408
Remove "-face" suffix from Buffer-menu-buffer face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-409
Remove "-face" suffix from antlr-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-410
Remove "-face" suffix from ebrowse faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-411
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412
Remove "-face" suffix from flymake faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-413
Remove "-face" suffix from idlwave faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-414
Remove "-face" suffix from sh-script faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-415
Remove "-face" suffix from vhdl-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-416
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-417
Remove "-face" suffix from which-func face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-418
Remove "-face" suffix from cperl-mode faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-419
Remove "-face" suffix from ld-script faces
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-420
Fix cperl-mode font-lock problem
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-421
Tweak which-func face
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-422
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-80
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-81
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-82
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-350
Diffstat (limited to 'lisp/font-lock.el')
| -rw-r--r-- | lisp/font-lock.el | 62 |
1 files changed, 45 insertions, 17 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 10b4d67aabe..06afd1017e7 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -683,9 +683,22 @@ For example: | |||
| 683 | adds two fontification patterns for C mode, to fontify `FIXME:' words, even in | 683 | adds two fontification patterns for C mode, to fontify `FIXME:' words, even in |
| 684 | comments, and to fontify `and', `or' and `not' words as keywords. | 684 | comments, and to fontify `and', `or' and `not' words as keywords. |
| 685 | 685 | ||
| 686 | When used from a Lisp program (such as a minor mode), it is recommended to | 686 | The above procedure will only add the keywords for C mode, not |
| 687 | use nil for MODE (and place the call on a hook) to avoid subtle problems | 687 | for modes derived from C mode. To add them for derived modes too, |
| 688 | due to details of the implementation. | 688 | pass nil for MODE and add the call to c-mode-hook. |
| 689 | |||
| 690 | For example: | ||
| 691 | |||
| 692 | (add-hook 'c-mode-hook | ||
| 693 | (lambda () | ||
| 694 | (font-lock-add-keywords nil | ||
| 695 | '((\"\\\\\\=<\\\\(FIXME\\\\):\" 1 font-lock-warning-face prepend) | ||
| 696 | (\"\\\\\\=<\\\\(and\\\\|or\\\\|not\\\\)\\\\\\=>\" . | ||
| 697 | font-lock-keyword-face))))) | ||
| 698 | |||
| 699 | The above procedure may fail to add keywords to derived modes if | ||
| 700 | some involved major mode does not follow the standard conventions. | ||
| 701 | File a bug report if this happens, so the major mode can be corrected. | ||
| 689 | 702 | ||
| 690 | Note that some modes have specialized support for additional patterns, e.g., | 703 | Note that some modes have specialized support for additional patterns, e.g., |
| 691 | see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types', | 704 | see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types', |
| @@ -704,7 +717,8 @@ see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types', | |||
| 704 | (font-lock-update-removed-keyword-alist mode keywords append)) | 717 | (font-lock-update-removed-keyword-alist mode keywords append)) |
| 705 | (t | 718 | (t |
| 706 | ;; Otherwise set or add the keywords now. | 719 | ;; Otherwise set or add the keywords now. |
| 707 | ;; This is a no-op if it has been done already in this buffer. | 720 | ;; This is a no-op if it has been done already in this buffer |
| 721 | ;; for the correct major mode. | ||
| 708 | (font-lock-set-defaults) | 722 | (font-lock-set-defaults) |
| 709 | (let ((was-compiled (eq (car font-lock-keywords) t))) | 723 | (let ((was-compiled (eq (car font-lock-keywords) t))) |
| 710 | ;; Bring back the user-level (uncompiled) keywords. | 724 | ;; Bring back the user-level (uncompiled) keywords. |
| @@ -774,9 +788,11 @@ see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types', | |||
| 774 | MODE should be a symbol, the major mode command name, such as `c-mode' | 788 | MODE should be a symbol, the major mode command name, such as `c-mode' |
| 775 | or nil. If nil, highlighting keywords are removed for the current buffer. | 789 | or nil. If nil, highlighting keywords are removed for the current buffer. |
| 776 | 790 | ||
| 777 | When used from a Lisp program (such as a minor mode), it is recommended to | 791 | To make the removal apply to modes derived from MODE as well, |
| 778 | use nil for MODE (and place the call on a hook) to avoid subtle problems | 792 | pass nil for MODE and add the call to MODE-hook. This may fail |
| 779 | due to details of the implementation." | 793 | for some derived modes if some involved major mode does not |
| 794 | follow the standard conventions. File a bug report if this | ||
| 795 | happens, so the major mode can be corrected." | ||
| 780 | (cond (mode | 796 | (cond (mode |
| 781 | ;; Remove one keyword at the time. | 797 | ;; Remove one keyword at the time. |
| 782 | (dolist (keyword keywords) | 798 | (dolist (keyword keywords) |
| @@ -889,7 +905,7 @@ The value of this variable is used when Font Lock mode is turned on." | |||
| 889 | 'font-lock-after-change-function t) | 905 | 'font-lock-after-change-function t) |
| 890 | (set (make-local-variable 'font-lock-fontify-buffer-function) | 906 | (set (make-local-variable 'font-lock-fontify-buffer-function) |
| 891 | 'jit-lock-refontify) | 907 | 'jit-lock-refontify) |
| 892 | ;; Don't fontify eagerly (and don't abort is the buffer is large). | 908 | ;; Don't fontify eagerly (and don't abort if the buffer is large). |
| 893 | (set (make-local-variable 'font-lock-fontified) t) | 909 | (set (make-local-variable 'font-lock-fontified) t) |
| 894 | ;; Use jit-lock. | 910 | ;; Use jit-lock. |
| 895 | (jit-lock-register 'font-lock-fontify-region | 911 | (jit-lock-register 'font-lock-fontify-region |
| @@ -1571,12 +1587,15 @@ A LEVEL of nil is equal to a LEVEL of 0, a LEVEL of t is equal to | |||
| 1571 | 1587 | ||
| 1572 | (defvar font-lock-set-defaults nil) ; Whether we have set up defaults. | 1588 | (defvar font-lock-set-defaults nil) ; Whether we have set up defaults. |
| 1573 | 1589 | ||
| 1590 | (defvar font-lock-mode-major-mode) | ||
| 1574 | (defun font-lock-set-defaults () | 1591 | (defun font-lock-set-defaults () |
| 1575 | "Set fontification defaults appropriately for this mode. | 1592 | "Set fontification defaults appropriately for this mode. |
| 1576 | Sets various variables using `font-lock-defaults' (or, if nil, using | 1593 | Sets various variables using `font-lock-defaults' (or, if nil, using |
| 1577 | `font-lock-defaults-alist') and `font-lock-maximum-decoration'." | 1594 | `font-lock-defaults-alist') and `font-lock-maximum-decoration'." |
| 1578 | ;; Set fontification defaults iff not previously set. | 1595 | ;; Set fontification defaults iff not previously set for correct major mode. |
| 1579 | (unless font-lock-set-defaults | 1596 | (unless (and font-lock-set-defaults |
| 1597 | (eq font-lock-mode-major-mode major-mode)) | ||
| 1598 | (setq font-lock-mode-major-mode major-mode) | ||
| 1580 | (set (make-local-variable 'font-lock-set-defaults) t) | 1599 | (set (make-local-variable 'font-lock-set-defaults) t) |
| 1581 | (make-local-variable 'font-lock-fontified) | 1600 | (make-local-variable 'font-lock-fontified) |
| 1582 | (make-local-variable 'font-lock-multiline) | 1601 | (make-local-variable 'font-lock-multiline) |
| @@ -1807,6 +1826,17 @@ Sets various variables using `font-lock-defaults' (or, if nil, using | |||
| 1807 | "Font Lock mode face used to highlight preprocessor directives." | 1826 | "Font Lock mode face used to highlight preprocessor directives." |
| 1808 | :group 'font-lock-highlighting-faces) | 1827 | :group 'font-lock-highlighting-faces) |
| 1809 | 1828 | ||
| 1829 | (defface font-lock-regexp-backslash | ||
| 1830 | '((((class color) (min-colors 16)) :inherit escape-glyph) | ||
| 1831 | (t :inherit bold)) | ||
| 1832 | "Font Lock mode face used to highlight a backslash in Lisp regexps." | ||
| 1833 | :group 'font-lock-highlighting-faces) | ||
| 1834 | |||
| 1835 | (defface font-lock-regexp-backslash-construct | ||
| 1836 | '((t :inherit bold)) | ||
| 1837 | "Font Lock mode face used to highlight `\' constructs in Lisp regexps." | ||
| 1838 | :group 'font-lock-highlighting-faces) | ||
| 1839 | |||
| 1810 | ;;; End of Colour etc. support. | 1840 | ;;; End of Colour etc. support. |
| 1811 | 1841 | ||
| 1812 | ;;; Menu support. | 1842 | ;;; Menu support. |
| @@ -2000,7 +2030,7 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item." | |||
| 2000 | `(;; Control structures. Emacs Lisp forms. | 2030 | `(;; Control structures. Emacs Lisp forms. |
| 2001 | (,(concat | 2031 | (,(concat |
| 2002 | "(" (regexp-opt | 2032 | "(" (regexp-opt |
| 2003 | '("cond" "if" "while" "let" "let*" | 2033 | '("cond" "if" "while" "while-no-input" "let" "let*" |
| 2004 | "prog" "progn" "progv" "prog1" "prog2" "prog*" | 2034 | "prog" "progn" "progv" "prog1" "prog2" "prog*" |
| 2005 | "inline" "lambda" "save-restriction" "save-excursion" | 2035 | "inline" "lambda" "save-restriction" "save-excursion" |
| 2006 | "save-window-excursion" "save-selected-window" | 2036 | "save-window-excursion" "save-selected-window" |
| @@ -2056,16 +2086,14 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item." | |||
| 2056 | ;; Make regexp grouping constructs bold, so they stand out, but only | 2086 | ;; Make regexp grouping constructs bold, so they stand out, but only |
| 2057 | ;; in strings. | 2087 | ;; in strings. |
| 2058 | ((lambda (bound) | 2088 | ((lambda (bound) |
| 2059 | (if (re-search-forward "\\(\\\\\\\\\\)\\([(|)]\\)\\(\\?:\\)?" bound t) | 2089 | (if (re-search-forward "\\(\\\\\\\\\\)\\((\\(?:?:\\)?\\|[|)]\\)" bound t) |
| 2060 | (let ((face (get-text-property (1- (point)) 'face))) | 2090 | (let ((face (get-text-property (1- (point)) 'face))) |
| 2061 | (if (listp face) | 2091 | (if (listp face) |
| 2062 | (memq 'font-lock-string-face face) | 2092 | (memq 'font-lock-string-face face) |
| 2063 | (eq 'font-lock-string-face face))))) | 2093 | (eq 'font-lock-string-face face))))) |
| 2064 | ;; Should we introduce a lowlight face for this? | 2094 | (1 'font-lock-regexp-backslash prepend) |
| 2065 | ;; Ideally that would retain the color, dimmed. | 2095 | (2 'font-lock-regexp-backslash-construct prepend)) |
| 2066 | (1 font-lock-comment-face prepend) | 2096 | |
| 2067 | (2 'bold prepend) | ||
| 2068 | (3 font-lock-type-face prepend t)) | ||
| 2069 | ;; Underline innermost grouping, so that you can more easily see what | 2097 | ;; Underline innermost grouping, so that you can more easily see what |
| 2070 | ;; belongs together. 2005-05-12: Font-lock can go into an | 2098 | ;; belongs together. 2005-05-12: Font-lock can go into an |
| 2071 | ;; unbreakable endless loop on this -- something's broken. | 2099 | ;; unbreakable endless loop on this -- something's broken. |