From mboxrd@z Thu Jan 1 00:00:00 1970 From: Puneeth Subject: Re: [PATCH] How do I include text between a range of line numbers with #INCLUDE Date: Fri, 7 Jan 2011 13:29:41 +0530 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary=00163683195057249f04993d0175 Return-path: Received: from [140.186.70.92] (port=33385 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pb7Ez-0008Mz-F0 for emacs-orgmode@gnu.org; Fri, 07 Jan 2011 03:00:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pb7Ex-0005R2-7q for emacs-orgmode@gnu.org; Fri, 07 Jan 2011 03:00:05 -0500 Received: from mail-ww0-f49.google.com ([74.125.82.49]:58492) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pb7Ew-0005P8-Ty for emacs-orgmode@gnu.org; Fri, 07 Jan 2011 03:00:03 -0500 Received: by wwb17 with SMTP id 17so17714113wwb.30 for ; Fri, 07 Jan 2011 00:00:01 -0800 (PST) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Venkatesh Choppella Cc: emacs-orgmode@gnu.org --00163683195057249f04993d0175 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Fri, Jan 7, 2011 at 10:03 AM, Venkatesh Choppella wrote: > I would like to include a part of a file (between a given range of > line numbers) instead of the whole file. =C2=A0Is there a way to do that = in > org-mode? It isn't possible to include files using line numbers, as of now. Here's a quick patch that would add this feature. I have tested it with small files and works fine. Can somebody tell me if it looks good? :lines "5-10" will include the lines from 5 to 10, 10 excluded. :lines "-10" will include the lines from 1 to 10, 10 excluded. :lines "5-" will include the lines from 1 to the end of the file. HTH, Puneeth --00163683195057249f04993d0175 Content-Type: text/plain; charset=US-ASCII; name="patch-include-lines.diff.txt" Content-Disposition: attachment; filename="patch-include-lines.diff.txt" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gimsp19b0 ZGlmZiAtLWdpdCBhL2xpc3Avb3JnLWV4cC5lbCBiL2xpc3Avb3JnLWV4cC5lbAppbmRleCAzZDQ2 NmZhLi41YWZhMjY2IDEwMDY0NAotLS0gYS9saXNwL29yZy1leHAuZWwKKysrIGIvbGlzcC9vcmct ZXhwLmVsCkBAIC0yMTMwLDEzICsyMTMwLDE0IEBAIFRZUEUgbXVzdCBiZSBhIHN0cmluZywgYW55 IG9mOgogKGRlZnVuIG9yZy1leHBvcnQtaGFuZGxlLWluY2x1ZGUtZmlsZXMgKCkKICAgIkluY2x1 ZGUgdGhlIGNvbnRlbnRzIG9mIGluY2x1ZGUgZmlsZXMsIHdpdGggcHJvcGVyIGZvcm1hdHRpbmcu IgogICAobGV0ICgoY2FzZS1mb2xkLXNlYXJjaCB0KQotCXBhcmFtcyBmaWxlIG1hcmt1cCBsYW5n IHN0YXJ0IGVuZCBwcmVmaXggcHJlZml4MSBzd2l0Y2hlcyBhbGwgbWlubGV2ZWwpCisJcGFyYW1z IGZpbGUgbWFya3VwIGxhbmcgc3RhcnQgZW5kIHByZWZpeCBwcmVmaXgxIHN3aXRjaGVzIGFsbCBt aW5sZXZlbCBsaW5lcykKICAgICAoZ290by1jaGFyIChwb2ludC1taW4pKQogICAgICh3aGlsZSAo cmUtc2VhcmNoLWZvcndhcmQgIl4jXFwrSU5DTFVERTo/WyBcdF0rXFwoLipcXCkiIG5pbCB0KQog ICAgICAgKHNldHEgcGFyYW1zIChyZWFkIChjb25jYXQgIigiIChtYXRjaC1zdHJpbmcgMSkgIiki KSkKIAkgICAgcHJlZml4IChvcmctZ2V0LWFuZC1yZW1vdmUtcHJvcGVydHkgJ3BhcmFtcyA6cHJl Zml4KQogCSAgICBwcmVmaXgxIChvcmctZ2V0LWFuZC1yZW1vdmU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WcgKGlmIChzdHJpbmc9ICIiIChjYXIgbGluZXMpKQorCQkgICAgICAocG9p bnQtbWluKQorCQkgICAgKGdvdG8tY2hhciAocG9pbnQtbWluKSkgCisJCSAgICAoZm9yd2FyZC1s aW5lICgxLSAoc3RyaW5nLXRvLW51bWJlciAoY2FyIGxpbmVzKSkpKQorCQkgICAgKHBvaW50KSkK KwkgICAgICBlbmQgKGlmIChzdHJpbmc9ICIiIChjYWRyIGxpbmVzKSkKKwkJICAgICAgKHBvaW50 LW1heCkKKwkJICAgIChnb3RvLWNoYXIgKHBvaW50LW1pbikpIAorCQkgICAgKGZvcndhcmQtbGlu ZSAoMS0gKHN0cmluZy10by1udW1iZXIgKGNhZHIgbGluZXMpKSkpCisJCSAgICAocG9pbnQpKSkK KwkobmFycm93LXRvLXJlZ2lvbiBiZWcgZW5kKSkpCiAgICAgKHdoZW4gKG9yIHByZWZpeCBwcmVm aXgxKQogICAgICAgKGdvdG8tY2hhciAocG9pbnQtbWluKSkKICAgICAgICh3aGlsZSAobm90IChl b2JwKSkK --00163683195057249f04993d0175 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --00163683195057249f04993d0175--