diff options
| author | Michal Nazarewicz | 2016-02-09 14:05:34 +1100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2016-02-09 14:05:34 +1100 |
| commit | 824a87f41f53eea3aa8ffcb9f065ce149213ebfb (patch) | |
| tree | e60d53d03c6d7d6946e01166f265a567b263f988 | |
| parent | 8722e849f75ceafb82a1c17105e8ab76077a8ebc (diff) | |
| download | emacs-824a87f41f53eea3aa8ffcb9f065ce149213ebfb.tar.gz emacs-824a87f41f53eea3aa8ffcb9f065ce149213ebfb.zip | |
Optimise ‘point in message header’ check
* lisp/gnus/message.el (message-point-in-header-p): Replace two unbound
regular expression matches with a single bound string match thus
reducing amount of work the function is doing.
| -rw-r--r-- | lisp/gnus/message.el | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 8a7ed4fffbe..9460710a477 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el | |||
| @@ -3524,12 +3524,12 @@ Message buffers and is not meant to be called directly." | |||
| 3524 | (defun message-point-in-header-p () | 3524 | (defun message-point-in-header-p () |
| 3525 | "Return t if point is in the header." | 3525 | "Return t if point is in the header." |
| 3526 | (save-excursion | 3526 | (save-excursion |
| 3527 | (and | 3527 | (save-restriction |
| 3528 | (not | 3528 | (widen) |
| 3529 | (re-search-backward | 3529 | (let ((bound (+ (point-at-eol) 1)) case-fold-search) |
| 3530 | (concat "^" (regexp-quote mail-header-separator) "\n") nil t)) | 3530 | (goto-char (point-min)) |
| 3531 | (re-search-forward | 3531 | (not (search-forward (concat "\n" mail-header-separator "\n") |
| 3532 | (concat "^" (regexp-quote mail-header-separator) "\n") nil t)))) | 3532 | bound t)))))) |
| 3533 | 3533 | ||
| 3534 | (defun message-do-auto-fill () | 3534 | (defun message-do-auto-fill () |
| 3535 | "Like `do-auto-fill', but don't fill in message header." | 3535 | "Like `do-auto-fill', but don't fill in message header." |