From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "rgb" Newsgroups: gmane.emacs.help Subject: Re: left brackets insert both Date: 25 Mar 2005 09:49:48 -0800 Organization: http://groups.google.com Message-ID: <1111772988.425339.47700@g14g2000cwa.googlegroups.com> References: <1111765040.509327.116280@g14g2000cwa.googlegroups.com> <87ll8b2022.fsf@robotron.ath.cx> <1111769127.619222.303620@z14g2000cwz.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 1111773308 32630 80.91.229.2 (25 Mar 2005 17:55:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 25 Mar 2005 17:55:08 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 25 18:55:08 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DEt0z-0007pt-Sm for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Mar 2005 18:54:34 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DEtGW-0002tW-LD for geh-help-gnu-emacs@m.gmane.org; Fri, 25 Mar 2005 13:10:36 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!g14g2000cwa.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 30 Original-NNTP-Posting-Host: 198.74.20.73 Original-X-Trace: posting.google.com 1111772992 13691 127.0.0.1 (25 Mar 2005 17:49:52 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 25 Mar 2005 17:49:52 +0000 (UTC) In-Reply-To: <1111769127.619222.303620@z14g2000cwz.googlegroups.com> User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: g14g2000cwa.googlegroups.com; posting-host=198.74.20.73; posting-account=C7LM4w0AAAD23IRuMuUUJVCLQTuHhTK8 Original-Xref: shelby.stanford.edu gnu.emacs.help:129593 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:25144 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:25144 Shug Boabby wrote: > excellent! i had found the exact setup once rgb had pointed me to the > function call, but cheers david! > > however, it is sometimes annoying that a single type of a bracket does > this... any chance i could set it only to work on double taps? i get > nothing when i try something like: > (global-set-key [?\< ?\<] 'skeleton-pair-insert-maybe) > i guess its trying to find the skeleton pair to << instead of < You can probably adapt this to your needs. (defmacro my-insert-if-double (new-txt) "If last key same as this key, replace both with new-txt." `(lambda (cnt) (interactive "p") (if (equal (preceding-char) last-command-char) (progn (backward-delete-char 1) (insert ,new-txt)) (self-insert-command cnt)))) (add-hook 'html-mode-hook (lambda () (local-set-key [(<)] (my-insert-if-double "<")) (local-set-key [(>)] (my-insert-if-double ">")) (local-set-key [(&)] (my-insert-if-double "&")) (local-set-key [(\")] (my-insert-if-double """))))