From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: August Karlstrom Newsgroups: gmane.emacs.help Subject: Re: show-paren-timeout Date: Fri, 11 Mar 2005 20:37:09 +0100 Message-ID: <1110569829.5326.3.camel@c83-250-201-97.bredband.comhem.se> References: <1110508233.5696.14.camel@c83-250-201-97.bredband.comhem.se> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1110570375 16998 80.91.229.2 (11 Mar 2005 19:46:15 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 11 Mar 2005 19:46:15 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 11 20:46:14 2005 Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1D9q0M-0000KB-Hw for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Mar 2005 20:41:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9qFU-0000zQ-WA for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Mar 2005 14:56:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1D9qDd-0000br-F5 for help-gnu-emacs@gnu.org; Fri, 11 Mar 2005 14:54:48 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1D9qDT-0000Xu-LR for help-gnu-emacs@gnu.org; Fri, 11 Mar 2005 14:54:37 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1D9qDT-0000WO-4c for help-gnu-emacs@gnu.org; Fri, 11 Mar 2005 14:54:35 -0500 Original-Received: from [81.228.10.115] (helo=av1-2-sn4.m-sp.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1D9pwR-00023F-BA for help-gnu-emacs@gnu.org; Fri, 11 Mar 2005 14:36:59 -0500 Original-Received: by av1-2-sn4.m-sp.skanova.net (Postfix, from userid 502) id 0AE9B37E46; Fri, 11 Mar 2005 20:36:56 +0100 (CET) Original-Received: from smtp4-2-sn4.m-sp.skanova.net (smtp4-2-sn4.m-sp.skanova.net [81.228.10.180]) by av1-2-sn4.m-sp.skanova.net (Postfix) with ESMTP id F144737E42 for ; Fri, 11 Mar 2005 20:36:55 +0100 (CET) Original-Received: from c83-250-201-97.bredband.comhem.se (c83-250-201-97.bredband.comhem.se [83.250.201.97]) by smtp4-2-sn4.m-sp.skanova.net (Postfix) with ESMTP id DB86137E47 for ; Fri, 11 Mar 2005 20:36:55 +0100 (CET) Original-To: help-gnu-emacs@gnu.org In-Reply-To: <1110508233.5696.14.camel@c83-250-201-97.bredband.comhem.se> X-Mailer: Evolution 2.0.2 (2.0.2-3) 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:24775 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:24775 On fre, 2005-03-11 at 03:30 +0100, August Karlstrom wrote: > Does anyone know if there's a way to customize `show-paren-mode' so that > any matching parenthesis is highlighted, but only for a limited amount > of time, say one second? I find it annoying that the highlighting > doesn't go away when I leave the cursor beside a parenthesis. There is > an option called `show-paren-delay' but no `show-paren-timeout'. I fixed it myself. If anyone's interested here's the code I added to `.emacs': ;; SHOW PAREN MODE CUSTOMIZATION (defconst my-show-paren-timeout 1 "*Time in seconds until a matching paren is unhighlighted.") (defvar my-show-paren-timeout-timer nil "*Timer used by advice `timeout' of `show-paren-function'.") (defvar my-show-paren-timeout-saved-point nil "*Location used by advice `timeout' of `show-paren-function'.") (require 'advice) (defadvice show-paren-function (after timeout) "Unhighlight matching paren after `my-show-paren-timeout' seconds." (if (and (integerp my-show-paren-timeout-saved-point) (= (point) my-show-paren-timeout-saved-point)) (progn (delete-overlay show-paren-overlay) (delete-overlay show-paren-overlay-1)) (setq my-show-paren-timeout-saved-point (point)) (setq my-show-paren-timeout-timer (run-with-idle-timer my-show-paren-timeout nil (lambda () (when (= (point) my-show-paren-timeout-saved- point) (delete-overlay show-paren-overlay) (delete-overlay show-paren- overlay-1))))))) (ad-activate 'show-paren-function) -- August