Fix bold emphasis around headlines

* lisp/org.el (org-do-emphasis-faces): Fix bold emphasis around
  headlines.  In particular, stars at the beginning of a headline are
  not bold markup, and bold markup cannot end with stars at the
  beginning of a headline.

Reported-by: Ian Dunn <dunni@gnu.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/110814>
This commit is contained in:
Nicolas Goaziou 2016-12-14 11:14:29 +01:00
parent 4691033abb
commit 23a9492055
1 changed files with 8 additions and 1 deletions

View File

@ -5849,7 +5849,14 @@ This should be called after the variable `org-link-parameters' has changed."
(verbatim? (member marker '("~" "="))))
(when (save-excursion
(goto-char (match-beginning 0))
(looking-at (if verbatim? org-verbatim-re org-emph-re)))
;; Do not match headline stars. Do not consider
;; stars of a headline as closing marker for bold
;; markup either.
(and (not (looking-at-p org-outline-regexp-bol))
(looking-at (if verbatim? org-verbatim-re org-emph-re))
(not (string-match-p
(concat org-outline-regexp-bol "\\'")
(match-string 0)))))
(pcase-let ((`(,_ ,face ,_) (assoc marker org-emphasis-alist)))
(font-lock-prepend-text-property
(match-beginning 2) (match-end 2) 'face face)