emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] [PATCH] speedup redisplay of agenda item after change


From: Max Mikhanosha
Subject: [O] [PATCH] speedup redisplay of agenda item after change
Date: Fri, 28 Sep 2012 13:01:45 -0400
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Gojō) APEL/10.6 Emacs/23.3.50 (x86_64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO)

I had noticed that with large agendas (several hundred items), any
command that changes and re-displays the current item is slow. For
example something like changing priority with Shift-Up/Down key, can
take a second or two.

Most of that time is spent in (org-agenda-finalize) call, which is
responsible for putting finishes touches, such as fortifying [#A] as
bold when you change priority from [#B].

It seems that even if only single line had changed, the
(org-agenda-finalize) still processes entire agenda buffer, which is
the cause of the slowness.

Following patch changes (org-agenda-change-all-lines) to call
(org-agenda-finalize) for each line changed, with agenda buffer
narrowed to just that line, and it speeds up redisplay of current item
a lot, the Shift-Up changing of priority can almost keep up with
keyboard repeat rate on large agendas.

I was running with this patch for a month, and did not noticed any
problems so far.

From 432293f3c55308f3f76b0c5284ca696fb11f10ea Mon Sep 17 00:00:00 2001
From: Max Mikhanosha <address@hidden>
Date: Fri, 28 Sep 2012 09:02:07 -0400
Subject: [PATCH] speedup redisplay of agenda item after change

* lisp/org-agenda.el (org-agenda-change-all-lines): speedup
 refresh of a single line of agenda by narrowing the agenda
 buffer just that line before calling org-agenda-finalize-

---
 lisp/org-agenda.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index ea607eb..30dd5bf 100755
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -8079,9 +8079,11 @@ (defun org-agenda-change-all-lines (newhead hdmarker
                         undone-face done-face))))
            (org-agenda-highlight-todo 'line)
            (beginning-of-line 1))
-          (t (error "Line update did not work"))))
-       (beginning-of-line 0)))
-    (org-agenda-finalize)))
+          (t (error "Line update did not work")))
+         (save-restriction
+           (narrow-to-region (point-at-bol) (point-at-eol))
+           (org-agenda-finalize)))
+       (beginning-of-line 0)))))
 
 (defun org-agenda-align-tags (&optional line)
   "Align all tags in agenda items to `org-agenda-tags-column'."
-- 
1.7.11.rc0.100.g5498c5f




reply via email to

[Prev in Thread] Current Thread [Next in Thread]