mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-24 14:02:51 +00:00
Allow Org-mode source code examples in LaTeX export
This did not work because the parser would still match headlines that are really part of the examples.
This commit is contained in:
parent
7c59da0767
commit
f759cc17a7
|
@ -1,3 +1,12 @@
|
||||||
|
2009-11-25 Carsten Dominik <carsten.dominik@gmail.com>
|
||||||
|
|
||||||
|
* org-latex.el (org-export-latex-parse-global)
|
||||||
|
(org-export-latex-parse-content)
|
||||||
|
(org-export-latex-parse-subcontent): Use
|
||||||
|
`org-re-search-forward-unprotected'.
|
||||||
|
|
||||||
|
* org-macs.el (org-re-search-forward-unprotected): New function.
|
||||||
|
|
||||||
2009-11-24 Carsten Dominik <carsten.dominik@gmail.com>
|
2009-11-24 Carsten Dominik <carsten.dominik@gmail.com>
|
||||||
|
|
||||||
* org-mobile.el (org-mobile-agendas): New option.
|
* org-mobile.el (org-mobile-agendas): New option.
|
||||||
|
|
|
@ -744,7 +744,7 @@ Return a list reflecting the document structure."
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(let* ((cnt 0) output
|
(let* ((cnt 0) output
|
||||||
(depth org-export-latex-sectioning-depth))
|
(depth org-export-latex-sectioning-depth))
|
||||||
(while (re-search-forward
|
(while (org-re-search-forward-unprotected
|
||||||
(concat "^\\(\\(?:\\*\\)\\{"
|
(concat "^\\(\\(?:\\*\\)\\{"
|
||||||
(number-to-string (+ (if odd 2 1) level))
|
(number-to-string (+ (if odd 2 1) level))
|
||||||
"\\}\\) \\(.*\\)$")
|
"\\}\\) \\(.*\\)$")
|
||||||
|
@ -752,7 +752,7 @@ Return a list reflecting the document structure."
|
||||||
(when (> level 0)
|
(when (> level 0)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(re-search-forward
|
(org-re-search-forward-unprotected
|
||||||
(concat "^\\(\\(?:\\*\\)\\{"
|
(concat "^\\(\\(?:\\*\\)\\{"
|
||||||
(number-to-string level)
|
(number-to-string level)
|
||||||
"\\}\\) \\(.*\\)$") nil t)))) t)
|
"\\}\\) \\(.*\\)$") nil t)))) t)
|
||||||
|
@ -764,7 +764,7 @@ Return a list reflecting the document structure."
|
||||||
(narrow-to-region
|
(narrow-to-region
|
||||||
(point)
|
(point)
|
||||||
(save-match-data
|
(save-match-data
|
||||||
(if (re-search-forward
|
(if (org-re-search-forward-unprotected
|
||||||
(concat "^\\(\\(?:\\*\\)\\{"
|
(concat "^\\(\\(?:\\*\\)\\{"
|
||||||
(number-to-string (+ (if odd 2 1) level))
|
(number-to-string (+ (if odd 2 1) level))
|
||||||
"\\}\\) \\(.*\\)$") nil t)
|
"\\}\\) \\(.*\\)$") nil t)
|
||||||
|
@ -788,7 +788,7 @@ Return a list reflecting the document structure."
|
||||||
(defun org-export-latex-parse-content ()
|
(defun org-export-latex-parse-content ()
|
||||||
"Extract the content of a section."
|
"Extract the content of a section."
|
||||||
(let ((beg (point))
|
(let ((beg (point))
|
||||||
(end (if (re-search-forward "^\\(\\*\\)+ .*$" nil t)
|
(end (if (org-re-search-forward-unprotected "^\\(\\*\\)+ .*$" nil t)
|
||||||
(progn (beginning-of-line) (point))
|
(progn (beginning-of-line) (point))
|
||||||
(point-max))))
|
(point-max))))
|
||||||
(buffer-substring beg end)))
|
(buffer-substring beg end)))
|
||||||
|
@ -796,7 +796,7 @@ Return a list reflecting the document structure."
|
||||||
(defun org-export-latex-parse-subcontent (level odd)
|
(defun org-export-latex-parse-subcontent (level odd)
|
||||||
"Extract the subcontent of a section at LEVEL.
|
"Extract the subcontent of a section at LEVEL.
|
||||||
If ODD Is non-nil, assume subcontent only contains odd sections."
|
If ODD Is non-nil, assume subcontent only contains odd sections."
|
||||||
(if (not (re-search-forward
|
(if (not (org-re-search-forward-unprotected
|
||||||
(concat "^\\(\\(?:\\*\\)\\{"
|
(concat "^\\(\\(?:\\*\\)\\{"
|
||||||
(number-to-string (+ (if odd 4 2) level))
|
(number-to-string (+ (if odd 4 2) level))
|
||||||
"\\}\\) \\(.*\\)$")
|
"\\}\\) \\(.*\\)$")
|
||||||
|
|
|
@ -123,6 +123,14 @@ We use a macro so that the test can happen at compilation time."
|
||||||
,@body))
|
,@body))
|
||||||
(put 'org-if-unprotected-at 'lisp-indent-function 1)
|
(put 'org-if-unprotected-at 'lisp-indent-function 1)
|
||||||
|
|
||||||
|
(defun org-re-search-forward-unprotected (&rest args)
|
||||||
|
"Like re-search-forward, but stop only in unprotected places."
|
||||||
|
(catch 'exit
|
||||||
|
(while t
|
||||||
|
(unless (apply 're-search-forward args)
|
||||||
|
(throw 'exit nil))
|
||||||
|
(unless (get-text-property (match-beginning 0) 'org-protected)
|
||||||
|
(throw 'exit (point))))))
|
||||||
|
|
||||||
(defmacro org-with-remote-undo (_buffer &rest _body)
|
(defmacro org-with-remote-undo (_buffer &rest _body)
|
||||||
"Execute BODY while recording undo information in two buffers."
|
"Execute BODY while recording undo information in two buffers."
|
||||||
|
|
Loading…
Reference in a new issue