From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Should comments break paragraphs? Date: Wed, 17 Jul 2013 07:28:31 -0600 Message-ID: <87wqopl3i8.fsf@gmail.com> References: <51E443F6.2050104@arfer.net> <87mwpnfybn.fsf@gmail.com> <51E47BC1.7010808@gmail.com> <87ip0byoqg.fsf@gmail.com> <87fvvev771.fsf@gmail.com> <87wqoqxznb.fsf@gmail.com> <87ppuitp8y.fsf@gmail.com> <87sizexuj9.fsf@gmail.com> <87li55lpqd.fsf@bzg.ath.cx> <87mwplk645.fsf@gmail.com> <87fvvdk3es.fsf@bzg.ath.cx> <87ip09k1d4.fsf@gmail.com> <878v15jqdy.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UzRoR-0003V2-Hl for emacs-orgmode@gnu.org; Wed, 17 Jul 2013 09:30:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UzRoP-0006aC-Q6 for emacs-orgmode@gnu.org; Wed, 17 Jul 2013 09:30:35 -0400 In-Reply-To: <878v15jqdy.fsf@bzg.ath.cx> (Bastien's message of "Wed, 17 Jul 2013 14:57: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: Bastien Cc: Christian Wittern , emacs-orgmode@gnu.org, Nicolas Goaziou --=-=-= Content-Type: text/plain > > This is a general pre-export issue, it does not depend on the > exporters themselves. > > So again, what prevents us to make it easy for users to treat comments > as no-line before parsing and exporting? Unless I'm mistaken, I think this is exactly what my previous patch does (reproduced here for ease of reference). --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-support-inline-comments-w-o-breaking-paragraphs.patch >From ce4c30ebe56d4cd66810bca48824d8841e7b130d Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Tue, 16 Jul 2013 09:44:59 -0600 Subject: [PATCH] support inline comments w/o breaking paragraphs * lisp/org-element.el (org-element-parse-buffer): Strip inline comments as a pre-processing step before exporting. --- lisp/org-element.el | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 8d64657..d69d9ba 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -4092,13 +4092,19 @@ or objects within the parse tree. This function assumes that current major mode is `org-mode'." (save-excursion - (goto-char (point-min)) - (org-skip-whitespace) - (org-element--parse-elements - (point-at-bol) (point-max) - ;; Start in `first-section' mode so text before the first - ;; headline belongs to a section. - 'first-section nil granularity visible-only (list 'org-data nil)))) + (let ((save (buffer-string))) + (unwind-protect + (progn + (goto-char (point-min)) + (delete-matching-lines "^ *# .[^\n]*\n") + (org-skip-whitespace) + (org-element--parse-elements + (point-at-bol) (point-max) + ;; Start in `first-section' mode so text before the first + ;; headline belongs to a section. + 'first-section nil granularity visible-only (list 'org-data nil))) + (delete-region (point-min) (point-max)) + (insert save))))) (defun org-element-parse-secondary-string (string restriction &optional parent) "Recursively parse objects in STRING and return structure. -- 1.8.3.2 --=-=-= Content-Type: text/plain -- Eric Schulte http://cs.unm.edu/~eschulte --=-=-=--