From: Seweryn Kokot <sewkokot@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: how to insert single quotes around a command?
Date: Fri, 31 Oct 2008 21:22:02 +0100 [thread overview]
Message-ID: <87tzasldlh.fsf@poczta.po.opole.pl> (raw)
In-Reply-To: 707414EF-6A63-47A9-8E92-876A0F610691@digg.com
Ian Eure <ian@digg.com> writes:
> On Oct 31, 2008, at 3:06 AM, Seweryn Kokot wrote:
>
>> Hello,
>>
>> Many times when I write doc strings for elisp functions I forget to
>> insert
>> single-quotes around commands or variables like `a-command' or
>> insert it
>> wrong like 'a-command'. Is there a function or keybinding to do it
>> properly? Maybe a function which enclose a selected command with
>> single-quotes?
>>
>
> Sounds like you want insert-pair:
> (define-key (current-global-map) "\M-'" 'insert-pair)
> (define-key (current-global-map) "\C-c`" 'insert-pair)
>
> Which makes M-' insert a pair of single quotes, and C-c ` insert `'.
> Then you can do M-1 M-' or M-1 C-c ` to enclose the sexp following
> point in the correct quotes.
>
> insert-pair is super handy, I use M-(sym) for () "" [] etc.
>
> - Ian
Thanks for inspiration. I also found `skeleton-pair-insert-maybe'
function from skeleton library
(setq skeleton-pair t)
(global-set-key "(" 'skeleton-pair-insert-maybe) % ()
(global-set-key "[" 'skeleton-pair-insert-maybe) % []
(global-set-key "{" 'skeleton-pair-insert-maybe) % ""
(global-set-key "\"" 'skeleton-pair-insert-maybe) % ''
(global-set-key "`" 'skeleton-pair-insert-maybe) % `'
This inserts pairs of chars and also enclose a region. Now I have at
least three solutions and will see with time what fits me better.
--
regards,
Seweryn
next prev parent reply other threads:[~2008-10-31 20:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-31 10:06 how to insert single quotes around a command? Seweryn Kokot
2008-10-31 18:30 ` Ian Eure
2008-10-31 20:22 ` Seweryn Kokot [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-10-31 12:44 martin rudalics
2008-10-31 14:33 ` Seweryn Kokot
[not found] <mailman.2562.1225457196.25473.help-gnu-emacs@gnu.org>
2008-10-31 20:09 ` Barry Margolin
2008-10-31 21:42 martin rudalics
2008-10-31 21:42 martin rudalics
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tzasldlh.fsf@poczta.po.opole.pl \
--to=sewkokot@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.