[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12855: 24.2; The Messages buffer stops following the appended lines.
From: |
martin rudalics |
Subject: |
bug#12855: 24.2; The Messages buffer stops following the appended lines. |
Date: |
Mon, 12 Nov 2012 10:56:42 +0100 |
> 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
=== 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