From: Carsten Dominik <carsten.dominik@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: Re: [BUG] nested blocks aren't protected on export
Date: Mon, 28 Jun 2010 08:37:33 +0200 [thread overview]
Message-ID: <A93046AA-334F-4036-B2F4-D65C855E2B8B@gmail.com> (raw)
In-Reply-To: <8739w7ane7.fsf@gmail.com>
Hi Eric,
On Jun 28, 2010, at 4:42 AM, Eric Schulte wrote:
> I've put together two patches which fix the problems I mention below.
>
> I'd like to apply these patches, but I fear that they may cause
> unanticipated export problems. I'd be much more comfortable if
> someone
> who knows a little more about the exporters could take a look at
> these.
>
> Thanks -- Eric
>
> From 47fcfd522294560dbe01f00b640631964e063cf0 Mon Sep 17 00:00:00 2001
> From: Eric Schulte <schulte.eric@gmail.com>
> Date: Sun, 27 Jun 2010 19:35:34 -0700
> Subject: [PATCH 1/2] org-exp: check for protection before removing
> comments
>
> * lisp/org-exp.el (org-export-handle-comments): check for protection
> before removing comments
> ---
> lisp/org-exp.el | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/org-exp.el b/lisp/org-exp.el
> index 704c0b7..411557a 100644
> --- a/lisp/org-exp.el
> +++ b/lisp/org-exp.el
> @@ -1650,8 +1650,10 @@ When it is nil, all comments will be removed."
> (match-beginning 0) (match-end 0) '(org-protected t))
> (replace-match (format commentsp (match-string 2)) t t))
> (goto-char (1+ pos))
> - (replace-match "")
> - (goto-char (max (point-min) (1- pos)))))))
> + (org-if-unprotected
> + (replace-match "")
> + (goto-char (max (point-min) (1- pos))))))))
> +
>
> (defun org-export-mark-radio-links ()
> "Find all matches for radio targets and turn them into internal
> links."
> --
> 1.7.0.4
The above patch looks definitely right to me. In fact, I think the
org-if-unprotected should be around the entire content of the while
loop - with an additional fix to make sure search is resumed not
from the beginning of location of a match that has not been processed,
that would create in infinite loop.
>
> From d422f564163e37c51d0727e2992b24b85caf54ea Mon Sep 17 00:00:00 2001
> From: Eric Schulte <schulte.eric@gmail.com>
> Date: Sun, 27 Jun 2010 19:36:14 -0700
> Subject: [PATCH 2/2] org-latex: check for protection before wrapping
> ": " lines as verbatim
>
> * lisp/org-latex.el (org-export-latex-fixed-width): check for
> protection before wrapping ": " lines as verbatim
> ---
> lisp/org-latex.el | 28 ++++++++++++++--------------
> 1 files changed, 14 insertions(+), 14 deletions(-)
>
> diff --git a/lisp/org-latex.el b/lisp/org-latex.el
> index 01a4b05..94f04e6 100644
> --- a/lisp/org-latex.el
> +++ b/lisp/org-latex.el
> @@ -1537,20 +1537,20 @@ The conversion is made depending of STRING-
> BEFORE and STRING-AFTER."
> "When OPT is non-nil convert fixed-width sections to LaTeX."
> (goto-char (point-min))
> (while (re-search-forward "^[ \t]*:\\([ \t]\\|$\\)" nil t)
> - (if opt
> - (progn (goto-char (match-beginning 0))
> - (insert "\\begin{verbatim}\n")
> - (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$")
> - (replace-match (concat (match-string 1)
> - (match-string 2)) t t)
> - (forward-line))
> - (insert "\\end{verbatim}\n\n"))
> - (progn (goto-char (match-beginning 0))
> - (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$")
> - (replace-match (concat "%" (match-string 1)
> - (match-string 2)) t t)
> - (forward-line))))))
> -
> + (org-if-unprotected
> + (if opt
> + (progn (goto-char (match-beginning 0))
> + (insert "\\begin{verbatim}\n")
> + (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$")
> + (replace-match (concat (match-string 1)
> + (match-string 2)) t t)
> + (forward-line))
> + (insert "\\end{verbatim}\n\n"))
> + (progn (goto-char (match-beginning 0))
> + (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$")
> + (replace-match (concat "%" (match-string 1)
> + (match-string 2)) t t)
> + (forward-line)))))))
>
> (defvar org-table-last-alignment) ; defined in org-table.el
> (defvar org-table-last-column-widths) ; defined in org-table.el
> --
> 1.7.0.4
I am not quite certain why this second patch is needed?
- Carsten
next prev parent reply other threads:[~2010-06-28 7:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-26 2:18 [BUG] nested blocks aren't protected on export Eric Schulte
2010-06-28 2:42 ` Eric Schulte
2010-06-28 6:37 ` Carsten Dominik [this message]
2010-06-28 15:04 ` Eric Schulte
2010-06-28 16:21 ` Carsten Dominik
2010-06-28 18:40 ` Eric Schulte
2010-06-28 19:59 ` Eric Schulte
2010-06-29 4:32 ` Carsten Dominik
2010-06-29 5:09 ` Eric Schulte
2010-06-28 15:07 ` Nicolas Goaziou
2010-06-28 15:30 ` Eric Schulte
2010-06-28 17:04 ` Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A93046AA-334F-4036-B2F4-D65C855E2B8B@gmail.com \
--to=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=schulte.eric@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).