In org-mode
, writing a word wrapped by /
makes it italic. For instance, /word/
becomes word.
Is there a command in Emacs to make something go from ẁord
to /word/
?
Maybe some org related command only to do this?
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityAs usual, Org has you covered: org-emphasize
, bound by default to C-c C-x C-f
.
This will work for all emphasis markers. So, for italics, select the word and C-c C-x C-f /
.
The wrap-region package does this. You can install it from MELPA.
Once you have it installed, you can add wrappers for org:
(wrap-region-add-wrappers
'(("*" "*" nil org-mode)
("/" "/" nil org-mode)
("~" "~" nil org-mode)
("+" "+" nil org-mode)))
You turn it on with M-x wrap-region-mode
, or M-x wrap-region-global-mode
if you want it for every buffer. Once it's on, if you select a word (or sentence or ...) and press one of the 'wrapper' keys, the characters will be added to the beginning and end of the active region. See the link above for details about customization for different modes.
When electric-pair-mode
is on, the following syntax rule suffices:
(modify-syntax-entry ?/ "(/")
Notice that such rules should be added to org-mode
only.
/
is typed, but there is no insertion of anything extra. Have you tried it with emacs -Q
?
"
, it will encircle it with the quotes. Take a look at `"
and such is only available if you have enabledelectric-pair-mode
or its local equivalent.