From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: coderef does not provide file path for org-insert-link when not in original buffre Date: Fri, 26 Oct 2018 18:08:50 +0200 Message-ID: <87bm7gg06l.fsf@nicolasgoaziou.fr> References: <87po1zvw9n.fsf@gmail.com> <87bmc1tb4s.fsf@nicolasgoaziou.fr> <87va6wk3ea.fsf@gmail.com> <875zysr0bb.fsf@nicolasgoaziou.fr> <875zxst5to.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57905) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gG4fX-0006aX-6J for emacs-orgmode@gnu.org; Fri, 26 Oct 2018 12:09:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gG4fQ-0001QN-Il for emacs-orgmode@gnu.org; Fri, 26 Oct 2018 12:09:01 -0400 Received: from relay2-d.mail.gandi.net ([217.70.183.194]:56183) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gG4fQ-0001P5-9g for emacs-orgmode@gnu.org; Fri, 26 Oct 2018 12:08:56 -0400 In-Reply-To: <875zxst5to.fsf@gmail.com> (stardiviner's message of "Wed, 24 Oct 2018 10:51:47 +0800") 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" To: stardiviner Cc: org-mode Hello, stardiviner writes: > Thanks for this hint, I added a new entry in org-src--babel-info list to > pass the original parent file path. Thank you. Some comments follow. > - (language body arguments switches name start coderef)" > + (language body arguments switches name start coderef parent-file-path)" This is not needed. It would be better to create a new variable, e.g. `org-src-source-file', get the file name at the beginning of the function `org-src--edit-element', and set it from its INITIALIZE argument. > + (insert (format coderef-format label)) > + (setq link (format "file:%s::%s" > + (car (last org-src--babel-info)) > + (concat "(" label ")"))) You can get the file name by reading `org-src-source-file' value. Does that make sense? Could you also provide some tests? Regards, -- Nicolas Goaziou