summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-10-22 14:39:36 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-10-22 14:39:36 +0200
commita2a034f5b9088175c9fbcf034bc1094982ae739c (patch)
tree46bb28e2f120a7e6c85e6b8bfa267a2bb1449eab
parent1613153aac84a183a9b91f7fde788f6552bc2954 (diff)
downloadorg-mode-a2a034f5b9088175c9fbcf034bc1094982ae739c.tar.gz
Prevent leaking fontification across table fields' borders
* lisp/org.el (org-do-emphasis-faces): Prevent leaking fontification across table fields' borders. Reported-by: Ryan <rct@thompsonclan.org> <http://lists.gnu.org/archive/html/emacs-orgmode/2017-10/msg00321.html>
-rw-r--r--lisp/org.el19
1 files changed, 12 insertions, 7 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 68e90ff..d7fff02 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5752,18 +5752,23 @@ This should be called after the variable `org-link-parameters' has changed."
(verbatim? (member marker '("~" "="))))
(when (save-excursion
(goto-char (match-beginning 0))
- ;; Do not match headline stars. Do not consider
- ;; stars of a headline as closing marker for bold
- ;; markup either. Do not match table hlines.
(and
- (not (looking-at-p org-outline-regexp-bol))
+ ;; Do not match headline stars. Do not consider
+ ;; stars of a headline as closing marker for bold
+ ;; markup either.
+ (not (and (equal marker "*")
+ (save-excursion
+ (forward-char)
+ (skip-chars-backward "*")
+ (looking-at-p org-outline-regexp-bol))))
+ ;; Do not match table hlines.
(not (and (equal marker "+")
(org-match-line
"^[ \t]*\\(|[-+]+|?\\|\\+[-+]+\\+\\)[ \t]*$")))
(looking-at (if verbatim? org-verbatim-re org-emph-re))
- (not (string-match-p
- (concat org-outline-regexp-bol "\\'")
- (match-string 0)))))
+ ;; At a table row, do not cross cell boundaries.
+ (not (and (save-match-data (org-match-line "[ \t]*|"))
+ (string-match-p "|" (match-string 4))))))
(pcase-let ((`(,_ ,face ,_) (assoc marker org-emphasis-alist)))
(font-lock-prepend-text-property
(match-beginning 2) (match-end 2) 'face face)