From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] speedup redisplay of agenda item after change Date: Sat, 29 Sep 2012 11:20:35 +0200 Message-ID: <1FBD73FD-62D0-4179-B639-3A15D5447B04@gmail.com> References: <87mx0at72e.wl%max@openchat.com> Mime-Version: 1.0 (Apple Message framework v1283) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:59091) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THtE2-00084k-IT for emacs-orgmode@gnu.org; Sat, 29 Sep 2012 05:20:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1THtE0-0001kh-Hx for emacs-orgmode@gnu.org; Sat, 29 Sep 2012 05:20:42 -0400 Received: from mail-wg0-f49.google.com ([74.125.82.49]:47682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1THtE0-0001kX-BR for emacs-orgmode@gnu.org; Sat, 29 Sep 2012 05:20:40 -0400 Received: by wgbgg4 with SMTP id gg4so1206029wgb.30 for ; Sat, 29 Sep 2012 02:20:39 -0700 (PDT) In-Reply-To: <87mx0at72e.wl%max@openchat.com> 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: Max Mikhanosha Cc: emacs-orgmode@gnu.org Looks great, and I see no reasons why this should break anything. - Carsten On 28.9.2012, at 19:01, Max Mikhanosha wrote: > 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 > 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 > >