From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Bug: org-babel-ref-parse needs to set current buffer to the buffer of the marker [8.2.2 (release_8.2.2-188-gc57372 @ /home/wvxvw/Projects/org-mode/lisp/)] Date: Fri, 08 May 2015 10:24:35 +0200 Message-ID: <87oalvh3y4.fsf@nicolasgoaziou.fr> References: <8761873tx7.fsf@gmail.com> <87a8xgi27p.fsf@nicolasgoaziou.fr> <87zj5g2idd.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:43398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqdYv-0006aI-RF for emacs-orgmode@gnu.org; Fri, 08 May 2015 04:23:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqdYu-0001F9-N8 for emacs-orgmode@gnu.org; Fri, 08 May 2015 04:23:13 -0400 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:57498) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqdYu-0001ET-Gx for emacs-orgmode@gnu.org; Fri, 08 May 2015 04:23:12 -0400 In-Reply-To: <87zj5g2idd.fsf@gmail.com> (Oleg Sivokon's message of "Fri, 08 May 2015 00:22:06 +0300") 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: Oleg Sivokon Cc: emacs-orgmode@gnu.org Oleg Sivokon writes: > Please let me know if I didn't export the patch properly (patch > attached). Thank you. Some comments follow. > From fdc1409602b48ba5f4cd1b5be6264d8311b8b11c Mon Sep 17 00:00:00 2001 > From: wvxvw > Date: Fri, 8 May 2015 00:14:11 +0300 > Subject: [PATCH] Making sure the buffer pointed by > org-babel-current-src-block-location is active when moving to the source > block. The summary line should be shorter. Also you need to add a reference to the function being modified, e.g., * list/ob-ref.el (org-babel-ref-parse): Make sure the buffer pointed by... Eventually, you need to add "TINYCHANGE" string at the end of the commit message if you haven't signed FSF papers. See for details. > (goto-char (if (markerp org-babel-current-src-block-location) > - (marker-position org-babel-current-src-block-location) > + (with-current-buffer > + (marker-buffer org-babel-current-src-block-location) > + (marker-position org-babel-current-src-block-location)) > org-babel-current-src-block-location))) > (org-babel-read ref)))) This won't work as `org-babel-read' is not called within the scope of `with-current-buffer'. I think it should be something like this: (with-current-buffer (if (markerp org-babel-current-src-block-location) (marker-buffer org-babel-current-src-block-location) (current-buffer)) (save-excursion (goto-char org-babel-current-src-block-location) (org-babel-read ref))) Bonus points if you can write a test about it in "test-ob.el". Regards,