emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] speedup redisplay of agenda item after change
@ 2012-09-28 17:01 Max Mikhanosha
  2012-09-29  6:21 ` Bastien
  2012-09-29  9:20 ` Carsten Dominik
  0 siblings, 2 replies; 5+ messages in thread
From: Max Mikhanosha @ 2012-09-28 17:01 UTC (permalink / raw)
  To: emacs-orgmode

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 <max@openchat.com>
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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-09-30 21:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-28 17:01 [PATCH] speedup redisplay of agenda item after change Max Mikhanosha
2012-09-29  6:21 ` Bastien
2012-09-30 20:29   ` Max Mikhanosha
2012-09-30 21:20     ` Bastien
2012-09-29  9:20 ` Carsten Dominik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).