[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Should comments break paragraphs?
From: |
Eric Schulte |
Subject: |
Re: [O] Should comments break paragraphs? |
Date: |
Wed, 17 Jul 2013 07:28:31 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
>
> 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).
>From ce4c30ebe56d4cd66810bca48824d8841e7b130d Mon Sep 17 00:00:00 2001
From: Eric Schulte <address@hidden>
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
--
Eric Schulte
http://cs.unm.edu/~eschulte
- Re: [O] Should comments break paragraphs?, (continued)
- Re: [O] Should comments break paragraphs?, Nicolas Goaziou, 2013/07/17
- Re: [O] Should comments break paragraphs?, Bastien, 2013/07/17
- Re: [O] Should comments break paragraphs?, Rainer M Krug, 2013/07/17
- Re: [O] Should comments break paragraphs?, Rasmus, 2013/07/17
- Re: [O] Should comments break paragraphs?, Eric S Fraga, 2013/07/17
- Re: [O] Should comments break paragraphs?, Christian Moe, 2013/07/18
- Re: [O] Should comments break paragraphs?, Eric Abrahamsen, 2013/07/18
- Re: [O] Should comments break paragraphs?, Rasmus, 2013/07/18
- Re: [O] Should comments break paragraphs?, Eric Abrahamsen, 2013/07/18
- Re: [O] Should comments break paragraphs?, Rasmus, 2013/07/18
- Re: [O] Should comments break paragraphs?,
Eric Schulte <=
- Re: [O] Should comments break paragraphs?, Bastien, 2013/07/17
- Re: [O] Should comments break paragraphs?, Nicolas Goaziou, 2013/07/17
- Re: [O] Should comments break paragraphs?, Eric S Fraga, 2013/07/17
- Re: [O] Should comments break paragraphs?, Nicolas Goaziou, 2013/07/17
- Re: [O] Should comments break paragraphs?, Eric S Fraga, 2013/07/17
- Re: [O] Should comments break paragraphs?, Suvayu Ali, 2013/07/17
- Re: [O] Should comments break paragraphs?, Eric Schulte, 2013/07/17
- Re: [O] Should comments break paragraphs?, Nicolas Goaziou, 2013/07/17
- Re: [O] Should comments break paragraphs?, Andreas Leha, 2013/07/17
- Re: [O] Should comments break paragraphs?, Eric Schulte, 2013/07/17