From mboxrd@z Thu Jan 1 00:00:00 1970 From: Giacomo M Subject: Re: Replace macros on tangle Date: Tue, 27 Jun 2017 12:14:42 +0200 Message-ID: References: <87mv8uyadk.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dPnWF-0008SR-70 for emacs-orgmode@gnu.org; Tue, 27 Jun 2017 06:14:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dPnWA-0004M2-9f for emacs-orgmode@gnu.org; Tue, 27 Jun 2017 06:14:51 -0400 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]:33212) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dPnWA-0004Lf-38 for emacs-orgmode@gnu.org; Tue, 27 Jun 2017 06:14:46 -0400 Received: by mail-wr0-x244.google.com with SMTP id x23so31495388wrb.0 for ; Tue, 27 Jun 2017 03:14:46 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Charles C. Berry" , Nicolas Goaziou Cc: "emacs-orgmode@gnu.org" Dear Nicolas and Chuck, thanks for pointing me in the right direction. I never thought that macros were actually just an export feature, and that noweb replacements could be used as macros! I am experiencing a little quirk though. Since I often edit this org file under Windows, the tangled files have Windows new lines, and (cygwin or any) bash doesn't like it. So I added a org-babel-post-tangle-hook that set-buffer-file-coding-system to unix. But the scripts that I tangle with a noweb ref end up with a weird ^M after each end of line. It seems this happens after the post-tangle hook. How could I take care of those ^M? Thanks a lot, Giacomo Il 6/26/2017 7:06 PM, Charles C. Berry ha scritto: > On Mon, 26 Jun 2017, Nicolas Goaziou wrote: > >> Hello, >> >> Giacomo M writes: >> >>> Dear all, >>> how can I add macro replacement support when a source block is being >>> tangled? >> >> I don't think so. Macro replacement is an export feature. > > If Giacomo's macros operate outside of src blocks, he could export > using `org-org-export-to-org', then tangle the resulting file. > > Giacomo, if you want something to operate inside of src blocks you can > use noweb replacements that execute code as outlined in > > (info "(org) Noweb reference syntax") > > In a way these are like macros. > > HTH, > > Chuck