From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Seweryn Kokot Newsgroups: gmane.emacs.help Subject: Re: how to insert single quotes around a command? Date: Fri, 31 Oct 2008 21:22:02 +0100 Message-ID: <87tzasldlh.fsf@poczta.po.opole.pl> References: <87ej1x3wp5.fsf@poczta.po.opole.pl> <707414EF-6A63-47A9-8E92-876A0F610691@digg.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1225484379 16238 80.91.229.12 (31 Oct 2008 20:19:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 31 Oct 2008 20:19:39 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Oct 31 21:20:41 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Kw0Ty-0005se-Rp for geh-help-gnu-emacs@m.gmane.org; Fri, 31 Oct 2008 21:20:35 +0100 Original-Received: from localhost ([127.0.0.1]:60323 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kw0Ss-0004CO-62 for geh-help-gnu-emacs@m.gmane.org; Fri, 31 Oct 2008 16:19:26 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kw0SX-0004CG-UB for help-gnu-emacs@gnu.org; Fri, 31 Oct 2008 16:19:05 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kw0SV-0004B6-UG for help-gnu-emacs@gnu.org; Fri, 31 Oct 2008 16:19:05 -0400 Original-Received: from [199.232.76.173] (port=43590 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kw0SV-0004B3-Nn for help-gnu-emacs@gnu.org; Fri, 31 Oct 2008 16:19:03 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:46742 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kw0SV-0006bO-Nh for help-gnu-emacs@gnu.org; Fri, 31 Oct 2008 16:19:04 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Kw0SP-0007xX-KZ for help-gnu-emacs@gnu.org; Fri, 31 Oct 2008 20:18:57 +0000 Original-Received: from nat-warynskiego.po.opole.pl ([217.173.199.132]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 31 Oct 2008 20:18:57 +0000 Original-Received: from sewkokot by nat-warynskiego.po.opole.pl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 31 Oct 2008 20:18:57 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 44 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: nat-warynskiego.po.opole.pl X-Operating-System: Debian GNU/Linux User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:XJBZd8Lhlu+73iWHB0WJOCFi0Ks= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:59307 Archived-At: Ian Eure 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