Browse Source

Allow emphasis markers after an hyphen

* lisp/org.el (org-emphasis-regexp-components): Allow emphasis markers
  after an hyphen.
(org-do-emphasis-faces): Do not strike-through table hlines.

Hypen is already allowed after emphasis markers.  This allows one to
write, e.g., 2017-*09*-27.
Nicolas Goaziou 7 years ago
parent
commit
dd6be5d161
1 changed files with 11 additions and 7 deletions
  1. 11 7
      lisp/org.el

+ 11 - 7
lisp/org.el

@@ -4376,7 +4376,7 @@ After a match, the match groups contain these elements:
 ;; set this option proved cumbersome.  See this message/thread:
 ;; http://article.gmane.org/gmane.emacs.orgmode/68681
 (defvar org-emphasis-regexp-components
-  '(" \t('\"{" "- \t.,:!?;'\")}\\[" " \t\r\n" "." 1)
+  '("- \t('\"{" "- \t.,:!?;'\")}\\[" " \t\r\n" "." 1)
   "Components used to build the regular expression for emphasis.
 This is a list with five entries.  Terminology:  In an emphasis string
 like \" *strong word* \", we call the initial space PREMATCH, the final
@@ -5782,12 +5782,16 @@ This should be called after the variable `org-link-parameters' has changed."
 		  (goto-char (match-beginning 0))
 		  ;; 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)))))
+		  ;; markup either.  Do not match table hlines.
+		  (and
+		   (not (looking-at-p org-outline-regexp-bol))
+		   (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)))))
 	    (pcase-let ((`(,_ ,face ,_) (assoc marker org-emphasis-alist)))
 	      (font-lock-prepend-text-property
 	       (match-beginning 2) (match-end 2) 'face face)