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 ms8.migadu.com with LMTPS id wB2eHxpx52XSfgAAe85BDQ:P1 (envelope-from ) for ; Tue, 05 Mar 2024 20:23:06 +0100 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 wB2eHxpx52XSfgAAe85BDQ (envelope-from ) for ; Tue, 05 Mar 2024 20:23:06 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=deV8FUFw; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1709666586; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=LzEQoEBhLGA9zQGVgpBJZaDYCHizMe24HLow8FQdR6s=; b=Lqkne0GI5RvrjIPLRd/ue92aONYE6CdlrxsiOuJUdIkW59LVUhlvTSbWltTu7+qyrIh2Hd 8bcpxabajzPu/wTQrmZBKSh17zhBIp98we2rGashYGec2IFjVCdVXtsJMqEOgDdB9fU9DX lVvoeS98o84W97CIfRKtx1CudAxroJf26AYPob1P3qi24MjsJFbuDb+CIt8AM0k/FmG+dm MialoqCmmsLSOLwYj/IZFeNeEdGL5MnV4TaYqRNn5qyP8p5hJIbxGSAd5Km6UR+Bap+ALL +vjnQCwu3fNQbb+xMxb+7Cm8sMNt+scr/EsZpZB9K4qXkw+J4xA26qqpx84OXQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=deV8FUFw; 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"; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=key1; d=yhetil.org; t=1709666586; a=rsa-sha256; cv=none; b=BzHJmUOeyj97ZIOM4s/Nm/ijt8ofIUXRC8yhgcSmQK7Bk5DjPstrFocmd8UcNOtBrZlPil gDGLhY+d2DiMmb1GdHyyNhI4cPO33dfQD5knK+x+QWIPfMvOObiA12XlagREdyMhQyvIUJ lW3kzQpJCVP6mARATTm7J7BeXSvEAJdzDstcUhE+RMqzR9TV2eS568psPds1MhR9YI3/jE lVm6wb665EKLkV2HB8OIdWtZCjgVBcVy6httfvf+x85DaRU2wVan7IDI4JI8N3dLr+UA13 0qTZHWZT0uyQjUhAVNaxDCYI8bWEdA+uQI4lovT4uKpiPHGUVOCJGuEUg1IVoA== 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 458F57127F for ; Tue, 5 Mar 2024 20:23:06 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhaMg-0007EX-8o; Tue, 05 Mar 2024 14:22:14 -0500 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 1rhaMe-0007ED-PQ for emacs-orgmode@gnu.org; Tue, 05 Mar 2024 14:22:12 -0500 Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rhaMd-000468-2m for emacs-orgmode@gnu.org; Tue, 05 Mar 2024 14:22:12 -0500 Received: by mail-qk1-x734.google.com with SMTP id af79cd13be357-788254c16ceso8421085a.3 for ; Tue, 05 Mar 2024 11:22:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709666527; x=1710271327; darn=gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=LzEQoEBhLGA9zQGVgpBJZaDYCHizMe24HLow8FQdR6s=; b=deV8FUFwnOCb9lqhuk4RnU500OoJf8lf3JS2XLxr2yZd0u9UUQkszlY4g7cjwnhhxC l+tNbSzoQZR9+ZVWu4J2LgBm3DfcMDOJz+QFzwJiNRhYci0ecw+6LHhcvvp+gx1sQnvz FKvHjfQD2c97x9t6a9RAcZdNC99UpoO4vzws3E4zHFikdwZZ7GnWEr0sax3aahUsvfpe q19oF7PM/taCeQrT5S6CRRrF3cOlfSrX6feInCUPTOlclkdXVXWnxQg8Skta7IvEivwP La/oHz6oCBAAP95yxdmMnRQFp6ACp8IHQyIHLWUeWhG7Wj1++4E4kE2F4briiCLvKZjD pw+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709666527; x=1710271327; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LzEQoEBhLGA9zQGVgpBJZaDYCHizMe24HLow8FQdR6s=; b=C5PnnwSbu+TLnhwqfTEKQBP3okQDWogX+jY+O5HTIhMcsgkM5tLb++W/RyLDQrvv4t 2PKrYZ2L5fAY1MEGWZdP95liWeMXQVRqDKuv1wIptu2mCNfjqGE1RJZsEOcFSqR0fMVZ Xr18PC9LivA7fQAUi7cRkapiV3lIhnkaQGYBk27upuc7wuuDgiaadgWJwgf5FcHf4an4 LS8P/MNoMM2jvdaFT2M5X3zcLTGsX4cP5SM0QlG3opTPc/PhWrsNZhaIEtTdV9tBYL9W 2OnDDbs2T9wRfyQQER4YMDvDbQipPkVvXoBv8OLxFE3has8S+9nyjH/nJ3ocChPX+iQz KHpg== X-Gm-Message-State: AOJu0Yy525eN9NJCPOMucwn6q37MvhUGDbGxfo/eFpxsq7WnO4jwPCfs egr0BvTHp9NSjp/qt19gj5VVGa10umd9KlduWWe+cB0o7sEdr8Mm3+4QVSmZLPY= X-Google-Smtp-Source: AGHT+IG76PC/I5I7Dsgh/AFoJ6rOHcHRIY+Uxn/U4M8JjYDDojpbMoj+D4qi5cV2MHlhfDP5j3I5ew== X-Received: by 2002:a05:620a:1238:b0:788:2aa0:b7fc with SMTP id v24-20020a05620a123800b007882aa0b7fcmr3119992qkj.25.1709666527306; Tue, 05 Mar 2024 11:22:07 -0800 (PST) Received: from localhost (024-236-139-114.res.spectrum.com. [24.236.139.114]) by smtp.gmail.com with ESMTPSA id i15-20020a05620a248f00b007883687ef00sm857693qkn.69.2024.03.05.11.22.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 11:22:06 -0800 (PST) From: Amy Grinn To: emacs-orgmode@gnu.org Subject: noweb-start and noweb-end header args Date: Tue, 05 Mar 2024 14:22:07 -0500 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::734; envelope-from=grinn.amy@gmail.com; helo=mail-qk1-x734.google.com 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, T_SCC_BODY_TEXT_LINE=-0.01 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-Migadu-Scanner: mx10.migadu.com X-Migadu-Spam-Score: -7.59 X-Spam-Score: -7.59 X-Migadu-Queue-Id: 458F57127F X-TUID: WDOq0zlRzJV+ --=-=-= Content-Type: text/plain I would like to add support for setting 'org-babel-noweb-wrap-start and 'org-babel-noweb-wrap-end for each src block individually using the header args :noweb-start and :noweb-end: #+name: firewall-safe-mode #+begin_src sh echo "Firewall is now in safe mode." #+end_src #+name: firewall #+begin_src sh :noweb yes :noweb-start <<< :noweb-end >>> safe_mode () { echo "Error encountered, switching to safe mode." <<>> exit 1 } setup-firewall || safe_mode #+end_src #+begin_src sh :noweb yes :noweb-start ":-) " :noweb-end " (-:" :tangle "test.sh" # Setup firewall :-) firewall (-: # Do other things #+end_src Here is a simple way to implement this feature. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=noweb-extra-header-args.diff Content-Description: noweb extra header args diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 4dcfbd3b0..0be19ff06 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -194,15 +194,17 @@ This string must include a \"%s\" which will be replaced by the results." :package-version '(Org . "9.1") :safe #'booleanp) -(defun org-babel-noweb-wrap (&optional regexp) +(defun org-babel-noweb-wrap (&optional regexp info) "Return regexp matching a Noweb reference. Match any reference, or only those matching REGEXP, if non-nil. When matching, reference is stored in match group 1." - (concat (regexp-quote org-babel-noweb-wrap-start) + (concat (regexp-quote (or (cdr (assq :noweb-start (nth 2 info))) + org-babel-noweb-wrap-start)) (or regexp "\\([^ \t\n]\\(?:.*?[^ \t\n]\\)?\\)") - (regexp-quote org-babel-noweb-wrap-end))) + (regexp-quote (or (cdr (assq :noweb-end (nth 2 info))) + org-babel-noweb-wrap-end)))) (defvar org-babel-src-name-regexp "^[ \t]*#\\+name:[ \t]*" @@ -3116,7 +3118,7 @@ block but are passed literally to the \"example-block\"." (not (equal (cdr v) "no")))))) (noweb-re (format "\\(.*?\\)\\(%s\\)" (with-current-buffer parent-buffer - (org-babel-noweb-wrap))))) + (org-babel-noweb-wrap nil info))))) (unless (equal (cons parent-buffer (with-current-buffer parent-buffer (buffer-chars-modified-tick))) --=-=-=--