From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yu Subject: "noweb-ref": Limiting scope of definitions? Date: Mon, 30 Jan 2012 17:31:57 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:39713) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rru9i-0008Cp-WF for emacs-orgmode@gnu.org; Mon, 30 Jan 2012 11:32:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rru9d-0005QG-EN for emacs-orgmode@gnu.org; Mon, 30 Jan 2012 11:32:34 -0500 Received: from mailout-de.gmx.net ([213.165.64.23]:60550) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Rru9c-0005QC-Nq for emacs-orgmode@gnu.org; Mon, 30 Jan 2012 11:32:29 -0500 Received: by lagj5 with SMTP id j5so641091lag.0 for ; Mon, 30 Jan 2012 08:32:27 -0800 (PST) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org-mode mailing list Hello! Scenario ----------------- * Maintain a potentially long org file as an appendix. * In this appendix, many independent scripting tasks will be documented. * Each such scripting task has similiar partial tasks, e.g. imports, "settings", ... In such a case, many independent scripts may contain a block "<>" or something or something to the same effect, i.e. an overlap of definitions could be avoided only by some sort of scoping: (a) manually, e.g. by prefixing the names with a script-specific string (e.g. <>. While this is flexible (i.e. allows reuse of code from other script), it also reduces the readability of the NOWEB code). (b) providing some sort of scoping, e.g. declaring definitions section-local. Implementation Idea ---------------------------------- A simple implementation, maintaining the flexibility of the manual solution, would be to create a header argument like ":noweb-prefix", that effectively just adds a prefix to the noweb reference names (both in declaring the block (#+name, :noweb-ref) and in using it (<>)), unless such a prefix is explicitly specified. This could then be set as needed, for specific blocks or subtrees (as property) or any mixture of such. A prefix would then be recognized by a delimiter string to be specified. This solution would also be downward compatible with existing files, as the syntax for recognizing a prefix would be relevant only when deciding whether to apply an explicitly introduced ":noweb-prefix".