emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [BUG] Did COMMENT break?


From: Nick Dokos
Subject: Re: [O] [BUG] Did COMMENT break?
Date: Sun, 13 Mar 2011 20:48:15 -0400

Rasmus <address@hidden> wrote:

> Hi,
> It seems that 
> 
> ,----
> | #+BEGIN_COMMENT 
> |  ...
> | #+END_COMMENT
> `----
> 
> Might be broken in Org-mode 7.5. According to the manual, 
> 
> ,----
> | Finally, regions surrounded by
> | ‘#+BEGIN_COMMENT’ ... ‘#+END_COMMENT’ will not be exported.
> `----
> 
> Consider the following example generated with Org-mode 7.5 in Emacs 24.0.50
> (started without config files).
> 
> ,----
> | #+TITLE: this is a test
> | 
> | #+BEGIN_COMMENT
> | Don't export me
> | #+END_COMMENT
> | 
> | I'd like to be exposed
> `----
> 
> The HTML export is:
> 
> ,----
> | <snip>
> | <h1 class="title">this is a test</h1>
> | 
> | <div class="org-comment">
> | </br>
> | <p>
> | <p>
> | Don't export me
> | </p>
> | </div>
> | 
> | I'd like to be exposed
> | <snip>
> `----
> 
> The LaTeX export is:
> 
> ,----
> | \begin{verbatim}
> | Don't export me
> | \end{verbatim}
> | I'd like to be exposed
> `----
> 

Indeed.

It seems that one of the hair-raising regexps that Carsten manages
to come up with is not quite right. Try this patch for now:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 34f101d..e1dcea0 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1834,7 +1834,7 @@ table line.  If it is a link, add it to the line 
containing the link."
     (goto-char (point-min))
     (setq case-fold-search t)
     (while (re-search-forward
-           "^#\\+begin_comment[ \t]*\n[^\000]*?^#\\+end_comment\\>.*" nil t)
+           "^#\\+begin_comment[ \t]*\n[^\000]*?\n#\\+end_comment\\>.*" nil t)
       (replace-match "" t t))
     ;; Remove subtrees that are commented
     (goto-char (point-min))
--8<---------------cut here---------------end--------------->8---

Nick




reply via email to

[Prev in Thread] Current Thread [Next in Thread]