unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Markus Triska <triska@gmx.at>
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	[thread overview]
Message-ID: <877ix0pwjt.fsf@gmx.at> (raw)
In-Reply-To: mailman.1701.1165697627.2155.help-gnu-emacs@gnu.org

Dieter Wilhelm <dieter@duenenhof-wilhelm.de> 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	other threads:[~2006-12-09 21:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1701.1165697627.2155.help-gnu-emacs@gnu.org>
2006-12-09 21:51 ` Markus Triska [this message]
2006-12-10 15:57   ` goto-char with set-buffer operations take only effect when buffer is not visible! Dieter Wilhelm
2006-12-10 14:01 ` Johan Bockgård
2006-12-10 15:52   ` Dieter Wilhelm
2006-12-09 19:32 Dieter Wilhelm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877ix0pwjt.fsf@gmx.at \
    --to=triska@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).