From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] Use save-excursion in org-map-dblocks Date: Wed, 24 Mar 2010 12:16:20 +0100 Message-ID: <9AD8954E-F77B-45E0-84FB-3000DF3C4B4C@gmail.com> References: <841vfbszvp.fsf@linux-b2a3.site> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NuOZc-0000NT-1u for emacs-orgmode@gnu.org; Wed, 24 Mar 2010 07:16:32 -0400 Received: from [140.186.70.92] (port=43205 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NuOZZ-0000Mw-82 for emacs-orgmode@gnu.org; Wed, 24 Mar 2010 07:16:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NuOZV-0005Q9-MM for emacs-orgmode@gnu.org; Wed, 24 Mar 2010 07:16:29 -0400 Received: from mail-fx0-f222.google.com ([209.85.220.222]:61496) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NuOZV-0005Pz-Hh for emacs-orgmode@gnu.org; Wed, 24 Mar 2010 07:16:25 -0400 Received: by fxm22 with SMTP id 22so2775062fxm.34 for ; Wed, 24 Mar 2010 04:16:24 -0700 (PDT) In-Reply-To: <841vfbszvp.fsf@linux-b2a3.site> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Magnus Henoch Cc: emacs-orgmode@gnu.org Hi Magnus, this looks like an OK patch and I don't have any problems applying it. However, I do not quite understand the need for it. Can you please try to explain a bit better? Do you have two processes running over the same file at the same time, or why is there a conflict? Thanks for your time. - Carsten On Mar 23, 2010, at 6:37 PM, Magnus Henoch wrote: > This patch has been sitting in my tree for a while... It's a fix to > org-map-dblocks, to make it use save-excursion instead of remembering > position values. I need this since I have a dblock function that > asynchronously updates dblocks from HTTP responses, and some dblocks > ended up getting updated twice or thrice. > > From 8fa75fb5174f93cc6990b605901891c2191c64f0 Mon Sep 17 00:00:00 2001 > From: Magnus Henoch > Date: Wed, 21 Oct 2009 12:37:32 +0100 > Subject: [PATCH] * org.el (org-map-dblocks): Use save-excursion. > > --- > lisp/org.el | 13 ++++++------- > 1 files changed, 6 insertions(+), 7 deletions(-) > > diff --git a/lisp/org.el b/lisp/org.el > index 7b2e95b..249aad4 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -9306,16 +9306,15 @@ the property list including an extra > property :name with the block name." > (defun org-map-dblocks (&optional command) > "Apply COMMAND to all dynamic blocks in the current buffer. > If COMMAND is not given, use `org-update-dblock'." > - (let ((cmd (or command 'org-update-dblock)) > - pos) > + (let ((cmd (or command 'org-update-dblock))) > (save-excursion > (goto-char (point-min)) > (while (re-search-forward org-dblock-start-re nil t) > - (goto-char (setq pos (match-beginning 0))) > - (condition-case nil > - (funcall cmd) > - (error (message "Error during update of dynamic block"))) > - (goto-char pos) > + (goto-char (match-beginning 0)) > + (save-excursion > + (condition-case nil > + (funcall cmd) > + (error (message "Error during update of dynamic > block")))) > (unless (re-search-forward org-dblock-end-re nil t) > (error "Dynamic block not terminated")))))) > > -- > 1.6.4.4 > > > -- > Magnus Henoch > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode - Carsten