From mboxrd@z Thu Jan 1 00:00:00 1970 From: Magnus Henoch Subject: [PATCH] Use save-excursion in org-map-dblocks Date: Tue, 23 Mar 2010 17:37:30 +0000 Message-ID: <841vfbszvp.fsf@linux-b2a3.site> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nu835-0001ha-Ls for emacs-orgmode@gnu.org; Tue, 23 Mar 2010 13:37:51 -0400 Received: from [140.186.70.92] (port=36438 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nu833-0001gl-Uz for emacs-orgmode@gnu.org; Tue, 23 Mar 2010 13:37:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nu832-0006ll-9z for emacs-orgmode@gnu.org; Tue, 23 Mar 2010 13:37:49 -0400 Received: from lo.gmane.org ([80.91.229.12]:47548) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nu831-0006ld-Vd for emacs-orgmode@gnu.org; Tue, 23 Mar 2010 13:37:48 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1Nu830-0008Af-Lm for emacs-orgmode@gnu.org; Tue, 23 Mar 2010 18:37:46 +0100 Received: from host213-123-170-251.in-addr.btopenworld.com ([213.123.170.251]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Mar 2010 18:37:46 +0100 Received: from magnus.henoch by host213-123-170-251.in-addr.btopenworld.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 23 Mar 2010 18:37:46 +0100 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: emacs-orgmode@gnu.org --=-=-= 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. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org.el-org-map-dblocks-Use-save-excursion.patch >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 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--