From: yamaoka Date: Thu, 12 Jul 2001 08:24:11 +0000 (+0000) Subject: * message.el (message-yank-original): Unwind-protect while suspending X-Git-Tag: t-gnus-6_15_4-04-quimby~11 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5a3768143fae29494462a2473c987dadd0c60273;p=elisp%2Fgnus.git- * message.el (message-yank-original): Unwind-protect while suspending font-lock. (message-mode): Modify for the following changes. (message-font-lock-keywords-2): Abolished. (message-font-lock-keywords-1): Abolished. (message-font-lock-keywords): Unified. (message-font-lock-cited-text-matcher): Abolished. (font-lock-after-change-function): Don't advise it. (message-font-lock-last-position): Abolished. (message-font-lock-citation-name-max-column): Abolished. (message-font-lock-cited-text-regexp) Abolished. (message-font-lock-fence-close-position): Abolished. (message-font-lock-fence-open-position): Abolished. (message-font-lock-fence-close-regexp): Abolished. (message-font-lock-fence-open-regexp): Abolished. --- diff --git a/ChangeLog b/ChangeLog index 2eae7f8..fa4d0e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2001-07-12 Katsumi Yamaoka + + * lisp/message.el (message-yank-original): Unwind-protect while + suspending font-lock. + (message-mode): Modify for the following changes. + (message-font-lock-keywords-2): Abolished. + (message-font-lock-keywords-1): Abolished. + (message-font-lock-keywords): Unified. + (message-font-lock-cited-text-matcher): Abolished. + (font-lock-after-change-function): Don't advise it. + (message-font-lock-last-position): Abolished. + (message-font-lock-citation-name-max-column): Abolished. + (message-font-lock-cited-text-regexp) Abolished. + (message-font-lock-fence-close-position): Abolished. + (message-font-lock-fence-open-position): Abolished. + (message-font-lock-fence-close-regexp): Abolished. + (message-font-lock-fence-open-regexp): Abolished. + 2001-07-10 Katsumi Yamaoka * lisp/message.el (message-font-lock-keywords-1): Replace regexp diff --git a/lisp/message.el b/lisp/message.el index 2b692e2..651303b 100644 --- a/lisp/message.el +++ b/lisp/message.el @@ -1073,151 +1073,7 @@ Defaults to `text-mode-abbrev-table'.") "Face used for displaying MML." :group 'message-faces) -(defvar message-font-lock-fence-open-regexp "[+|]" - "*Regexp that matches fence open string.") - -(defvar message-font-lock-fence-close-regexp "|" - "*Regexp that matches fence close string.") - -(defvar message-font-lock-fence-open-position nil - "*Cons of SYMBOL of a function or a variable and a number of OFFSET that -indicate the fence open position. If it is non-nil, -`message-font-lock-fence-open-regexp' is not used for searching for the -fence open position. If SYMBOL is a function, it is called with one argument -last cursor position and should return the fence open position as a number -or a marker. If SYMBOL is a variable symbol, the value is examined with -`symbol-value'. OFFSET is added to the position to compensate the value. -For example, the following combinations of variable symbol and offset value -can be used: - -Egg v3: '(egg:*region-start* . -1) -Canna: '(canna:*region-start* . 0) -") - -(defvar message-font-lock-fence-close-position nil - "*Cons of SYMBOL of a function or a variable and a number of OFFSET that -indicate the fence close position. If it is non-nil, -`message-font-lock-fence-close-regexp' is not used for searching for the -fence close position. If SYMBOL is a function, it is called with one argument -last cursor position and should return the fence close position as a number -or a marker. If SYMBOL is a variable symbol, the value is examined with -`symbol-value'. OFFSET is added to the position to compensate the value. -For example, the following combinations of variable symbol and offset value -can be used: - -Egg v3: '(egg:*region-end* . 0) -Canna: '(canna:*region-end* . 0) -") - -(defvar message-font-lock-cited-text-regexp - "^[\t ]*\\([^\000- :>|}\177]*\\)[:>|}].*" - "*Regexp that matches cited text. It should have a grouping for the -citation prefix which is ended at the beginning of citation mark string.") - -(defvar message-font-lock-citation-name-max-column 10 - "*Maximun number of column for citation name for fontifying.") - -(defvar message-font-lock-last-position nil - "Internal buffer local variable to save the last cursor position -before fontifying.") - -(eval-after-load "font-lock" - '(defadvice font-lock-after-change-function - (before message-font-lock-save-last-position activate) - "Save last cursor position before fontifying." - (if (eq 'message-mode major-mode) - (setq message-font-lock-last-position (point))))) - -(defun message-font-lock-cited-text-matcher (limit) - "Search for a cited text containing `message-font-lock-cited-text-regexp' -forward. Argument LIMIT bounds the search. If a cited text is found, it -returns t and sets match data 1 and 2, otherwise it returns nil. Normally, -match data 2 has zero length, but if the FENCE (for input method) is detected -in matched text, result is divided into match data 1 and 2 across the FENCE. -See also the documentations for the following variables: - `message-font-lock-fence-open-regexp' - `message-font-lock-fence-close-regexp' - `message-font-lock-fence-open-position' - `message-font-lock-fence-close-position' -" - (prog1 - (when (re-search-forward message-font-lock-cited-text-regexp limit t) - (let* ((start0 (match-beginning 0)) - (end0 (match-end 0)) - (cite-mark (match-end 1)) - (should-fontify - (progn - (goto-char cite-mark) - (<= (current-column) - message-font-lock-citation-name-max-column))) - end1 start2) - (and - should-fontify - message-font-lock-last-position - (>= message-font-lock-last-position start0) - (<= message-font-lock-last-position end0) - (cond - (message-font-lock-fence-open-position - (let* ((symbol (car message-font-lock-fence-open-position)) - (open - (cond ((functionp symbol) - (funcall symbol message-font-lock-last-position)) - ((and (symbolp symbol) - (boundp symbol)) - (symbol-value symbol))))) - (when (markerp open) - (setq open (marker-position open))) - (and (numberp open) - (setq open - (+ open - (cdr message-font-lock-fence-open-position))) - (>= message-font-lock-last-position open) - (goto-char open) - (or (not message-font-lock-fence-open-regexp) - (looking-at message-font-lock-fence-open-regexp)) - (setq end1 open)))) - (message-font-lock-fence-open-regexp - (goto-char message-font-lock-last-position) - (when (re-search-backward - message-font-lock-fence-open-regexp start0 t) - (setq end1 (match-beginning 0))))) - (setq should-fontify - (and message-font-lock-fence-open-position - (not (eq cite-mark end1)))) - (cond - (message-font-lock-fence-close-position - (let* ((symbol (car message-font-lock-fence-close-position)) - (close - (cond ((functionp symbol) - (funcall symbol message-font-lock-last-position)) - ((and (symbolp symbol) - (boundp symbol)) - (symbol-value symbol))))) - (when (markerp close) - (setq close (marker-position close))) - (and (numberp close) - (setq close - (+ close - (cdr message-font-lock-fence-close-position))) - (<= message-font-lock-last-position close) - (setq start2 close)))) - (message-font-lock-fence-close-regexp - (goto-char message-font-lock-last-position) - (when (looking-at message-font-lock-fence-close-regexp) - (setq start2 (match-end 0))))) - (setq should-fontify - (and (not (and (not message-font-lock-fence-open-position) - (eq cite-mark end1))) - (not (eq cite-mark start2))))) - (goto-char end0) - (when should-fontify - (if start2 - (store-match-data (list start0 end0 start0 end1 start2 end0)) - (store-match-data (list start0 end0 start0 end0 end0 end0))) - t))) - (setq message-font-lock-last-position nil))) - -(defvar message-font-lock-keywords-1 +(defvar message-font-lock-keywords (let ((content "[ \t]*\\(.+\\(\n[ \t].*\\)*\\)\n?")) `((,(concat "^\\([Tt]o:\\)" content) (1 'message-header-name-face) @@ -1251,24 +1107,9 @@ See also the documentations for the following variables: (0 'message-mml-face)))) "Additional expressions to highlight in Message mode.") -(defvar message-font-lock-keywords-2 - (append message-font-lock-keywords-1 - `((message-font-lock-cited-text-matcher - (1 'message-cited-text-face) - (2 'message-cited-text-face)))) - "Auxiliary expressions to highlight in Message mode.") - -(defvar message-font-lock-keywords message-font-lock-keywords-2 - "Default expressions to highlight in Message mode.") - ;; XEmacs does it like this. For Emacs, we have to set the ;; `font-lock-defaults' buffer-local variable. -(put 'message-mode 'font-lock-defaults - '((message-font-lock-keywords - message-font-lock-keywords-1 - message-font-lock-keywords-2) - nil nil nil nil - (font-lock-mark-block-function . mark-paragraph))) +(put 'message-mode 'font-lock-defaults '(message-font-lock-keywords t)) (defvar message-face-alist '((bold . bold-region) @@ -2002,14 +1843,9 @@ M-RET `message-newline-and-reformat' (break the line and reformat)." (if (featurep 'xemacs) (message-setup-toolbar) (set (make-local-variable 'font-lock-defaults) - '((message-font-lock-keywords - message-font-lock-keywords-1 - message-font-lock-keywords-2) - nil nil nil nil - (font-lock-mark-block-function . mark-paragraph))) + '(message-font-lock-keywords t)) (if (boundp 'tool-bar-map) (set (make-local-variable 'tool-bar-map) (message-tool-bar-map)))) - (set (make-local-variable 'message-font-lock-last-position) nil) (easy-menu-add message-mode-menu message-mode-map) (easy-menu-add message-mode-field-menu message-mode-map) ;; Allow mail alias things. @@ -2625,10 +2461,11 @@ be added to \"References\" field. (if (and message-suspend-font-lock-when-citing (boundp 'font-lock-mode) (symbol-value 'font-lock-mode)) - (progn - (sit-for 0) - (font-lock-mode 0) - (funcall message-cite-function) + (unwind-protect + (progn + (sit-for 0) + (font-lock-mode 0) + (funcall message-cite-function)) (font-lock-mode 1)) (funcall message-cite-function))) (message-exchange-point-and-mark)