From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id SLvlOfajM2WHagAA9RJhRA:P1 (envelope-from ) for ; Sat, 21 Oct 2023 12:12:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4789::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id SLvlOfajM2WHagAA9RJhRA (envelope-from ) for ; Sat, 21 Oct 2023 12:12:07 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 611065E7EC for ; Sat, 21 Oct 2023 12:12:06 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=a7f+xGKT; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1697883126; a=rsa-sha256; cv=none; b=ZVOJTI2ar0R/3x7czYmXYCc94g+r16nc+e8XDHFfblWDRmDl5+ln9D/zdx9lWlAsgvZZ2l BR/f6Mzs0GFSp1OB5uFy8FSfTM4NpoNaL2+LKVzAnOOheNBkSb6buvCv00mNemMstXID7K A2ctMHpES28zB0OqrX/ZXWs6Rf5DX6KWkrpZaqCcxkizMmQ/yUfu7o+Gm34evhat41UEUC nXYT1EdTR0bBfFkKrKG/RVldqYlvzac46fhg7W5b//9x3d5zvkimJVvAw/DxmVtaKa/cy/ nuo1plPCEk5j+QCBkrEpHS3Qq7I/WsqPeOXTjyqDHQNUpQZmz6pXH+2K1GfCrQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=a7f+xGKT; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1697883126; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=dlSF8XauapP/WPDPtLRref6HOcbbsN4kQGGM3ZJOowI=; b=qz2ioL5Tbr/gs+iST5yAov4MUjfMycw2d03IZtmGTNVTJ7j+pI+VFlmx+G6Or4Jv8FDG1p PRbsDwn/Q0hJ7hi5vhn2uTzMUivhcxG2hGV2jhVdDVs4eKilafoDJrHiewCsiKXQFQVAGY iDHnY8QUmAhnx5TryvWhZ58qyMuzW8ACXfPw/BhfOId2Q9ZVZAjYCiJFufmrhHxsn7DoVQ /dYvdtKzTN5jNWVCd81aLVGVAyuIjxnOXA4zB1ccPmBYwoPiwYkqa+6K3nc3WDvaUdaFLC BcZkTWpvbDM9z5+NjWW8MExgZ2ox3JvXRSOKy+1GXmOmLSsa+C6zheN1q6QPjA== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qu8x1-0004a1-TU; Sat, 21 Oct 2023 06:11:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qu8wu-0004ZP-P6 for emacs-orgmode@gnu.org; Sat, 21 Oct 2023 06:11:18 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qu8wp-00074O-JC for emacs-orgmode@gnu.org; Sat, 21 Oct 2023 06:11:16 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id AEAF1240027 for ; Sat, 21 Oct 2023 12:11:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1697883068; bh=/STBRRSs9cD1FHypi3oT1ijXS15GjQgxJGSu6RaxR+U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:From; b=a7f+xGKT9/oF95CpZt3owWAAfwkVbudbpclzNyz41jti3cWGZ83Zlr+NEzzYetgec 1Kfxruv6Z8+rqIA2GF6GB7wA80BcjgAuzVfIFZ1L1GybQrBmWT8ZW+VEs8JvX3vHsI FEwYQrtEBrL5F60WnsToUbWjFz2Fm8CqqPZ2RA2Y8YKshGoYsb/RFzsN6qSmUtjxi2 eKD0pXt6CojbJ9jJ67RqPqCzQhqrE2KB0oDd3Ma84XSBUJNQ85GE4b7Blch0JWjo0t ylXQkReIMfv//TPHkqv5oaRlj6xgjBlMOPQNZT/j+d5E7oQp5k9cGr6qJNosg4DrLa 07q73BAEZVeyw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4SCHKS2mpZz6txr; Sat, 21 Oct 2023 12:11:08 +0200 (CEST) From: Ihor Radchenko To: Stefano Ghirlanda Cc: emacs-orgmode@gnu.org Subject: Re: Colons in :var header arguments In-Reply-To: References: Date: Sat, 21 Oct 2023 10:12:52 +0000 Message-ID: <87sf64thaz.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx1.migadu.com X-Migadu-Spam-Score: -9.35 X-Spam-Score: -9.35 X-Migadu-Queue-Id: 611065E7EC X-TUID: 6CDtZHjMmXmH --=-=-= Content-Type: text/plain Stefano Ghirlanda writes: > I have run into an inconvenience in that colons in :var header > arguments to source blocks are invariably interpreted as referring to > another file. However, I use cleveref in LaTeX export (via org-ref) to > automatically format references using labels like tab:data, and in > these cases :var data=tab:data gives a reference not found because tab > is interpreted as a filename. I agree that it is a problem. Attaching tentative patch that will make Org babel fall back to searching in current file when FILE in FILE:REF does not exist. It is technically a breaking change. If this is affecting someone's workflow, please chime in. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-babel-ref-resolve-Search-current-buffer-when-FIL.patch >From 024cc1e6b31e9e3e9e4b8d3aee83221cb3326ee2 Mon Sep 17 00:00:00 2001 Message-ID: <024cc1e6b31e9e3e9e4b8d3aee83221cb3326ee2.1697883034.git.yantar92@posteo.net> From: Ihor Radchenko Date: Sat, 21 Oct 2023 13:08:55 +0300 Subject: [PATCH] org-babel-ref-resolve: Search current buffer when FILE in FILE:REF does not exist * lisp/ob-ref.el (org-babel-ref-resolve): Only search in other file when FILE in FILE:REF exists. * doc/org-manual.org (Passing arguments): * etc/ORG-NEWS (Babel references =FILE:REFERENCE= now search current buffer when =FILE= does not exist): Document the change. Reported-by: Stefano Ghirlanda Link: https://orgmode.org/list/CAK_gY-Q4f82dbDQgyS+FfyeQaHAMXHqygq3e6ZsWnEj-+eoG9A@mail.gmail.com --- doc/org-manual.org | 4 ++++ etc/ORG-NEWS | 6 ++++++ lisp/ob-ref.el | 5 +++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index c0e9c8d7e..9a51a38a1 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -17764,6 +17764,10 @@ *** Passing arguments : :var NAME=FILE:REFERENCE +When =FILE= does not exist, the reference is searched in the current +file, using the verbatim reference. This way, +=:var table=tbl:example= will be searched inside the current buffer. + Here are examples of passing values by reference: - table :: diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 985488016..f64081964 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -13,6 +13,12 @@ Please send Org bug reports to mailto:emacs-orgmode@gnu.org. * Version 9.7 (not released yet) ** Important announcements and breaking changes +*** Babel references =FILE:REFERENCE= now search current buffer when =FILE= does not exist + +When =FILE= does not exist, the reference is searched in the current +file, using the verbatim reference. This way, +=:var table=tbl:example= will be searched inside the current buffer. + *** New export option ~org-export-expand-links~ The new option makes Org expand environment variables in link and INCLUDE paths. diff --git a/lisp/ob-ref.el b/lisp/ob-ref.el index fd6927ccf..b7858569a 100644 --- a/lisp/ob-ref.el +++ b/lisp/ob-ref.el @@ -156,8 +156,9 @@ (defun org-babel-ref-resolve (ref) (when (string-match "^\\(.+\\):\\(.+\\)$" ref) (setq split-file (match-string 1 ref)) (setq split-ref (match-string 2 ref)) - (find-file split-file) - (setq ref split-ref)) + (when (file-exists-p split-file) + (find-file split-file) + (setq ref split-ref))) (org-with-wide-buffer (goto-char (point-min)) (let* ((params (append args '((:results . "none")))) -- 2.42.0 --=-=-= Content-Type: text/plain -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at --=-=-=--