From 33744b0de53bc2187f1722ac313affb7c72bdad0 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Fri, 21 Nov 2008 19:45:51 +0100 Subject: [PATCH] Allow one comment line before the first headline. When the export skips the text before the first headline, we now include the comment line before the first headline, if any. This makes sure that we can specify an anchor for this headline. --- doc/org.texi | 7 ++++--- lisp/ChangeLog | 4 ++++ lisp/org-exp.el | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 23a9f66e7..631b063e4 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -2435,9 +2435,10 @@ convenient to put them into a comment line. For example @end example @noindent In HTML export (@pxref{HTML export}), such targets will become -named anchors for direct access through @samp{http} links@footnote{Note -that text before the first headline is usually not exported, so the -first such target should be after the first headline.}. +named anchors for direct access through @samp{http} links@footnote{Note that +text before the first headline is usually not exported, so the first such +target should be after the first headline, or in the line directly before the +first headline.}. If no dedicated target exists, Org will search for the words in the link. In the above example the search would be for @samp{my target}. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cbd2f0926..ce4573c83 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2008-11-21 Carsten Dominik + * org-exp.el (org-export-preprocess-string): Allow one comment + line before the first headline to always be included. This is + to not miss a commented target. + * org-mouse.el (org-mouse-insert-item): Call `org-indent-to-column' instead of `indent-to', for XEmacs compatibility. diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 20974887d..1d5675425 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1469,7 +1469,7 @@ on this string to produce the exported version." ;; Get the correct stuff before the first headline (when (plist-get parameters :skip-before-1st-heading) (goto-char (point-min)) - (when (re-search-forward "^\\*+[ \t]" nil t) + (when (re-search-forward "\\(^#.*\n\\)^\\*+[ \t]" nil t) (delete-region (point-min) (match-beginning 0)) (goto-char (point-min)) (insert "\n"))) -- 2.11.4.GIT