From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: [ox, patch] Quickly INCLUDE from own file Date: Tue, 07 Oct 2014 11:40:59 +0200 Message-ID: <871tqk8bf8.fsf@gmx.us> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbRGm-0002sX-Dw for emacs-orgmode@gnu.org; Tue, 07 Oct 2014 05:41:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XbRGe-0000Kp-BF for emacs-orgmode@gnu.org; Tue, 07 Oct 2014 05:41:24 -0400 Received: from plane.gmane.org ([80.91.229.3]:56687) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XbRGe-0000Ka-5e for emacs-orgmode@gnu.org; Tue, 07 Oct 2014 05:41:16 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XbRGb-000855-Bv for emacs-orgmode@gnu.org; Tue, 07 Oct 2014 11:41:13 +0200 Received: from 109.201.154.147 ([109.201.154.147]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 07 Oct 2014 11:41:13 +0200 Received: from rasmus by 109.201.154.147 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 07 Oct 2014 11:41:13 +0200 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: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, The attached patch allows for "quick" (== without filename) inclusion from the same file. Why? 'Cause I'm lazy and it would be useful to push boring, location-specific stuff to the end of the file. Here's an example: * poor man's ~:ignoreheading:~ #+INCLUDE: "::*foo" :only-contents t #+INCLUDE: "::tbl" * foo :noexport: 1 * bar :noexport: #+NAME: tbl | 1 | You need the preceding "::" to be able tell the difference between the file "tbl" and the table "tbl". Granted, this doesn't look like an org link. If that's an issue, for each link sans location it could be tested if it exists in the current buffer. Do you think something like this would be desirable? —Rasmus -- Hvor meget poesi tror De kommer ud af et glas isvand? --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-ox-Quickly-INCLUDE-contents-from-same-file.patch >From f8fcf5b6816fa7e3e4cc9cc64b12c5cced4a546c Mon Sep 17 00:00:00 2001 From: rasmus Date: Tue, 7 Oct 2014 11:20:10 +0200 Subject: [PATCH] ox: Quickly INCLUDE contents from same file. * ox.el (org-export-expand-include-keyword): Try buffer file name if filename is nil. --- lisp/ox.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/ox.el b/lisp/ox.el index ec52203..ded3b2f 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -3349,8 +3349,9 @@ paths." (setq matched (replace-match "" nil nil matched 1))) (expand-file-name - (org-remove-double-quotes - matched) + (or (org-string-nw-p + (org-remove-double-quotes matched)) + (buffer-file-name)) dir))) (setq value (replace-match "" nil nil value))))) (only-contents -- 2.1.2 --=-=-=--