unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: show-paren-mode prevents page-down from displaying next 1/2 page.
       [not found] <1F26F4742242BA449B1716A3A1E93EC60BEAA99A@BFTMLVEM02.e2k.ad.ge.com>
@ 2007-04-18  2:03 ` Richard Stallman
  0 siblings, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2007-04-18  2:03 UTC (permalink / raw)
  To: Maguire, Andrew (GE Infra, Energy); +Cc: andrew.maguire, emacs-devel

    To setup this rather strange bug, you need to:
       1. ensure show-paren-mode is enabled
       2. create a buffer and in that buffer, half way down the window,
	  create a line that has some [] brackets such that the ] bracket
	  is the last displayed character on the right of the screen.

	  I also had characters after the ] so that the right hand "fringe"
	  displayed its wrap-around icon.

	  It is important that the [] line is displayed half way down the window, e.g on the 5th line on a window height of 10 (9 lines displayed due to wrap around).

       3. place point anywhere on the line with [] brackets and press the page-down key.

    Instead of paging down, the display will flash and place point immediately after the ] bracket.

Can you send us a _precise_ test case for this bug?
Please read the Bugs section in the Emacs manual, which provides
guidelines on how to write a bug report to give us the
necessary information so we can fix the bug.

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

* RE: show-paren-mode prevents page-down from displaying next 1/2 page.
@ 2007-04-18 13:32 Maguire, Andrew (GE Infra, Energy)
  2007-04-18 22:26 ` Chong Yidong
  2007-04-19  2:38 ` Richard Stallman
  0 siblings, 2 replies; 11+ messages in thread
From: Maguire, Andrew (GE Infra, Energy) @ 2007-04-18 13:32 UTC (permalink / raw)
  To: rms; +Cc: emacs-devel

Here goes: 

(require 'cl-macs)
(defun test:scroll-up:show-paren-mode ()
  "Test for scroll-up and show-paren-mode interaction."
  (let* ((buffer (get-buffer-create "*TEST*"))
	 (pop-up-frames t)
	 (truncate-lines nil)
	width pt coords-before coords-after)

    (switch-to-buffer-other-frame buffer t)
    (erase-buffer)
    (setq width (window-width))

    ;; Add long line text with [] such that ] is last visible character
    ;; ???What about display non-display of fringe???
    (insert "\n")
    (setq pt (point))
    (insert "[")
    (insert (make-string (- width 2) ?. ))
    (insert "] some trailing text\n")
    (insert "\n\n")
    (insert "In this test:\n")
    (insert "1. you shall see scroll-up work with show-paren-mode disabled\n\n")
    (insert "2. you will be asked to press Return to go back to the\n")
    (insert "   original situation.\n\n")
    (insert "3. show-paren-mode will be enabled and scroll up will be repeated\n")

    (read-string "Press Return to Begin: ")

    ;; First scroll-up without show-paren-mode
    (goto-char pt)
    (show-paren-mode 0)
    (scroll-up 2)
    (setq coords-before (pos-visible-in-window-p nil nil t))

    (read-string "[]s should not be visible. Press Return to Continue: ")
    (scroll-down 2)

    (read-string "Press Return to enable show-paren-mode and scroll-up again: ")
    (show-paren-mode 1)
    (scroll-up 2)
    (redisplay t)

    ;;(setq coords-after (pos-visible-in-window-p nil nil t))
    (save-excursion
      (goto-char (point-max))
      (insert "(pos-visible-in-window-p nil nil t) illustrates the difference:\n")
      (insert (format "Without show-paren-mode: %s\n" coords-before))
      (insert "Find out the new value by pressing \[eval-expression]\n")
      (insert "and running the lisp command (pos-visible-in-window-p nil nil t)\n\n")
      (insert "NOTE: I cannot get pos-visible-in-window-p to return\n")
      (insert "this value programmatically, since the redisplay screen update\n")
      (insert "is occuring after this function exits.\n")
      (insert "(sit-for) and (redisplay) cannot force it either.\n")
      )

;;    (if (and
;;	 (eq (first coords-before) (first coords-after))
;;	 (eq (first coords-after) (first coords-after)))
;;	t
;;      (error "Failed TEST"))
    ))

;; Run the test!
(test:scroll-up:show-paren-mode)



Thanks,
Andrew

"If it runs, script it!"


> -----Original Message-----
> From: Richard Stallman [mailto:rms@gnu.org]
> Sent: 18 April 2007 03:03
> To: Maguire, Andrew (GE Infra, Energy)
> Cc: emacs-devel@gnu.org; Maguire, Andrew (GE Infra, Energy)
> Subject: Re: show-paren-mode prevents page-down from 
> displaying next 1/2
> page.
> 
> 
>     To setup this rather strange bug, you need to:
>        1. ensure show-paren-mode is enabled
>        2. create a buffer and in that buffer, half way down 
> the window,
> 	  create a line that has some [] brackets such that the 
> ] bracket
> 	  is the last displayed character on the right of the screen.
> 
> 	  I also had characters after the ] so that the right 
> hand "fringe"
> 	  displayed its wrap-around icon.
> 
> 	  It is important that the [] line is displayed half 
> way down the window, e.g on the 5th line on a window height 
> of 10 (9 lines displayed due to wrap around).
> 
>        3. place point anywhere on the line with [] brackets 
> and press the page-down key.
> 
>     Instead of paging down, the display will flash and place 
> point immediately after the ] bracket.
> 
> Can you send us a _precise_ test case for this bug?
> Please read the Bugs section in the Emacs manual, which provides
> guidelines on how to write a bug report to give us the
> necessary information so we can fix the bug.
> 

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

* Re: show-paren-mode prevents page-down from displaying next 1/2 page.
  2007-04-18 13:32 show-paren-mode prevents page-down from displaying next 1/2 page Maguire, Andrew (GE Infra, Energy)
@ 2007-04-18 22:26 ` Chong Yidong
  2007-04-19  6:50   ` Glenn Morris
  2007-04-19  2:38 ` Richard Stallman
  1 sibling, 1 reply; 11+ messages in thread
From: Chong Yidong @ 2007-04-18 22:26 UTC (permalink / raw)
  To: Maguire, Andrew (GE Infra, Energy); +Cc: rms, emacs-devel

"Maguire, Andrew (GE Infra, Energy)" <andrew.maguire@ge.com> writes:

> Here goes: 
>
> (require 'cl-macs)
> (defun test:scroll-up:show-paren-mode ()
> ...

This glitch occurs because show-paren-mode tries to highlight before
window-start, which forces the redisplay engine to recenter.  It's no
big deal, but I believe this patch fixes it.  Could someone help me
double-check?

*** emacs/lisp/paren.el.~1.71.~	2007-01-21 13:34:19.000000000 -0500
--- emacs/lisp/paren.el	2007-04-18 18:25:16.000000000 -0400
***************
*** 146,152 ****
  	    pos mismatch face)
  	;;
  	;; Find the other end of the sexp.
! 	(when dir
  	  (save-excursion
  	    (save-restriction
  	      ;; Determine the range within which to look for a match.
--- 146,154 ----
  	    pos mismatch face)
  	;;
  	;; Find the other end of the sexp.
! 	(when (or (= dir 1)
! 		  (and (= dir -1)
! 		       (>= (1- (point)) (window-start))))
  	  (save-excursion
  	    (save-restriction
  	      ;; Determine the range within which to look for a match.

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

* Re: show-paren-mode prevents page-down from displaying next 1/2 page.
  2007-04-18 13:32 show-paren-mode prevents page-down from displaying next 1/2 page Maguire, Andrew (GE Infra, Energy)
  2007-04-18 22:26 ` Chong Yidong
@ 2007-04-19  2:38 ` Richard Stallman
  1 sibling, 0 replies; 11+ messages in thread
From: Richard Stallman @ 2007-04-19  2:38 UTC (permalink / raw)
  To: Maguire, Andrew (GE Infra, Energy); +Cc: emacs-devel

Thanks for the clear test case.

Would someone please DTRT then ack?

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

* Re: show-paren-mode prevents page-down from displaying next 1/2 page.
  2007-04-18 22:26 ` Chong Yidong
@ 2007-04-19  6:50   ` Glenn Morris
  0 siblings, 0 replies; 11+ messages in thread
From: Glenn Morris @ 2007-04-19  6:50 UTC (permalink / raw)
  To: Chong Yidong; +Cc: andrew.maguire, rms, emacs-devel

Chong Yidong wrote:

> This glitch occurs because show-paren-mode tries to highlight before
> window-start, which forces the redisplay engine to recenter. It's no
> big deal, but I believe this patch fixes it. Could someone help me
> double-check?

Looks ok to me.

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

* RE: show-paren-mode prevents page-down from displaying next 1/2 page.
@ 2007-04-19 10:54 Maguire, Andrew (GE Infra, Energy)
  0 siblings, 0 replies; 11+ messages in thread
From: Maguire, Andrew (GE Infra, Energy) @ 2007-04-19 10:54 UTC (permalink / raw)
  To: Glenn Morris, Chong Yidong; +Cc: rms, emacs-devel

Yes, that patch fixes the behaviour. 

Thanks for the fast response!

Andrew


> -----Original Message-----
> From: Glenn Morris [mailto:rgm@gnu.org]
> Sent: 19 April 2007 07:50
> To: Chong Yidong
> Cc: Maguire, Andrew (GE Infra, Energy); rms@gnu.org; 
> emacs-devel@gnu.org
> Subject: Re: show-paren-mode prevents page-down from 
> displaying next 1/2
> page.
> 
> 
> Chong Yidong wrote:
> 
> > This glitch occurs because show-paren-mode tries to highlight before
> > window-start, which forces the redisplay engine to recenter. It's no
> > big deal, but I believe this patch fixes it. Could someone help me
> > double-check?
> 
> Looks ok to me.
> 
> 

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

* RE: show-paren-mode prevents page-down from displaying next 1/2 page.
@ 2007-04-19 11:46 Maguire, Andrew (GE Infra, Energy)
  2007-04-19 17:24 ` Chong Yidong
  0 siblings, 1 reply; 11+ messages in thread
From: Maguire, Andrew (GE Infra, Energy) @ 2007-04-19 11:46 UTC (permalink / raw)
  To: Glenn Morris, Chong Yidong; +Cc: rms, emacs-devel

Hmm, I thought I would play a bit more and there is still something
strange going on, I have not been able to write some repeatable code yet though.

My reason for looking further was that the fix includes a check for window-start
when dir is -1 but no check for when dir is 1. So I thought I would try and
provoke a mirror case with scroll-down ie. when dir is 1 and no window-start
test is used. So far I cannot find anything wrong, despite that suspicion!

However, the situation I have now uncovered seems to be related to
an overlay being left behind after scroll event and then the next scroll
event finds this overlay, removes it but this causes an extra window redisplay
and thus a recenter when one was not expected. Point is moved to the correct place. Therefore, my suspicion is that it is related to the new when test
preventing the deletion of a previous overlay when one is needed but it is
outside the new window's bounds. I suspect that the when clause needs to always set
the pos variable if dir is set but only set the mismatch variable using the test with
window-start.

I hope that makes sense and you see what I mean.

I will try and write some test code but it may have to be next week.

Thanks,
Andrew

"If it runs, script it!"


> -----Original Message-----
> From: Maguire, Andrew (GE Infra, Energy) 
> Sent: 19 April 2007 11:55
> To: 'Glenn Morris'; Chong Yidong
> Cc: rms@gnu.org; emacs-devel@gnu.org
> Subject: RE: show-paren-mode prevents page-down from 
> displaying next 1/2
> page.
> 
> 
> Yes, that patch fixes the behaviour. 
> 
> Thanks for the fast response!
> 
> Andrew
> 
> 
> > -----Original Message-----
> > From: Glenn Morris [mailto:rgm@gnu.org]
> > Sent: 19 April 2007 07:50
> > To: Chong Yidong
> > Cc: Maguire, Andrew (GE Infra, Energy); rms@gnu.org; 
> > emacs-devel@gnu.org
> > Subject: Re: show-paren-mode prevents page-down from 
> > displaying next 1/2
> > page.
> > 
> > 
> > Chong Yidong wrote:
> > 
> > > This glitch occurs because show-paren-mode tries to 
> highlight before
> > > window-start, which forces the redisplay engine to 
> recenter. It's no
> > > big deal, but I believe this patch fixes it. Could someone help me
> > > double-check?
> > 
> > Looks ok to me.
> > 
> > 
> 

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

* Re: show-paren-mode prevents page-down from displaying next 1/2 page.
  2007-04-19 11:46 Maguire, Andrew (GE Infra, Energy)
@ 2007-04-19 17:24 ` Chong Yidong
  2007-04-20  2:01   ` Katsumi Yamaoka
  0 siblings, 1 reply; 11+ messages in thread
From: Chong Yidong @ 2007-04-19 17:24 UTC (permalink / raw)
  To: Maguire, Andrew (GE Infra, Energy); +Cc: Glenn Morris, rms, emacs-devel

"Maguire, Andrew (GE Infra, Energy)" <andrew.maguire@ge.com> writes:

> However, the situation I have now uncovered seems to be related to
> an overlay being left behind after scroll event and then the next
> scroll event finds this overlay, removes it but this causes an extra
> window redisplay and thus a recenter when one was not
> expected. Point is moved to the correct place. Therefore, my
> suspicion is that it is related to the new when test preventing the
> deletion of a previous overlay when one is needed but it is outside
> the new window's bounds. I suspect that the when clause needs to
> always set the pos variable if dir is set but only set the mismatch
> variable using the test with window-start.

I checked in a different fix.  This should clear up the recentering
problems when using show-paren-mode.

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

* Re: show-paren-mode prevents page-down from displaying next 1/2 page.
  2007-04-19 17:24 ` Chong Yidong
@ 2007-04-20  2:01   ` Katsumi Yamaoka
  2007-04-20 13:53     ` Chong Yidong
  0 siblings, 1 reply; 11+ messages in thread
From: Katsumi Yamaoka @ 2007-04-20  2:01 UTC (permalink / raw)
  To: Chong Yidong
  Cc: Glenn Morris, Maguire, Andrew (GE Infra, Energy), rms,
	emacs-devel

>>>>> In <874pncuvjm.fsf@stupidchicken.com> Chong Yidong wrote:

> I checked in a different fix.  This should clear up the recentering
> problems when using show-paren-mode.

This change makes editing of big Lisp forms in the minibuffer
impossible.  Try setting the frame height to 40 and evaluating
the following form in the minibuffer using the `M-:' command.

(concat "a"
	"b"
	"c"
	"d"
	"e"
	"f"
	"g"
	"h"
	"i"
	"j"
	"k"
	"l")

You will see you cannot edit the beginning of the form.  I hope
this feature is turned off (at least) in the minibuffer.

Regards,

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

* Re: show-paren-mode prevents page-down from displaying next 1/2 page.
  2007-04-20  2:01   ` Katsumi Yamaoka
@ 2007-04-20 13:53     ` Chong Yidong
  2007-04-20 16:13       ` Katsumi Yamaoka
  0 siblings, 1 reply; 11+ messages in thread
From: Chong Yidong @ 2007-04-20 13:53 UTC (permalink / raw)
  To: Katsumi Yamaoka
  Cc: Glenn Morris, Maguire, Andrew (GE Infra, Energy), rms,
	emacs-devel

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> This change makes editing of big Lisp forms in the minibuffer
> impossible.

I checked in a fix for the fix.  Could you help me test it out as
rigorously as you can, and report any failures?

Thanks.

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

* Re: show-paren-mode prevents page-down from displaying next 1/2 page.
  2007-04-20 13:53     ` Chong Yidong
@ 2007-04-20 16:13       ` Katsumi Yamaoka
  0 siblings, 0 replies; 11+ messages in thread
From: Katsumi Yamaoka @ 2007-04-20 16:13 UTC (permalink / raw)
  To: Chong Yidong
  Cc: Glenn Morris, Maguire, Andrew (GE Infra, Energy), rms,
	emacs-devel

>>>>> In <873b2vnodz.fsf@stupidchicken.com>
>>>>>	Chong Yidong <cyd@stupidchicken.com> wrote:

> Katsumi Yamaoka <yamaoka@jpl.org> writes:

>> This change makes editing of big Lisp forms in the minibuffer
>> impossible.

> I checked in a fix for the fix.  Could you help me test it out as
> rigorously as you can, and report any failures?

> Thanks.

Thank you for the fix.  I confirmed `(window-minibuffer-p)'
surely does the trick.

Best Regards,

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

end of thread, other threads:[~2007-04-20 16:13 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-18 13:32 show-paren-mode prevents page-down from displaying next 1/2 page Maguire, Andrew (GE Infra, Energy)
2007-04-18 22:26 ` Chong Yidong
2007-04-19  6:50   ` Glenn Morris
2007-04-19  2:38 ` Richard Stallman
  -- strict thread matches above, loose matches on Subject: below --
2007-04-19 11:46 Maguire, Andrew (GE Infra, Energy)
2007-04-19 17:24 ` Chong Yidong
2007-04-20  2:01   ` Katsumi Yamaoka
2007-04-20 13:53     ` Chong Yidong
2007-04-20 16:13       ` Katsumi Yamaoka
2007-04-19 10:54 Maguire, Andrew (GE Infra, Energy)
     [not found] <1F26F4742242BA449B1716A3A1E93EC60BEAA99A@BFTMLVEM02.e2k.ad.ge.com>
2007-04-18  2:03 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).