unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12855: 24.2; The Messages buffer stops following the appended lines.
@ 2012-11-10 19:18 Yves Baumes
  2012-11-12  9:56 ` martin rudalics
  0 siblings, 1 reply; 6+ messages in thread
From: Yves Baumes @ 2012-11-10 19:18 UTC (permalink / raw)
  To: 12855

Let's split the frame in two windows only, one for the *scratch* and the
other for *Messages*. From here you have a few lines only in the
*Messages* buffer. And untill now, every new lines introduced because of
a command output is followed. Moreover, I can see the "ghost" cursor at
the end of the buffer and it follows every *Messages* buffer updates.

Then, from the *scratch* buffer, I call the describe-variable key
sequence ( C-h v xxx ). The current buffer being *scratch*, the
*Messages* buffer will be replaced with the *help* buffer.

After finishing to read the description I want to quit it, because I
want the *Messages* buffer to come back. For that, I do: C-x o, thus
switching to the focus to the *Help* buffer, and I just type in 'q' to
quit it and instantly focus back to the *scratch* buffer.

But: When I look into the *Messages* buffer, the "ghost" cursor is no
longer at the same place. It has moved in the middle of the buffer. From
there, the window position relative to the buffer remains the same.
Which is not good because I want to see the *Messages* updates when they
come in.

Regards
Yves.






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

* bug#12855: 24.2; The Messages buffer stops following the appended lines.
  2012-11-10 19:18 bug#12855: 24.2; The Messages buffer stops following the appended lines Yves Baumes
@ 2012-11-12  9:56 ` martin rudalics
  2012-11-12 14:37   ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2012-11-12  9:56 UTC (permalink / raw)
  To: Yves Baumes; +Cc: 12855

[-- Attachment #1: Type: text/plain, Size: 1920 bytes --]

 > Let's split the frame in two windows only, one for the *scratch* and the
 > other for *Messages*. From here you have a few lines only in the
 > *Messages* buffer. And untill now, every new lines introduced because of
 > a command output is followed. Moreover, I can see the "ghost" cursor at
 > the end of the buffer and it follows every *Messages* buffer updates.
 >
 > Then, from the *scratch* buffer, I call the describe-variable key
 > sequence ( C-h v xxx ). The current buffer being *scratch*, the
 > *Messages* buffer will be replaced with the *help* buffer.
 >
 > After finishing to read the description I want to quit it, because I
 > want the *Messages* buffer to come back. For that, I do: C-x o, thus
 > switching to the focus to the *Help* buffer, and I just type in 'q' to
 > quit it and instantly focus back to the *scratch* buffer.
 >
 > But: When I look into the *Messages* buffer, the "ghost" cursor is no
 > longer at the same place. It has moved in the middle of the buffer. From
 > there, the window position relative to the buffer remains the same.
 > Which is not good because I want to see the *Messages* updates when they
 > come in.

This is due to a bug in `display-buffer-record-window' which doesn't pay
attention to the buffer's `window-point-insertion-type' when storing the
window-point marker.  A similar bug occurs in `record-window-buffer', so
functions like `switch-to-prev-buffer' and `switch-to-next-buffer' are
affected by the same problem whenever they switch to a buffer whose
`window-point-insertion-type' is non-nil.

Since this bug constitutes a considerable annoyance and a regression wrt
23.4 I'd like to install the attached patch on the Emacs 24 branch.  It
principally only adds the necessary TYPE argument to the `copy-marker'
calls but looks more complex because I have to do this in the right
buffer and therefore rearranged the code a bit.  OK to install?

martin

[-- Attachment #2: window-point-insertion-type.diff --]
[-- Type: text/plain, Size: 2308 bytes --]

=== modified file 'lisp/window.el'
--- lisp/window.el	2012-11-11 01:47:56 +0000
+++ lisp/window.el	2012-11-12 07:35:12 +0000
@@ -3039,20 +3039,20 @@
     (unless (eq (aref (buffer-name buffer) 0) ?\s)
       ;; Add an entry for buffer to WINDOW's previous buffers.
       (with-current-buffer buffer
-	(let ((start (window-start window))
-	      (point (window-point window)))
-	  (setq entry
-		(cons buffer
-		      (if entry
-			  ;; We have an entry, update marker positions.
-			  (list (set-marker (nth 1 entry) start)
-				(set-marker (nth 2 entry) point))
-			;; Make new markers.
-			(list (copy-marker start)
-			      (copy-marker point)))))
-
+	(let* ((start
+		(if entry
+		    (set-marker (nth 1 entry) (window-start window))
+		  (copy-marker (window-start window))))
+	       (point
+		(if entry
+		    (set-marker (nth 2 entry) (window-point window))
+		  (copy-marker
+		   ;; Preserve window-point-insertion-type (Bug#12855).
+		   (window-point) window-point-insertion-type))))
 	  (set-window-prev-buffers
-	   window (cons entry (window-prev-buffers window))))))))
+	   window
+	   (cons (list buffer start point)
+		 (window-prev-buffers window))))))))
 
 (defun unrecord-window-buffer (&optional window buffer)
   "Unrecord BUFFER in WINDOW.
@@ -4555,13 +4555,17 @@
 	  ;; If WINDOW has a quit-restore parameter, reset its car.
 	  (setcar (window-parameter window 'quit-restore) 'same))
       ;; WINDOW shows another buffer.
-      (set-window-parameter
-       window 'quit-restore
-       (list 'other
-	     ;; A quadruple of WINDOW's buffer, start, point and height.
-	     (list (window-buffer window) (window-start window)
-		   (window-point window) (window-total-size window))
-	     (selected-window) buffer))))
+      (with-current-buffer (window-buffer window)
+	(set-window-parameter
+	 window 'quit-restore
+	 (list 'other
+	       ;; A quadruple of WINDOW's buffer, start, point and height.
+	       (list (current-buffer) (window-start window)
+		     ;; Preserve window-point-insertion-type (Bug#12588).
+		     (copy-marker
+		      (window-point window) window-point-insertion-type)
+		     (window-total-size window))
+	       (selected-window) buffer)))))
    ((eq type 'window)
     ;; WINDOW has been created on an existing frame.
     (set-window-parameter



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

* bug#12855: 24.2; The Messages buffer stops following the appended lines.
  2012-11-12  9:56 ` martin rudalics
@ 2012-11-12 14:37   ` Stefan Monnier
  2012-11-12 17:32     ` martin rudalics
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2012-11-12 14:37 UTC (permalink / raw)
  To: martin rudalics; +Cc: Yves Baumes, 12855

> Since this bug constitutes a considerable annoyance and a regression wrt
> 23.4 I'd like to install the attached patch on the Emacs 24 branch.  It
> principally only adds the necessary TYPE argument to the `copy-marker'
> calls but looks more complex because I have to do this in the right
> buffer and therefore rearranged the code a bit.  OK to install?

Yes.

> -	(let ((start (window-start window))
> -	      (point (window-point window)))
> -	  (setq entry
> -		(cons buffer
> -		      (if entry
> -			  ;; We have an entry, update marker positions.
> -			  (list (set-marker (nth 1 entry) start)
> -				(set-marker (nth 2 entry) point))
> -			;; Make new markers.
> -			(list (copy-marker start)
> -			      (copy-marker point)))))
> -
> +	(let* ((start
> +		(if entry
> +		    (set-marker (nth 1 entry) (window-start window))
> +		  (copy-marker (window-start window))))
> +	       (point
> +		(if entry
> +		    (set-marker (nth 2 entry) (window-point window))
> +		  (copy-marker
> +		   ;; Preserve window-point-insertion-type (Bug#12855).
> +		   (window-point) window-point-insertion-type))))
>  	  (set-window-prev-buffers
> -	   window (cons entry (window-prev-buffers window))))))))
> +	   window
> +	   (cons (list buffer start point)
> +		 (window-prev-buffers window))))))))

I don't understand why you massaged the code this way instead of just
adding window-point-insertion-type to the last copy-marker call, but
I presume there's a good reason.


        Stefan





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

* bug#12855: 24.2; The Messages buffer stops following the appended lines.
  2012-11-12 14:37   ` Stefan Monnier
@ 2012-11-12 17:32     ` martin rudalics
  2012-11-12 20:57       ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2012-11-12 17:32 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Yves Baumes, 12855

 >> -	(let ((start (window-start window))
 >> -	      (point (window-point window)))
 >> -	  (setq entry
 >> -		(cons buffer
 >> -		      (if entry
 >> -			  ;; We have an entry, update marker positions.
 >> -			  (list (set-marker (nth 1 entry) start)
 >> -				(set-marker (nth 2 entry) point))
 >> -			;; Make new markers.
 >> -			(list (copy-marker start)
 >> -			      (copy-marker point)))))
 >> -
 >> +	(let* ((start
 >> +		(if entry
 >> +		    (set-marker (nth 1 entry) (window-start window))
 >> +		  (copy-marker (window-start window))))
 >> +	       (point
 >> +		(if entry
 >> +		    (set-marker (nth 2 entry) (window-point window))
 >> +		  (copy-marker
 >> +		   ;; Preserve window-point-insertion-type (Bug#12855).
 >> +		   (window-point) window-point-insertion-type))))
 >>  	  (set-window-prev-buffers
 >> -	   window (cons entry (window-prev-buffers window))))))))
 >> +	   window
 >> +	   (cons (list buffer start point)
 >> +		 (window-prev-buffers window))))))))
 >
 > I don't understand why you massaged the code this way instead of just
 > adding window-point-insertion-type to the last copy-marker call, but
 > I presume there's a good reason.

Probably not.  Do you think the old version was more readable?

martin





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

* bug#12855: 24.2; The Messages buffer stops following the appended lines.
  2012-11-12 17:32     ` martin rudalics
@ 2012-11-12 20:57       ` Stefan Monnier
  2012-11-13  8:22         ` martin rudalics
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2012-11-12 20:57 UTC (permalink / raw)
  To: martin rudalics; +Cc: Yves Baumes, 12855

> Probably not.  Do you think the old version was more readable?

The difference is fairly small (not worth changing one for the other),
but if I had to choose I think I'd prefer the current code.


        Stefan





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

* bug#12855: 24.2; The Messages buffer stops following the appended lines.
  2012-11-12 20:57       ` Stefan Monnier
@ 2012-11-13  8:22         ` martin rudalics
  0 siblings, 0 replies; 6+ messages in thread
From: martin rudalics @ 2012-11-13  8:22 UTC (permalink / raw)
  To: 12855-done; +Cc: Yves Baumes

> The difference is fairly small (not worth changing one for the other),
> but if I had to choose I think I'd prefer the current code.

Done in revision 110859 on the Emacs-24 branch.  Bug closed.

Thanks, martin








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

end of thread, other threads:[~2012-11-13  8:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-10 19:18 bug#12855: 24.2; The Messages buffer stops following the appended lines Yves Baumes
2012-11-12  9:56 ` martin rudalics
2012-11-12 14:37   ` Stefan Monnier
2012-11-12 17:32     ` martin rudalics
2012-11-12 20:57       ` Stefan Monnier
2012-11-13  8:22         ` martin rudalics

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