help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: goto-char with set-buffer operations take only effect when buffer is


From: Markus Triska
Subject: Re: goto-char with set-buffer operations take only effect when buffer is not visible!
Date: Sat, 09 Dec 2006 22:51:50 +0100

Dieter Wilhelm <address@hidden> writes:

>
>   (let ((cb (buffer-name)))
>     (set-buffer "*Ansys*")           ;make buffer scroll with output
>     (goto-char (point-max))
>     (set-buffer cb))

Using with-current-buffer, this becomes:

(with-current-buffer "*Ansys*" (goto-char (point-max)))

> To my astonishment this works only when the buffer *Ansys* is not
> visible!  When the buffer is visible and I call this snippet in
> another one the cursor in *Ansys* won't budge a single character.

Add:

(walk-windows (lambda (w)
                (when (string= (buffer-name (window-buffer w)) "*Ansys*")
                  (with-selected-window w (goto-char (point-max))))))

to move the point permanently also if the buffer's window is visible
and not selected.


All the best,
Markus Triska


reply via email to

[Prev in Thread] Current Thread [Next in Thread]