From ab15a4bdb50bcf6b2851806195bbe8bea3b099dc Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Thu, 13 Dec 2012 11:23:09 +0000 Subject: [PATCH] Avoid quadratic update --- emacs/notmuch-show.el | 12 +++++++----- 1 files changed, 7 insertions(+), 5 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 93bce07..8dd6010 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -356,7 +356,7 @@ operation on the contents of the current buffer." "Return a string comprised of `n' spaces." (make-string n ? )) -(defun notmuch-show-update-tags (tags) +(defun notmuch-show-update-tags (tags &optional no-headerline-update) "Update the displayed tags of the current message." (save-excursion (goto-char (notmuch-show-message-top)) @@ -364,7 +364,8 @@ operation on the contents of the current buffer." (let ((inhibit-read-only t)) (replace-match (propertize (notmuch-tagger-format-tags tags) 'face 'notmuch-tag-face))))) - (notmuch-show-update-header-line)) + (unless no-headerline-update + (notmuch-show-update-header-line))) (defun notmuch-clean-address (address) "Try to clean a single email ADDRESS for display. Return a cons @@ -1461,10 +1462,10 @@ current thread." (defun notmuch-show-get-depth () (notmuch-show-get-prop :depth)) -(defun notmuch-show-set-tags (tags) +(defun notmuch-show-set-tags (tags &optional no-headerline-update) "Set the tags of the current message." (notmuch-show-set-prop :tags tags) - (notmuch-show-update-tags tags)) + (notmuch-show-update-tags tags no-headerline-update)) (defun notmuch-show-get-tags () "Return the tags of the current message." @@ -1778,7 +1779,8 @@ See `notmuch-tag' for information on the format of TAG-CHANGES." (let* ((current-tags (notmuch-show-get-tags)) (new-tags (notmuch-update-tags current-tags tag-changes))) (unless (equal current-tags new-tags) - (notmuch-show-set-tags new-tags)))))) + (notmuch-show-set-tags new-tags t))))) + (notmuch-show-update-header-line)) (defun notmuch-show-add-tag () "Same as `notmuch-show-tag' but sets initial input to '+'." -- 1.7.9.1