Browse Source

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>
Nicolas Goaziou 8 years ago
parent
commit
23a9492055
1 changed files with 8 additions and 1 deletions
  1. 8 1
      lisp/org.el

+ 8 - 1
lisp/org.el

@@ -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)