GNU bug report logs -
#22586
[PATCH 1/2] Optimise ‘point in message header’ check
Previous Next
Reported by: Michal Nazarewicz <mina86 <at> mina86.com>
Date: Sun, 7 Feb 2016 17:42:02 UTC
Severity: minor
Tags: fixed, patch
Fixed in version 26.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* 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.
---
lisp/gnus/message.el | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 77e471f..88f198f 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -3516,12 +3516,12 @@ message-fill-paragraph
(defun message-point-in-header-p ()
"Return t if point is in the header."
(save-excursion
- (and
- (not
- (re-search-backward
- (concat "^" (regexp-quote mail-header-separator) "\n") nil t))
- (re-search-forward
- (concat "^" (regexp-quote mail-header-separator) "\n") nil t))))
+ (save-restriction
+ (widen)
+ (let ((bound (+ (point-at-eol) 1)) case-fold-search)
+ (goto-char (point-min))
+ (not (search-forward (concat "\n" mail-header-separator "\n")
+ bound t))))))
(defun message-do-auto-fill ()
"Like `do-auto-fill', but don't fill in message header."
--
2.7.0.rc3.207.g0ac5344
This bug report was last modified 8 years and 176 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.