One nice feature of modern word processors is that one can change the format (say, from roman to italic) of a word without actually selecting it; one just needs to place the text cursor within the word and tell the word processor (via a keyboard shortcut) to change its format. (Smart editing, I believe it is sometimes called.)
Is there a way of doing that in Emacs-AUCTeX? (The usual way to change the format---that is, insert a format command---is to select the word [mark its region] and then press the key combination for the command [e.g. C-c C-f C-i
to insert \textit{}
].)
The shortcut C-c C-f calls
TeX-font
. Then it emphasizes/italicizes/whatever, based on the last key chord. So the solution is to advice this function:Now, when no region is selected,
TeX-font
will work as if the current word was selected. You can turn this behavior on/off by settingTeX-font-current-word
tot
/nil
.