From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Shug Boabby" Newsgroups: gmane.emacs.help Subject: Re: left brackets insert both Date: 25 Mar 2005 10:23:32 -0800 Organization: http://groups.google.com Message-ID: <1111775012.703198.185290@o13g2000cwo.googlegroups.com> References: <1111765040.509327.116280@g14g2000cwa.googlegroups.com> <87ll8b2022.fsf@robotron.ath.cx> <1111769127.619222.303620@z14g2000cwz.googlegroups.com> <1111772988.425339.47700@g14g2000cwa.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: sea.gmane.org 1111775081 5629 80.91.229.2 (25 Mar 2005 18:24:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 Mar 2005 18:24:41 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 25 19:24:41 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DEtU4-0003jZ-Tx for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Mar 2005 19:24:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DEtjb-0006bE-St for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Mar 2005 13:40:39 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!o13g2000cwo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 22 Original-NNTP-Posting-Host: 217.43.187.239 Original-X-Trace: posting.google.com 1111775018 16268 127.0.0.1 (25 Mar 2005 18:23:38 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 25 Mar 2005 18:23:38 +0000 (UTC) In-Reply-To: <1111772988.425339.47700@g14g2000cwa.googlegroups.com> User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: o13g2000cwo.googlegroups.com; posting-host=217.43.187.239; posting-account=jQz-EQ0AAABiniXWq8YyRVQ60t_LIYwt Original-Xref: shelby.stanford.edu gnu.emacs.help:129596 Original-To: help-gnu-emacs@gnu.org 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 X-MailScanner-To: geh-help-gnu-emacs@m.gmane.org Xref: news.gmane.org gmane.emacs.help:25147 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:25147 excellent rgb! i have kept your original function as it is nice anyway, but modified it to this: (defmacro my-bothbraces-if-double (new-txt) "If the last key is the same as this key, insert new-txt and go back a char" `(lambda (cnt) (interactive "p") (if (equal (preceding-char) last-command-char) (progn (insert ,new-txt) (backward-char)) (self-insert-command cnt)))) (global-set-key "\"" (my-bothbraces-if-double "\"")) (global-set-key "\'" (my-bothbraces-if-double "\'")) (global-set-key "\{" (my-bothbraces-if-double "\}")) (global-set-key "\[" (my-bothbraces-if-double "\]")) (global-set-key "\(" (my-bothbraces-if-double "\)")) (global-set-key "\<" (my-bothbraces-if-double "\>")) i hope it helps others!