From mboxrd@z Thu Jan 1 00:00:00 1970 From: Max Mikhanosha Subject: [PATCH] speedup redisplay of agenda item after change Date: Fri, 28 Sep 2012 13:01:45 -0400 Message-ID: <87mx0at72e.wl%max@openchat.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:39977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THdwo-0006Vm-HZ for emacs-orgmode@gnu.org; Fri, 28 Sep 2012 13:02:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THdwg-0003EL-GT for emacs-orgmode@gnu.org; Fri, 28 Sep 2012 13:01:54 -0400 Received: from openchat.com ([75.99.81.170]:34445 helo=momoland.openchat.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THdwg-0003EG-Cj for emacs-orgmode@gnu.org; Fri, 28 Sep 2012 13:01:46 -0400 Received: from momoland.openchat.com (localhost [127.0.0.1]) by momoland.openchat.com (Postfix) with ESMTP id 73CBAE82F8 for ; Fri, 28 Sep 2012 13:01:45 -0400 (EDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org 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. =46rom 432293f3c55308f3f76b0c5284ca696fb11f10ea Mon Sep 17 00:00:00 2001 From: Max Mikhanosha 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))))) =20 (defun org-agenda-align-tags (&optional line) "Align all tags in agenda items to `org-agenda-tags-column'." --=20 1.7.11.rc0.100.g5498c5f