mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-05 19:31:02 -08:00
Fix slow abbrev expansion in `message-mode' in some circumstances
* lisp/gnus/message.el (message--syntax-propertize): Use the correct Message mode syntax table to avoid having `message-cite-prefix-regexp' trigger very heavy backtracing when called from an abbrev context (which defines "_" as a word constituent) (bug#45944).
This commit is contained in:
parent
e544b86343
commit
3b731b123d
1 changed files with 17 additions and 16 deletions
|
|
@ -3057,22 +3057,23 @@ See also `message-forbidden-properties'."
|
||||||
|
|
||||||
(defun message--syntax-propertize (beg end)
|
(defun message--syntax-propertize (beg end)
|
||||||
"Syntax-propertize certain message text specially."
|
"Syntax-propertize certain message text specially."
|
||||||
(let ((citation-regexp (concat "^" message-cite-prefix-regexp ".*$"))
|
(with-syntax-table message-mode-syntax-table
|
||||||
(smiley-regexp (regexp-opt message-smileys)))
|
(let ((citation-regexp (concat "^" message-cite-prefix-regexp ".*$"))
|
||||||
(goto-char beg)
|
(smiley-regexp (regexp-opt message-smileys)))
|
||||||
(while (search-forward-regexp citation-regexp
|
(goto-char beg)
|
||||||
end 'noerror)
|
(while (search-forward-regexp citation-regexp
|
||||||
(let ((start (match-beginning 0))
|
end 'noerror)
|
||||||
(end (match-end 0)))
|
(let ((start (match-beginning 0))
|
||||||
(add-text-properties start (1+ start)
|
(end (match-end 0)))
|
||||||
`(syntax-table ,(string-to-syntax "<")))
|
(add-text-properties start (1+ start)
|
||||||
(add-text-properties end (min (1+ end) (point-max))
|
`(syntax-table ,(string-to-syntax "<")))
|
||||||
`(syntax-table ,(string-to-syntax ">")))))
|
(add-text-properties end (min (1+ end) (point-max))
|
||||||
(goto-char beg)
|
`(syntax-table ,(string-to-syntax ">")))))
|
||||||
(while (search-forward-regexp smiley-regexp
|
(goto-char beg)
|
||||||
end 'noerror)
|
(while (search-forward-regexp smiley-regexp
|
||||||
(add-text-properties (match-beginning 0) (match-end 0)
|
end 'noerror)
|
||||||
`(syntax-table ,(string-to-syntax "."))))))
|
(add-text-properties (match-beginning 0) (match-end 0)
|
||||||
|
`(syntax-table ,(string-to-syntax ".")))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-derived-mode message-mode text-mode "Message"
|
(define-derived-mode message-mode text-mode "Message"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue