From 0ad032380e932a6d362a3d74ae24f8684ba6a604 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Wed, 9 Dec 2009 22:34:18 +0100 Subject: [PATCH] Fix broken regexp. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Julien Barnier writes: > I recntly noticed that in some specific cases, the final '}' was > esacped when exproting an emphasis element to LaTeX. > > For example, the following element : > > /éaa/ > > Is exported to : > > \emph{éaa\} > > This does not append if the string begins with a space or if it > is ASCII-only. For example, the followig strings are exported > correctly : > > /aaa/ > /ééé/ > > I don't understand why the problem only occurs with non-ASCII chars, > but I think that the regexp to protect added special chars in the > org-export-latex-fontify function is missing a '?' in the > beginning. Tha attached patch corrects it. --- lisp/ChangeLog | 3 +++ lisp/org-latex.el | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0f23b9a22..dafd59cc4 100755 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,9 @@ 2009-12-09 Carsten Dominik * org-latex.el (org-export-latex-make-header): Remove \obeylines. + (org-export-latex-fontify): Fix regexp bug that takes special + care of protecting the right boundary characters in emphasis + matches. * org.el (org-make-link-regexps): Use John Gruber's regexp for urls. diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 62f9a80ea..11891ffac 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -1506,7 +1506,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." (if (caddr emph) (setq rpl (org-export-latex-protect-string rpl)) (save-match-data - (if (string-match "\\`.\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl) + (if (string-match "\\`.?\\(\\\\[a-z]+{\\)\\(.*\\)\\(}\\).?\\'" rpl) (progn (add-text-properties (match-beginning 1) (match-end 1) '(org-protected t) rpl)