[Ilugc] adding brackets in emacs
Vijay Kumar
vijaykumar at bravegnu.org
Sat Nov 10 10:08:56 IST 2007
Kenneth Gonsalves wrote:
> a common task is adding strings for i18n. Say I have a string -
> mystring. I need to mark it like so:
>
> _("mystring"). What I want to do is: select the string and press a key
> so it will mark it. How is this done in emacs?
The following elisp function will mark the string under cursor with
_(...). It will not work for one special case in which there is a double
quotes within the string.
(defun mark-i18n ()
(interactive)
(save-excursion
(search-backward "\"")
(insert "_(")
(forward-char 1)
(search-forward "\"")
(insert ")")))
Put this definition in your .emacs and bind the function to the key of
your choice.
Regards,
Vijay
More information about the ilugc
mailing list