all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* show-paren-mode vs blink-matching-paren-on-screen
@ 2005-11-26  9:07 martin rudalics
  2005-11-26 18:32 ` Luc Teirlinck
  0 siblings, 1 reply; 4+ messages in thread
From: martin rudalics @ 2005-11-26  9:07 UTC (permalink / raw)


(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.


(2) 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 Toggle and Set for Current Session.
blink-matching-paren-on-screen is now "off (nil)" its State is SET for
current session only.
Hit Finish.

Do M-x customize-option RET show-paren-mode RET, hit Toggle and Set for
Current Session.
show-paren-mode is now "on (non-nil)" its State is SET for current
session only.

Do M-x customize-option RET show-paren-mode RET, hit Toggle and Set for
Current Session.
show-paren-mode is now "off (nil)" its State is SET for current
session only.

Switch to buffer *scratch* and type the text

(foo)

After typing the closing paren the cursor will move to the open paren
although that feature should have been turned off.  When I now do

M-x customize-option RET blink-matching-paren-on-screen RET

I'm told that

blink-matching-paren-on-screen is "on (non-nil)" its State has been
CHANGED outside Customize; operating on it here may be unreliable.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: show-paren-mode vs blink-matching-paren-on-screen
  2005-11-26  9:07 show-paren-mode vs blink-matching-paren-on-screen martin rudalics
@ 2005-11-26 18:32 ` Luc Teirlinck
  2005-11-27  3:28   ` Richard M. Stallman
  2005-11-28  9:27   ` martin rudalics
  0 siblings, 2 replies; 4+ messages in thread
From: Luc Teirlinck @ 2005-11-26 18:32 UTC (permalink / raw)
  Cc: emacs-devel

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))
============================================================

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: show-paren-mode vs blink-matching-paren-on-screen
  2005-11-26 18:32 ` Luc Teirlinck
@ 2005-11-27  3:28   ` Richard M. Stallman
  2005-11-28  9:27   ` martin rudalics
  1 sibling, 0 replies; 4+ messages in thread
From: Richard M. Stallman @ 2005-11-27  3:28 UTC (permalink / raw)
  Cc: rudalics, emacs-devel

This change is ok -- please install it -- but we can't
aim to eliminate all minor modes that change customizable 
variables.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: show-paren-mode vs blink-matching-paren-on-screen
  2005-11-26 18:32 ` Luc Teirlinck
  2005-11-27  3:28   ` Richard M. Stallman
@ 2005-11-28  9:27   ` martin rudalics
  1 sibling, 0 replies; 4+ messages in thread
From: martin rudalics @ 2005-11-28  9:27 UTC (permalink / raw)
  Cc: emacs-devel

 > 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.

In some situations that's very confusing indeed.  With emacs -q and

M-x customize-option RET minibuffer-prompt-properties RET

I see

"State: CHANGED outside Customize; operating on it here may be unreliable."


 > I can install my patches if desired.

Thanks for solving this.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-11-28  9:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-26  9:07 show-paren-mode vs blink-matching-paren-on-screen martin rudalics
2005-11-26 18:32 ` Luc Teirlinck
2005-11-27  3:28   ` Richard M. Stallman
2005-11-28  9:27   ` martin rudalics

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.