From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Danjou Subject: [PATCH] org-macs: store evaluated version of pom Date: Fri, 25 Feb 2011 14:30:33 +0100 Message-ID: <1298640633-17072-1-git-send-email-julien@danjou.info> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=52815 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Psxkm-0008IA-Ev for emacs-orgmode@gnu.org; Fri, 25 Feb 2011 08:30:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Psxkl-0001Pi-CH for emacs-orgmode@gnu.org; Fri, 25 Feb 2011 08:30:40 -0500 Received: from coquelicot-s.easter-eggs.com ([213.215.37.94]:60645) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Psxkl-0001P4-7U for emacs-orgmode@gnu.org; Fri, 25 Feb 2011 08:30:39 -0500 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 Cc: Julien Danjou * lisp/org-macs.el (org-with-point-at): Store evaluated version of pom. T= his fixes a potential bug when using (org-with-point-at (func) =E2=80=A6), wh= ere (func) would be evaluated multiple times, therefore might return different resul= ts if a marker was returned and different each time. Signed-off-by: Julien Danjou --- lisp/org-macs.el | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 9c161e3..2090ca7 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -134,11 +134,12 @@ We use a macro so that the test can happen at compi= lation time." =20 (defmacro org-with-point-at (pom &rest body) "Move to buffer and point of point-or-marker POM for the duration of B= ODY." - `(save-excursion - (if (markerp ,pom) (set-buffer (marker-buffer ,pom))) + `(let ((pom ,pom)) (save-excursion - (goto-char (or ,pom (point))) - ,@body))) + (if (markerp pom) (set-buffer (marker-buffer pom))) + (save-excursion + (goto-char (or pom (point))) + ,@body)))) (put 'org-with-point-at 'lisp-indent-function 1) =20 (defmacro org-no-warnings (&rest body) --=20 1.7.4.1