From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Luc Teirlinck Newsgroups: gmane.emacs.devel Subject: Re: show-paren-mode vs blink-matching-paren-on-screen Date: Sat, 26 Nov 2005 12:32:06 -0600 (CST) Message-ID: <200511261832.jAQIW6m01544@raven.dms.auburn.edu> References: <438825EE.8010202@gmx.at> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1133030046 15929 80.91.229.2 (26 Nov 2005 18:34:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 26 Nov 2005 18:34:06 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 26 19:34:03 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Eg4rO-0000Cy-BE for ged-emacs-devel@m.gmane.org; Sat, 26 Nov 2005 19:33:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Eg4rN-0000YH-MS for ged-emacs-devel@m.gmane.org; Sat, 26 Nov 2005 13:33:17 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Eg4rE-0000Y2-Vh for emacs-devel@gnu.org; Sat, 26 Nov 2005 13:33:09 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Eg4rE-0000Xq-CD for emacs-devel@gnu.org; Sat, 26 Nov 2005 13:33:08 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Eg4rE-0000Xn-7Y for emacs-devel@gnu.org; Sat, 26 Nov 2005 13:33:08 -0500 Original-Received: from [131.204.53.104] (helo=manatee.dms.auburn.edu) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Eg4rD-00068B-95 for emacs-devel@gnu.org; Sat, 26 Nov 2005 13:33:08 -0500 Original-Received: from raven.dms.auburn.edu (raven.dms.auburn.edu [131.204.53.29]) by manatee.dms.auburn.edu (8.13.3+Sun/8.13.3) with ESMTP id jAQIX0Jv013370; Sat, 26 Nov 2005 12:33:00 -0600 (CST) Original-Received: (from teirllm@localhost) by raven.dms.auburn.edu (8.11.7p1+Sun/8.11.7) id jAQIW6m01544; Sat, 26 Nov 2005 12:32:06 -0600 (CST) X-Authentication-Warning: raven.dms.auburn.edu: teirllm set sender to teirllm@dms.auburn.edu using -f Original-To: rudalics@gmx.at In-reply-to: <438825EE.8010202@gmx.at> (message from martin rudalics on Sat, 26 Nov 2005 10:07:58 +0100) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0.1 (manatee.dms.auburn.edu [131.204.53.104]); Sat, 26 Nov 2005 12:33:00 -0600 (CST) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:46624 Archived-At: Martin Rudalics wrote: (1) Invoke Emacs with -q Do M-x customize-option RET blink-matching-paren-on-screen RET blink-matching-paren-on-screen is "on (non-nil)" its State is STANDARD. Hit Finish. Do M-x customize-option RET show-paren-mode RET, hit Toggle and Set for Current Session. Do M-x customize-option RET blink-matching-paren-on-screen RET blink-matching-paren-on-screen is now "off (nil)" its State has been CHANGED outside Customize; operating on it here may be unreliable. But I have not done anything outside customize. No, but paren.el did. Richard decided that it is in certain situations OK for Lisp code to change user options, thereby overriding the user's customizations. That will result in a "Changed outside Customize" state. I believe that in this particular case (and in many similar cases as well), there is a less confusing way to handle this. See the patch below. The second part of your message points out what seems to be an undeniable bug: enabling show-paren-mode might legitimately change the value of some other option, but certainly enabling and then disabling show-paren-mode should be a no-op and definitely should not change the value of any user options. The patches below correct the bug and also more clearly document the effect of show-paren-mode on blink-matching-paren-on-screen. After the patches, enabling show-paren-mode no longer changes the value of blink-matching-paren-on-screen, but it results in that value being ignored and this is pointed out in the blink-matching-paren-on-screen's docstring. Disabling show-paren-mode makes blink-matching-paren-on-screen relevant again. I believe that this is a much more solid and less confusing way to handle the situation. The patches also eliminate some additional potential problems with buffer local values. I can install my patches if desired. ===File ~/simple-diff======================================= *** simple.el 23 Nov 2005 14:20:12 -0600 1.770 --- simple.el 26 Nov 2005 11:06:06 -0600 *************** *** 4259,4265 **** (defcustom blink-matching-paren-on-screen t "*Non-nil means show matching open-paren when it is on screen. If nil, means don't show it (but the open-paren can still be shown ! when it is off screen)." :type 'boolean :group 'paren-blinking) --- 4259,4267 ---- (defcustom blink-matching-paren-on-screen t "*Non-nil means show matching open-paren when it is on screen. If nil, means don't show it (but the open-paren can still be shown ! when it is off screen). ! ! This variable is ignored if `show-paren-mode' is enabled." :type 'boolean :group 'paren-blinking) *************** *** 4328,4337 **** ((pos-visible-in-window-p blinkpos) ;; Matching open within window, temporarily move to blinkpos but only ;; if `blink-matching-paren-on-screen' is non-nil. ! (when blink-matching-paren-on-screen ! (save-excursion ! (goto-char blinkpos) ! (sit-for blink-matching-delay)))) (t (save-excursion (goto-char blinkpos) --- 4330,4340 ---- ((pos-visible-in-window-p blinkpos) ;; Matching open within window, temporarily move to blinkpos but only ;; if `blink-matching-paren-on-screen' is non-nil. ! (and blink-matching-paren-on-screen ! (not show-paren-mode) ! (save-excursion ! (goto-char blinkpos) ! (sit-for blink-matching-delay)))) (t (save-excursion (goto-char blinkpos) ============================================================ ===File ~/paren-diff======================================== *** paren.el 20 Nov 2005 14:18:52 -0600 1.65 --- paren.el 26 Nov 2005 11:15:31 -0600 *************** *** 110,123 **** When Show Paren mode is enabled, any matching parenthesis is highlighted in `show-paren-style' after `show-paren-delay' seconds of Emacs idle time." :global t :group 'paren-showing ! ;; Turn off the usual paren-matching method ! ;; when this one is turned on. ! (if (local-variable-p 'show-paren-mode) ! (make-local-variable 'blink-matching-paren-on-screen) ! (kill-local-variable 'blink-matching-paren-on-screen)) ! (setq blink-matching-paren-on-screen (not show-paren-mode)) ! ! ;; Now enable or disable the mechanism. ;; First get rid of the old idle timer. (if show-paren-idle-timer (cancel-timer show-paren-idle-timer)) --- 110,116 ---- When Show Paren mode is enabled, any matching parenthesis is highlighted in `show-paren-style' after `show-paren-delay' seconds of Emacs idle time." :global t :group 'paren-showing ! ;; Enable or disable the mechanism. ;; First get rid of the old idle timer. (if show-paren-idle-timer (cancel-timer show-paren-idle-timer)) ============================================================