From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id mLVMJAfuF2bCrwAAe85BDQ:P1 (envelope-from ) for ; Thu, 11 Apr 2024 16:04:55 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id mLVMJAfuF2bCrwAAe85BDQ (envelope-from ) for ; Thu, 11 Apr 2024 16:04:55 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=KCHHtQY5; 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=1712844295; a=rsa-sha256; cv=none; b=RZQAGLVNB9zRhKNR3C5WoQM07vIzzyrr+mXGPNBLRm4+crINQa8zx31Junisb0LKbX+IOh ytvDp+/5cgNJJy431P3CbsUCp78FwAlHb7wq5sNRFGO8mbnEpU4702n/I56PhTECCZq88y 51apOP3MvkOaZADkcr3Fw3/fEdkYIrnHJKD1+XuzhGtpZDVRKrN/YOr90Zt4Y3pvURDs/V Nz6D1SMx8E+kwuja9G9rvw6KPEfUM1FrBCMjl67a3AXXvwMkPtCmhB4h/9QFWQYIN7U8Ug SXpFrld0LXKMOUExbvZt2E+wTRoISWm32fJndT8tWZtfRFalGmmYwLr+PZYw5g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=KCHHtQY5; 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=1712844295; 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=xC8JRjl7Ur+FYrLbZTMH/ylmzYEgKOVndKCkEXEaWno=; b=Yuo3KJ7uWCYAVeOiObkHkfalZXVIlT4MPxWO0ZTsaX2dqhCUHPEC6uVGAc9JhCgJ3nj2Y4 ZdcOyGTcDk690eg9OQapPyKBc2JrDNx/8CIut0oyUF4NlyFBDy+FMeRk4nw5Q9bgX2/Foa YO1hkM1JoreWyfVDfAaQviO/Vj1G+g9mNV+ssKJ+8YIO/bTyOeNvLGfeHVuEZXufSe/Rm6 d+YM3AaQmH+CSJnLIssdLTporzLndQ7y7qDXhkIWT8FrulpOqSOnpaqxL5fo41ek10UpVn YVw0WWT9+VvTzloD+wu4V6BhSg0QmSFsLqtlN11HxgEEAW4BY6Hl4jfNK2VzYw== 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 5502424D83 for ; Thu, 11 Apr 2024 16:04:55 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ruv1p-0000zy-7n; Thu, 11 Apr 2024 10:03:49 -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 1ruv1d-0000zQ-GB for emacs-orgmode@gnu.org; Thu, 11 Apr 2024 10:03:39 -0400 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ruv1Z-0004QZ-Qv for emacs-orgmode@gnu.org; Thu, 11 Apr 2024 10:03:36 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 1C32A240105 for ; Thu, 11 Apr 2024 16:03:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1712844211; bh=pXf3OFsg/d52dA0Tfpm1g0ia5FN6TImxs20gfR70rhk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=KCHHtQY5cacB9Iht8LynlEnSQa7vBPcGByptoPFSHdwtlgd0i9h4wGhAwYv2/wLoA O4picGpapVtKMDXebmlHgNK3cwPrDnbDnfXuk/0mXIleSeuo5Ph41MwHIHR5jPtcP+ hdFm34mk9t/8X6sm6WIB4a1AmZGjmR3NP4Is2JtJ/IPi0yLXBOl2tSifA7+jwtRfw4 +ZJiRwzdLpYUaFNhIuj4dQSduqSXQQfV6DAsX/LZ60gKWuGan8X/0TTkvuFVUWyb7C 1DZ7MT+Pc0Dh5o0B1QBLjgB7L2JQauMTrvi5i7a9HIa3jGTfRpDJ2uEN3gGnHgg6ta WZZBhQOWxfnhg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4VFhHk2S6dz9rwn; Thu, 11 Apr 2024 16:03:30 +0200 (CEST) From: Ihor Radchenko To: Amy Grinn Cc: emacs-orgmode@gnu.org Subject: Re: [FR] :noweb-wrap header arg In-Reply-To: <85wmp82boq.fsf_-_@gmail.com> References: <87h6hixhnw.fsf@localhost> <85wmp82boq.fsf_-_@gmail.com> Date: Thu, 11 Apr 2024 14:03:57 +0000 Message-ID: <87y19kxagi.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.66; envelope-from=yantar92@posteo.net; helo=mout02.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_H4=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-Flow: FLOW_IN X-Migadu-Country: US X-Spam-Score: -7.92 X-Migadu-Queue-Id: 5502424D83 X-Migadu-Spam-Score: -7.92 X-Migadu-Scanner: mx10.migadu.com X-TUID: NwlVb8tyZZvy Amy Grinn writes: > First of all, I would like to change (defalias) the function name > org-babel-noweb-wrap to org-babel-noweb-make-regexp. I think this in > more in line with other functions which create regular expressions. +1 You may even use obsolete alias (add it to lisp/org-compat.el) > Second, the command org-babel-tangle-clean is not able to determine > which noweb syntax is being used in any tangled source file because the > header arguments are not tangled along with the source code. > > My proposal is to add an additional warning to this command, stating: > > """ > Warning, this command removes any lines containing constructs which > resemble Org file links or noweb references. It also cannot determine > which noweb syntax is being used for any given source file, if > :noweb-wrap was specified in the original Org file. > """ Makes sense. Ideally, this function should try to follow the link and lookup code block headers, but it is already short of doing this. Improving `org-babel-tangle-clean' is out of scope of your patch. > +(defun org-babel-get-noweb-wrap (&optional info) > + "Retrieve a description the :noweb-wrap header arg from INFO. > + > +The description will be in the form of a list of two of strings > +for the start and end of a reference. INFO can be the result of > +`org-babel-get-src-block-info' otherwise this function will parse > +info at point." > + (unless info > + (setq info (org-babel-get-src-block-info 'no-eval))) > + (when-let ((raw (cdr (assq :noweb-wrap (nth 2 info))))) > + (let (result) > + (with-temp-buffer Please, avoid creating throwaway buffers and work with strings instead. Creating buffers (even temporary buffers) may be costly for some users who heavily customized buffer hooks. > + (insert raw) > + (goto-char (point-min)) > + (while (< (point) (point-max)) > + (unless (looking-at " *\"\\([^\"]+\\)\" *") > + (looking-at " *\\([^ ]+\\)")) May you please explain the rationale behind this regexp? AFAIU, it implies that you want to allow whitespace characters inside :noweb-wrap boundaries. But I do not think that we need to complicate things so much. -- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at . Support Org development at , or support my work at