From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CGZ3OA9Z2WI7PQEAbAwnHQ (envelope-from ) for ; Thu, 21 Jul 2022 15:47:59 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id OD+ROA9Z2WJEPQEA9RJhRA (envelope-from ) for ; Thu, 21 Jul 2022 15:47:59 +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 921D93FD5E for ; Thu, 21 Jul 2022 15:47:59 +0200 (CEST) Received: from localhost ([::1]:47780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oEWX0-00019M-RI for larch@yhetil.org; Thu, 21 Jul 2022 09:47:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52338) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEWTr-0007Vt-9a for emacs-orgmode@gnu.org; Thu, 21 Jul 2022 09:44:47 -0400 Received: from mout01.posteo.de ([185.67.36.65]:54757) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oEWTn-0001uG-EL for emacs-orgmode@gnu.org; Thu, 21 Jul 2022 09:44:42 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 1D62A240027 for ; Thu, 21 Jul 2022 15:44:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1658411077; bh=xFIXsw4Z9tRhiDG6aAWg8xZbRP4t3Yw/3CINhkexgho=; h=From:To:Cc:Subject:Date:From; b=nX0XXsZ37+mxB6l5HoiMxnL+Z5a4Ia9MZ+guACxawCGCWl3Zs3uZjniFc8d0feFsB jN90KnQAoZ3a99+ELcO1SWwFqGnqH7P/RaXTwKisMVAC/8Vj18f8DYAPJDyPfi8hAK KjpmAM09zb2JLn4XmsqDrhdnqA2e6kV/yzSeVPvDRYtBFiDCAEJsnTzMjBsU2nxmHu 0GyCZY996f8OAoPmRmmFbd9Dkslq3bXSFPdixbU2kKTv30DnU25g1cM5YNOWbM3mHF NmzeNoRqRLhQJaonpb5SPwSn/pTRnPxDXs3RsgzLb7LWSHokX+ocbDOZthWedNTkZi ueQa9Xsneq8hg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4LpYhh3H1Jz9rxX; Thu, 21 Jul 2022 15:44:36 +0200 (CEST) From: =?utf-8?Q?Juan_Manuel_Mac=C3=ADas?= To: orgmode Cc: Ihor Radchenko Subject: Re: [Patch] ob-tangle.el: New value 'ascii' for the header argument ':comments' References: <87o7z0tltj.fsf@posteo.net> <87bkuzdahc.fsf@localhost> <87wndna1lp.fsf@posteo.net> <87y1xzq4k9.fsf@localhost> <87o7yvlctx.fsf@posteo.net> <87y1xzwjar.fsf@localhost> Date: Thu, 21 Jul 2022 13:44:34 +0000 In-Reply-To: <87y1xzwjar.fsf@localhost> (Ihor Radchenko's message of "Tue, 14 Jun 2022 19:55:56 +0800") Message-ID: <87k086h96l.fsf@posteo.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=185.67.36.65; envelope-from=maciaschain@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, 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" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1658411279; 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=9cVVKhgbWzDw8sDfF2R17r9lV8XUDBmHRvsR4mSMaEw=; b=cYMFpZm8u2gEThK2N8Masg6eAi13acF7mAUda1bly3Pxe0aMeZIfSnkvY5IValVdnLgp88 9yFdeuq/Dn1xfs7ibI9QjQ7AkHHtUW6dYWDcsvRk23S84uKeCSiA7GkQqYzr9jjDlQGhC9 4ZwfcSlynrHWrEWSDI5f4l/qphL6In32uCq51FiA6XdwycSwdXhr3o2eEHbzRx1653MMVT QNdlVo5o2mDwwtkqzEhIeLZkOmJ5fy7ephlaGaUT8DIjxrEEYpd5c5JGwC4ONnDKv3XTwn oIgskgLID++/vTvDb+TiaCiTfAX9K2EF3DxpcvDkiRvl0OP07OUPcehBx434ng== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1658411279; a=rsa-sha256; cv=none; b=UaG/tq1Y3Jc0A6lRc8iBdxWdKiPcmaZGMDWyGO+HQ8z5JWZrtL/qWqWYr8yMQeeK/ORiYU 1gBEIIvby58lMJfTNlXX4rNe1i65U/cvNFj9uiwhnAaGRUNtlP9e+G/a5zV+OFc7R0CktC 5SKlT2AiuN1q3K1YRzxCu3kravoOsUd2L8UptAthYIX2tyxPsss8g9khVCy96WIiCMOJ9M XYbDVJITcDGrCjXMGe7iyMXrq7K9t6u/DGA90fjdaCDeMp8SEJbaLXIrtxDECOniRcJux7 +DuDyy6PaAFmfPjW2IEItZplmcpp4s7wQ7PITWAFoZDxVWUXk5rXBwvCe5qn+A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=nX0XXsZ3; 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" X-Migadu-Spam-Score: -6.24 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=nX0XXsZ3; 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" X-Migadu-Queue-Id: 921D93FD5E X-Spam-Score: -6.24 X-Migadu-Scanner: scn0.migadu.com X-TUID: UKgn5JxtMMMz --=-=-= Content-Type: text/plain Ihor Radchenko writes: > The original proposal by Eric Schulte: > https://list.orgmode.org/4BFFEE4F.5010608@ccbr.umn.edu/ >>>> Maybe we should allow either exporting just the headlines of the >>>> org-mode file or exporting the entire org-mode file -- possibly after an >>>> ASCII export -- this would have the effect of prefixing every line in >>>> the org-mode file behind a comment *except* for the tangled source-code >>>> blocks. > > Clearly, the "possible after an ASCII export" dropped somewhere in the > middle. New version of the patch attached. `:comments org' now produces by default plain text comments previously exported to ascii from org. Best regards, Juan Manuel --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-lisp-ob-tangle.el-The-org-value-for-comments-is-now-.patch >From 7095cb5d547bfe9f0576418e71317ad3ebeade77 Mon Sep 17 00:00:00 2001 From: Juan Manuel Macias Date: Thu, 21 Jul 2022 13:47:23 +0200 Subject: [PATCH] lisp/ob-tangle.el: The `org' value for `:comments' is now plain text * org-babel-process-comment-text: `org-babel-export-comment-text-as-plain-text' function is added as a new default value, which exports the raw Org text as plain text. This is useful for removing all org metadata from the source file's comments. --- lisp/ob-tangle.el | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index f4fb2af71..aba87ef13 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -134,11 +134,12 @@ of tangled comments." :group 'org-babel :type 'boolean) -(defcustom org-babel-process-comment-text 'org-remove-indentation - "Function called to process raw Org text collected to be -inserted as comments in tangled source-code files. The function -should take a single string argument and return a string -result. The default value is `org-remove-indentation'." +(defcustom org-babel-process-comment-text 'org-babel-export-comment-text-as-plain-text + "Function called to process raw Org text collected to be inserted +as comments in tangled source-code files. The function should +take a single string argument and return a string result. The +default value is `org-babel-export-comment-text-as-plain-text'. +Legacy value is `org-remove-indentation'." :group 'org-babel :version "24.1" :type 'function) @@ -158,6 +159,11 @@ represented in the file." (with-current-buffer (get-file-buffer file) (revert-buffer t t t))) +(defun org-babel-export-comment-text-as-plain-text (comment) + "Default function to process raw Org text collected to be +inserted as comments in tangled source-code files." + (org-export-string-as comment 'ascii t)) + (defmacro org-babel-with-temp-filebuffer (file &rest body) "Open FILE into a temporary buffer execute BODY there like `progn', then kill the FILE buffer returning the result of @@ -533,8 +539,8 @@ non-nil, return the full association list to be used by (buffer-substring (max (condition-case nil (save-excursion - (org-back-to-heading t) ; Sets match data - (match-end 0)) + (re-search-backward org-heading-regexp) ; Sets match data + (match-beginning 0)) (error (point-min))) (save-excursion (if (re-search-backward -- 2.37.1 --=-=-=--