From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id GC9RG7RIYF98ZwAA0tVLHw (envelope-from ) for ; Tue, 15 Sep 2020 04:53:08 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id AF4ZFbRIYF+fFQAAbx9fmQ (envelope-from ) for ; Tue, 15 Sep 2020 04:53:08 +0000 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 7F98C940390 for ; Tue, 15 Sep 2020 04:53:07 +0000 (UTC) Received: from localhost ([::1]:51710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kI2xl-0006eI-Ur for larch@yhetil.org; Tue, 15 Sep 2020 00:53:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36594) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kI2xJ-0006e8-BK for emacs-orgmode@gnu.org; Tue, 15 Sep 2020 00:52:37 -0400 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:37368) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kI2xG-000366-21 for emacs-orgmode@gnu.org; Tue, 15 Sep 2020 00:52:36 -0400 Received: by mail-wr1-x443.google.com with SMTP id z4so1797207wrr.4 for ; Mon, 14 Sep 2020 21:52:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OCg6/gwbFyAVzw+yRnaEsPwyXYEti/3C0RjsOm/pXF8=; b=UnjhLHJQztiuXwLmwcq/ypb/xped4KU+vRGRvXbSMSerAASFvBqxkZKEZM2pH9OOmm 6Ibh6J9SA5CXylo1VHagjNWQONlFdjdBSM0YoDHE5VuectpKW5uvp+WHqkwe5zqdwUt+ f10SqukwTB9mE7V/x81KYtwynZCSas3KxDQvvznf8qf/mZWBw/u6CtanZdKnr3AURx+5 6vUuUr+rx46ZAmfvSxg/Hk4njh6jq2HSnoxt5NO1C96TDQa6VjKHMj/AYbVmZIeOv2Ut 9jXOi57AeW/QgDlQc04sqSZOcS5LKYiQePLsQr1UDLK3HfE05bqLxXVkkApEaTPWdzKq d7mA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OCg6/gwbFyAVzw+yRnaEsPwyXYEti/3C0RjsOm/pXF8=; b=MGke1d+/uUpwPkpIybONFCjQEmnru15JuZjnRKhdyEQNSmCibPCKqOH45mMr/QYMI2 XwRJBPEczblchttnu/jm5UQFZKS9puV/rUjSfMZUpfRpYHy6Cmm9OAL9Pd5Sbm65mmQ4 rSwkLy1G/MkJw7SvJoHpI2yc326U6l89//56K+GldeiO8xHpnMKrM6NoSqWsen8ji6+c nIACrYjActedeGXIsmoiN4Xg+4FKdHfk+bz+rAv4n08UkSTQKYESa7fxL8Jd958878p0 6/rvsr2gIfHI+LRLifPwE7ZtFZzpJxINTB96FLQ7Ov6mqYo93Y2DySwIyYWWniiAfZiX J+mA== X-Gm-Message-State: AOAM532a/y0K4Vx82kZS8SF1o84pPEr2fiX27UFphybxVauhIp5JJGO/ IjrerWHjLVHM9QjvODUdj7R4ap/qovD3fewclKYIFoXL47Q= X-Google-Smtp-Source: ABdhPJzwT4klVmSUMPQc85ejcW1SwI3bDkXvs2Sl3YlAdDm4Wxi2neH6jTjRuOVAbJUh1UiSlrxgE7mk9R5rk40Kj0c= X-Received: by 2002:adf:912b:: with SMTP id j40mr19234501wrj.42.1600145551917; Mon, 14 Sep 2020 21:52:31 -0700 (PDT) MIME-Version: 1.0 References: <87tuvzllg7.fsf@kyleam.com> In-Reply-To: <87tuvzllg7.fsf@kyleam.com> From: Tom Gillespie Date: Tue, 15 Sep 2020 00:52:20 -0400 Message-ID: Subject: Re: [PATCH] ob-core: Fix handling of multiple noweb refs in same line To: Kyle Meyer Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::443; envelope-from=tgbugs@gmail.com; helo=mail-wr1-x443.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, 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.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=UnjhLHJQ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.71 X-TUID: zd5WlzWaakoZ Hi Kyle, This fixes the issue on my system, and looking over the bisected commit it looks like the ^ was just an oversight. This also resolves the issue for <> as well, I don't think we need a separate test case for that since any issue with references breaking should show up elsewhere (though I guess you never know). Thank you for tracking this down, and now I know how to add ert tests for things like this in the future! Best, Tom On Tue, Sep 15, 2020 at 12:21 AM Kyle Meyer wrote: > > Tom Gillespie writes: > > > Hi, > > The 9.4 release has a bug where it will only tangle the first noweb > > reference on a line. > > This is also present at 9c31cba002a1ba93053aebea1f778be87f61ba06. It happens in > > emacs-27 and emacs-28. The reproduction is below. Best! > > Thanks for the report and the reproducer. > > This bisects to c1aed9f80 (ob-core: Refactor > `org-babel-expand-noweb-references', 2020-01-12). The patch below > addresses the case you provided (added as a test) and doesn't cause any > of the other tests to fail. However, I'm no tangler, so I'd appreciate > if you could give it some testing and report back. > > (I should also look more closely at org-babel-expand-noweb-references > before applying and see if I spot anything that suggests this change is > problematic.) > > -- >8 -- > Subject: [PATCH] ob-core: Fix handling of multiple noweb refs in same line > > * lisp/ob-core.el (org-babel-expand-noweb-references): Don't anchor > noweb regexp at start of line to allow multiple matches per line. > * testing/lisp/test-ob-tangle.el (ob-tangle/multiple-noweb-in-line): > Add test. > > This fixes a regression introduced by c1aed9f80 (ob-core: Refactor > `org-babel-expand-noweb-references', 2020-01-12), which was part of > the 9.4 release. > > Reported-by: Tom Gillespie > Ref: https://orgmode.org/list/CA+G3_PO2yO1jMMpdrkc39BGQQ2eU5X4FzTEJVotjDJo-50dsqQ@mail.gmail.com > --- > lisp/ob-core.el | 2 +- > testing/lisp/test-ob-tangle.el | 32 ++++++++++++++++++++++++++++++++ > 2 files changed, 33 insertions(+), 1 deletion(-) > > diff --git a/lisp/ob-core.el b/lisp/ob-core.el > index a5e079d9a..7300f239e 100644 > --- a/lisp/ob-core.el > +++ b/lisp/ob-core.el > @@ -2781,7 +2781,7 @@ (defun org-babel-expand-noweb-references (&optional info parent-buffer) > (lang (nth 0 info)) > (body (nth 1 info)) > (comment (string= "noweb" (cdr (assq :comments (nth 2 info))))) > - (noweb-re (format "^\\(.*?\\)\\(%s\\)" > + (noweb-re (format "\\(.*?\\)\\(%s\\)" > (with-current-buffer parent-buffer > (org-babel-noweb-wrap)))) > (cache nil) > diff --git a/testing/lisp/test-ob-tangle.el b/testing/lisp/test-ob-tangle.el > index e0e2ea52c..cfdf16d40 100644 > --- a/testing/lisp/test-ob-tangle.el > +++ b/testing/lisp/test-ob-tangle.el > @@ -420,6 +420,38 @@ (ert-deftest ob-tangle/commented-src-blocks () > (org-split-string (buffer-string)))) > (delete-file file)))))) > > +(ert-deftest ob-tangle/multiple-noweb-in-line () > + "Test handling of multiple noweb references in a single line." > + (should > + (equal '("1" "2" "1") > + (let ((file (make-temp-file "org-tangle-"))) > + (unwind-protect > + (progn > + (org-test-with-temp-text-in-file > + (format " > +#+name: block1 > +#+begin_src elisp > +1 > +#+end_src > + > +#+name: block2 > +#+begin_src elisp > +2 > +#+end_src > + > +#+name: block3 > +#+begin_src elisp :noweb yes :tangle %s > +<> <> <> > +#+end_src" > + file) > + (let ((org-babel-noweb-error-all-langs nil) > + (org-babel-noweb-error-langs nil)) > + (org-babel-tangle))) > + (with-temp-buffer > + (insert-file-contents file) > + (org-split-string (buffer-string)))) > + (delete-file file)))))) > + > (ert-deftest ob-tangle/detangle-false-positive () > "Test handling of false positive link during detangle." > (let (buffer) > > base-commit: e6021bc9b18982b30dd61417d98276b2984892cd > -- > 2.28.0 >