X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Ffont-lock.el;h=5a9452c8797b9fcc83ffda2a378190ea87a14782;hb=270d6966591dfb276269008ea84fc8e6fcba073f;hp=ce98ccc11d2424a05da3e4dd71812df917a58973;hpb=76759ab036458c54499a454399e19602b8ae6ce3;p=chise%2Fxemacs-chise.git- diff --git a/lisp/font-lock.el b/lisp/font-lock.el index ce98ccc..5a9452c 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -2,7 +2,7 @@ ;; Copyright (C) 1992-1995, 1997 Free Software Foundation, Inc. ;; Copyright (C) 1995 Amdahl Corporation. -;; Copyright (C) 1996 Ben Wing. +;; Copyright (C) 1996, 2000 Ben Wing. ;; Author: Jamie Zawinski , for the LISPM Preservation Society. ;; Minimally merged with FSF 19.34 by Barry Warsaw @@ -390,7 +390,7 @@ megabyte for buffers in `rmail-mode', and size is irrelevant otherwise." For example, an element of the first form highlights (if not already highlighted): - \"\\\\\" Discrete occurrences of \"foo\" in the value + \"\\\\\\=\" Discrete occurrences of \"foo\" in the value of the variable `font-lock-keyword-face'. (\"fu\\\\(bar\\\\)\" . 1) Substring \"bar\" within all occurrences of @@ -409,7 +409,7 @@ For example, an element of the first form highlights (if not already highlighted `fubar-match' finds and matches in the value of `fubar-face'. - (\"\\\\\" (0 anchor-face) (\"\\\\\" nil nil (0 item-face))) + (\"\\\\\\=\" (0 anchor-face) (\"\\\\\\=\" nil nil (0 item-face))) -------------- --------------- ------------ --- --- ------------- | | | | | | MATCHER | ANCHOR-MATCHER | +------+ MATCH-HIGHLIGHT @@ -580,25 +580,55 @@ This is normally set via `font-lock-defaults'.") ;; #### barf gag retch. Horrid FSF lossage that we need to ;; keep around for compatibility with font-lock-keywords that -;; forget to properly quote their faces. +;; forget to properly quote their faces. I tried just let-binding +;; them when we eval the face expression, but that failes because +;; some files actually use the variables directly in their init code +;; without quoting them. --ben (defvar font-lock-comment-face 'font-lock-comment-face - "Don't even think of using this.") + "This variable should not be set. +It is present only for horrid FSF compatibility reasons. +The corresponding face should be set using `edit-faces' or the +`set-face-*' functions.") (defvar font-lock-doc-string-face 'font-lock-doc-string-face - "Don't even think of using this.") + "This variable should not be set. +It is present only for horrid FSF compatibility reasons. +The corresponding face should be set using `edit-faces' or the +`set-face-*' functions.") (defvar font-lock-string-face 'font-lock-string-face - "Don't even think of using this.") + "This variable should not be set. +It is present only for horrid FSF compatibility reasons. +The corresponding face should be set using `edit-faces' or the +`set-face-*' functions.") (defvar font-lock-keyword-face 'font-lock-keyword-face - "Don't even think of using this.") + "This variable should not be set. +It is present only for horrid FSF compatibility reasons. +The corresponding face should be set using `edit-faces' or the +`set-face-*' functions.") (defvar font-lock-function-name-face 'font-lock-function-name-face - "Don't even think of using this.") + "This variable should not be set. +It is present only for horrid FSF compatibility reasons. +The corresponding face should be set using `edit-faces' or the +`set-face-*' functions.") (defvar font-lock-variable-name-face 'font-lock-variable-name-face - "Don't even think of using this.") + "This variable should not be set. +It is present only for horrid FSF compatibility reasons. +The corresponding face should be set using `edit-faces' or the +`set-face-*' functions.") (defvar font-lock-type-face 'font-lock-type-face - "Don't even think of using this.") + "This variable should not be set. +It is present only for horrid FSF compatibility reasons. +The corresponding face should be set using `edit-faces' or the +`set-face-*' functions.") (defvar font-lock-reference-face 'font-lock-reference-face - "Don't even think of using this.") + "This variable should not be set. +It is present only for horrid FSF compatibility reasons. +The corresponding face should be set using `edit-faces' or the +`set-face-*' functions.") (defvar font-lock-preprocessor-face 'font-lock-preprocessor-face - "Don't even think of using this.") + "This variable should not be set. +It is present only for horrid FSF compatibility reasons. +The corresponding face should be set using `edit-faces' or the +`set-face-*' functions.") (defconst font-lock-face-list '(font-lock-comment-face @@ -863,9 +893,10 @@ See the variable `font-lock-keywords' for customization." ((or (null maximum-size) (<= (buffer-size) maximum-size)) (font-lock-fontify-buffer)) (font-lock-verbose - (lprogress-display 'font-lock - "Fontifying %s... buffer too big." 'abort - (buffer-name))))) + (progress-feedback-with-label + 'font-lock + "Fontifying %s... buffer too big." 'abort + (buffer-name))))) (font-lock-fontified (setq font-lock-fontified nil) (font-lock-unfontify-region (point-min) (point-max)) @@ -878,11 +909,13 @@ See the variable `font-lock-keywords' for customization." ;;;###autoload (defun turn-on-font-lock () "Unconditionally turn on Font Lock mode." + (interactive) (font-lock-mode 1)) ;;;###autoload (defun turn-off-font-lock () "Unconditionally turn off Font Lock mode." + (interactive) (font-lock-mode 0)) ;;; FSF has here: @@ -1030,8 +1063,8 @@ This can take a while for large buffers." (font-lock-mode 0))) (set (make-local-variable 'font-lock-fontified) t) (when (and aborted font-lock-verbose) - (lprogress-display 'font-lock "Fontifying %s... aborted." - 'abort (buffer-name)))) + (progress-feedback-with-label 'font-lock "Fontifying %s... aborted." + 'abort (buffer-name)))) (run-hooks 'font-lock-after-fontify-buffer-hook))) (defun font-lock-default-unfontify-buffer () @@ -1070,7 +1103,8 @@ This can take a while for large buffers." (defun font-lock-default-unfontify-region (beg end &optional maybe-loudly) (when (and maybe-loudly font-lock-verbose (>= (- end beg) font-lock-message-threshold)) - (lprogress-display 'font-lock "Fontifying %s..." 0 (buffer-name))) + (progress-feedback-with-label 'font-lock "Fontifying %s..." 0 + (buffer-name))) (let ((modified (buffer-modified-p)) (buffer-undo-list t) (inhibit-read-only t) buffer-file-name buffer-file-truename) @@ -1177,10 +1211,12 @@ buffer modifications are performed or a buffer is reverted.") ;; (if (or change-was-deletion (bobp) ;; (= (preceding-char) ?\n)) ;; (buffer-syntactic-context-flush-cache)) - (if (and (= beg (point-min)) - (= end (point-max))) - (font-lock-fontify-buffer) - (font-lock-fontify-region beg end))) + ;; #### This creates some unnecessary progress gauges. +;; (if (and (= beg (point-min)) +;; (= end (point-max))) +;; (font-lock-fontify-buffer) +;; (font-lock-fontify-region beg end))) + (font-lock-fontify-region beg end)) font-lock-range-table))))))) font-lock-pending-extent-table))) @@ -1315,8 +1351,9 @@ START should be at the beginning of a line." nil (when (and font-lock-verbose (>= (- end start) font-lock-message-threshold)) - (lprogress-display 'font-lock "Fontifying %s... (syntactically)" 5 - (buffer-name))) + (progress-feedback-with-label 'font-lock + "Fontifying %s... (syntactically)" 5 + (buffer-name))) (font-lock-unfontify-region start end loudly) (goto-char start) (if (> end (point-max)) (setq end (point-max))) @@ -1528,8 +1565,9 @@ START should be at the beginning of a line." (+ (/ (* (- (point) start) 95) (* (- end start) nkeywords)) (/ (* iter 95) nkeywords) 5)) (when (and loudly (> progress old-progress)) - (lprogress-display 'font-lock "Fontifying %s... (regexps)" - progress bufname)) + (progress-feedback-with-label 'font-lock + "Fontifying %s... (regexps)" + progress bufname)) (setq old-progress progress) ;; Apply each highlight to this instance of `matcher', which may be ;; specific highlights or more keywords anchored to `matcher'. @@ -1546,7 +1584,9 @@ START should be at the beginning of a line." (setq highlights (cdr highlights)))) (setq iter (1+ iter)) (setq keywords (cdr keywords)))) - (if loudly (lprogress-display 'font-lock "Fontifying %s... " 100 (buffer-name))))) + (if loudly + (progress-feedback-with-label 'font-lock "Fontifying %s... " 100 + (buffer-name))))) ;; Various functions. @@ -1849,30 +1889,39 @@ START should be at the beginning of a line." ;; ;; Control structures. ELisp and CLisp combined. ;; - ;;(regexp-opt - ;; '("cond" "if" "while" "let" "let*" "prog" "progn" "prog1" - ;; "prog2" "progv" "catch" "throw" "save-restriction" - ;; "save-excursion" "save-window-excursion" - ;; "save-current-buffer" "with-current-buffer" - ;; "with-temp-file" "with-temp-buffer" "with-output-to-string" - ;; "with-string-as-buffer-contents" - ;; "save-selected-window" "save-match-data" "unwind-protect" - ;; "condition-case" "track-mouse" "autoload" - ;; "eval-after-load" "eval-and-compile" "eval-when-compile" - ;; "when" "unless" "do" "dolist" "dotimes" "flet" "labels" - ;; "lambda" "return" "return-from")) (cons (concat "(\\(" - "autoload\\|c\\(atch\\|ond\\(ition-case\\)?\\)\\|do\\(list\\|" - "times\\)?\\|eval-\\(a\\(fter-load\\|nd-compile\\)\\|when-compile\\)\\|" - "flet\\|if\\|l\\(a\\(bels\\|mbda\\)\\|et\\*?\\)\\|" - "prog[nv12\\*]?\\|return\\(-from\\)?\\|save-\\(current-buffer\\|" - "excursion\\|match-data\\|restriction\\|selected-window\\|" - "window-excursion\\)\\|t\\(hrow\\|rack-mouse\\)\\|un\\(less\\|" - "wind-protect\\)\\|w\\(h\\(en\\|ile\\)\\|ith-\\(current-buffer\\|" - "output-to-string\\|string-as-buffer-contents\\|temp-\\(buffer\\|" - "file\\)\\)\\)" + ;; beginning of generated stuff + ;; to regenerate, use the regexp-opt below, then delete the outermost + ;; grouping, then use the macro below to break up the string. + ;; (regexp-opt + ;; '("cond" "if" "while" "let" "let*" "prog" "progn" "prog1" + ;; "prog2" "progv" "catch" "throw" "save-restriction" + ;; "save-excursion" "save-window-excursion" + ;; "save-current-buffer" "with-current-buffer" + ;; "save-selected-window" "with-selected-window" + ;; "save-selected-frame" "with-selected-frame" + ;; "with-temp-file" "with-temp-buffer" "with-output-to-string" + ;; "with-string-as-buffer-contents" + ;; "save-match-data" "unwind-protect" "call-with-condition-handler" + ;; "condition-case" "track-mouse" "autoload" + ;; "eval-after-load" "eval-and-compile" "eval-when-compile" + ;; "when" "unless" "do" "dolist" "dotimes" "flet" "labels" + ;; "lambda" "block" "return" "return-from" "loop") t) + ;; (setq last-kbd-macro + ;; (read-kbd-macro "\" C-7 C-1 C-r \\\\| 3* \" RET")) + "autoload\\|block\\|c\\(?:a\\(?:ll-with-condition-handler\\|tch\\)\\|" + "ond\\(?:ition-case\\)?\\)\\|do\\(?:list\\|times\\)?\\|" + "eval-\\(?:a\\(?:fter-load\\|nd-compile\\)\\|when-compile\\)\\|flet\\|" + "if\\|l\\(?:a\\(?:bels\\|mbda\\)\\|et\\*?\\|oop\\)\\|prog[12nv]?\\|" + "return\\(?:-from\\)?\\|save-\\(?:current-buffer\\|excursion\\|" + "match-data\\|restriction\\|selected-\\(?:frame\\|window\\)\\|" + "window-excursion\\)\\|t\\(?:hrow\\|rack-mouse\\)\\|un\\(?:less\\|" + "wind-protect\\)\\|w\\(?:h\\(?:en\\|ile\\)\\|ith-\\(?:current-buffer\\|" + "output-to-string\\|s\\(?:elected-\\(?:frame\\|window\\)\\|" + "tring-as-buffer-contents\\)\\|temp-\\(?:buffer\\|file\\)\\)\\)" + ;; end of generated stuff "\\)\\>") 1) ;; ;; Feature symbols as references. @@ -2304,19 +2353,19 @@ This adds highlighting of Java documentation tags, such as @see.") "\\|long\\|short\\|void\\)\\>") "Regexp which should match a primitive type.") -(let ((capital-letter "A-Z\300-\326\330-\337") - (letter "a-zA-Z_$\300-\326\330-\366\370-\377") - (digit "0-9")) (defvar java-font-lock-identifier-regexp - (concat "\\<\\([" letter "][" letter digit "]*\\)\\>") + (let ((letter "a-zA-Z_$\300-\326\330-\366\370-\377") + (digit "0-9")) + (concat "\\<\\([" letter "][" letter digit "]*\\)\\>")) "Regexp which should match all Java identifiers.") (defvar java-font-lock-class-name-regexp - (concat "\\<\\([" capital-letter "][" letter digit "]*\\)\\>") + (let ((capital-letter "A-Z\300-\326\330-\337") + (letter "a-zA-Z_$\300-\326\330-\366\370-\377") + (digit "0-9")) + (concat "\\<\\([" capital-letter "][" letter digit "]*\\)\\>")) "Regexp which should match a class or an interface name. The name is assumed to begin with a capital letter.") -) - (let ((java-modifier-regexp (concat "\\<\\(abstract\\|const\\|final\\|native\\|" @@ -2490,7 +2539,7 @@ The name is assumed to begin with a capital letter.") (list ;; Javadoc tags - '("@\\(author\\|exception\\|throws\\|deprecated\\|param\\|return\\|see\\|since\\|version\\)\\s " + '("@\\(author\\|deprecated\\|exception\\|throws\\|param\\|return\\|see\\|since\\|version\\|serial\\|serialData\\|serialField\\)\\s " 0 font-lock-keyword-face t) ;; Doc tag - Parameter identifiers @@ -2596,22 +2645,22 @@ The name is assumed to begin with a capital letter.") 3 (if (match-beginning 2) 'bold 'italic) keep)) "Default expressions to highlight in TeX modes.") -(defconst ksh-font-lock-keywords (purecopy +(defconst ksh-font-lock-keywords (list '("\\(^\\|[^\$\\\]\\)#.*" . font-lock-comment-face) '("\\<\\(if\\|then\\|else\\|elif\\|fi\\|case\\|esac\\|for\\|do\\|done\\|foreach\\|in\\|end\\|select\\|while\\|repeat\\|time\\|function\\|until\\|exec\\|command\\|coproc\\|noglob\\|nohup\\|nocorrect\\|source\\|autoload\\|alias\\|unalias\\|export\\|set\\|echo\\|eval\\|cd\\|log\\|compctl\\)\\>" . font-lock-keyword-face) '("\\<\\[\\[.*\\]\\]\\>" . font-lock-type-face) '("\$\(.*\)" . font-lock-type-face) - )) + ) "Additional expressions to highlight in ksh-mode.") -(defconst sh-font-lock-keywords (purecopy +(defconst sh-font-lock-keywords (list '("\\(^\\|[^\$\\\]\\)#.*" . font-lock-comment-face) '("\\<\\(if\\|then\\|else\\|elif\\|fi\\|case\\|esac\\|for\\|do\\|done\\|in\\|while\\|exec\\|export\\|set\\|echo\\|eval\\|cd\\)\\>" . font-lock-keyword-face) '("\\[.*\\]" . font-lock-type-face) '("`.*`" . font-lock-type-face) - )) + ) "Additional expressions to highlight in sh-mode.")