
/ Update
The function will now emphasize previous word when at the end of it (you can type a word, then emphasize it) or the current word (e.g. when the cursor is over it)./
An easy way to emphasize or enclose words or region
with pairs matching : “”, «», [], and parentheses of course.
Unbreakable spaces are also inserted around where the typographical
convention demands it.
Better than org-emphasize
.
In my book, the org formatting becomes, when the cursor is at the beginning of word or over a region:
C-= *
bold
C-= /
italic
C-= _
underline
C-= (
(parentheses)
C-= “
“ quotes ”
And I must say there is much confort in doing so.
The binding to C-=
can be discussed.
The code:
Perhaps somebody already wrote this function and there is certainly rooms for improvement. It took me several attempt to write it down correctly and I learned 100% of the elisp functions invocated while doing so. I hope it will be of any use to you dear reader.
Current known limitations
- It won't work on lone characters used to emphasize expressions, such as ( " < > “ » and will look for either the next pairing character and emphasize the next word.
- ( ) trying here, between the parentheses returns: forward-sexp: Scan error: "Containing expression ends prematurely"