5

I tried to make the comma *,* bold, but no success. I tried with verbatim =,=, but no success as well.

2 Answers 2

10

You can achieve what you want by adding the following to your .emacs:

(setcar (nthcdr 2 org-emphasis-regexp-components) " \t\r\n\"'")
(org-set-emph-re 'org-emphasis-regexp-components org-emphasis-regexp-components)

Explanation

The manual says that org-emphasis-regexp-components can be used to

fine tune what characters are allowed before and after the markup characters [...].

It is a list containing five entries. The third entry lists characters that are not allowed to immediately follow or precede markup characters. By default, , is one of them so in order to successfully apply formatting to this character we have to remove it from the list of characters disallowed before or after the markup characters. This is what the call to setcar does. The purpose of the second line is to rebuild the regular expression for emphasis based on the modified version of org-emphasis-regexp-components.


Sources

2

There's a similar problem and I've figured out a solution.

@itsjeyd's solution is right but not 100% correct. We need an extra (org-element--set-regexps).

The full code snippets:

(setcar (nthcdr 2 org-emphasis-regexp-components) " \t\n\r")
(custom-set-variables `(org-emphasis-alist ',org-emphasis-alist))
(org-element--set-regexps)
2
  • Yes, @itsjeyd's solution should be amended. Your answer is perfect. Also, one needs to make sure to have (org-mode), or else (org-element--set-regexps) will not work. Thank you.
    – gsl
    Jan 5, 2016 at 14:37
  • @itsjeyd's solution worked for me on OSX 10.11.6 / Emacs: 25.1.1 / Spacemacs: 0.105.21. This worked too but raised an error.
    – Jay
    Aug 17, 2016 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.