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: Thu, 07 May 2015 22:04:26 +0200 Message-ID: <87a8xgi27p.fsf@nicolasgoaziou.fr> References: <8761873tx7.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqS0j-0005K5-ID for emacs-orgmode@gnu.org; Thu, 07 May 2015 16:03:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqS0i-0007lq-J1 for emacs-orgmode@gnu.org; Thu, 07 May 2015 16:03:09 -0400 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:34727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqS0i-0007lm-Cf for emacs-orgmode@gnu.org; Thu, 07 May 2015 16:03:08 -0400 In-Reply-To: <8761873tx7.fsf@gmail.com> (Oleg Sivokon's message of "Tue, 05 May 2015 18:50:28 +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 Hello, Oleg Sivokon writes: > I've been having this problem for a while, and now I think I found its > culprit: The org-babel-ref-parse function will try to move the point in > a wrong buffer (a temporary buffer with the contents of the buffer being > exported), while doing so, it will not switch to this temporary buffer. > Below is what I did to deal with it: > > (defun org-babel-ref-parse (assignment) > "Parse a variable ASSIGNMENT in a header argument. > If the right hand side of the assignment has a literal value > return that value, otherwise interpret as a reference to an > external resource and find its value using > `org-babel-ref-resolve'. Return a list with two elements. The > first element of the list will be the name of the variable, and > the second will be an emacs-lisp representation of the value of > the variable." > (when (string-match org-babel-ref-split-regexp assignment) > (let ((var (match-string 1 assignment)) > (ref (match-string 2 assignment))) > (cons (intern var) > (let ((out (save-excursion > (when org-babel-current-src-block-location > ;; Added this line, to avoid > ;; "Marker points into wrong buffer" error > (set-buffer (marker-buffer org-babel-current-src-block-location)) > (goto-char org-babel-current-src-block-location)) > (org-babel-read ref)))) Using `with-current-buffer' is more appropriate since the change is temporary. Could you provide a patch using git format-patch, with a proper commit message? Thank you. Regards, -- Nicolas Goaziou