unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Dieter Wilhelm <dieter@duenenhof-wilhelm.de>
Cc: hans-dieter.wilhelm@siemens.com, help-gnu-emacs@gnu.org
Subject: Re: goto-char with set-buffer operations take only effect when buffer is not visible!
Date: Sun, 10 Dec 2006 16:57:50 +0100	[thread overview]
Message-ID: <87lklfd9q9.fsf@hans.local.net> (raw)
In-Reply-To: <877ix0pwjt.fsf@gmx.at> (Markus Triska's message of "Sat\, 09 Dec 2006 22\:51\:50 +0100")

Markus Triska <triska@gmx.at> writes:

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

Ahhh, with-current-buffer it's far more elegant.

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

Great! Thank you for the template, I'll implement it in this way.

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany

  reply	other threads:[~2006-12-10 15:57 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 ` goto-char with set-buffer operations take only effect when buffer is not visible! Markus Triska
2006-12-10 15:57   ` Dieter Wilhelm [this message]
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=87lklfd9q9.fsf@hans.local.net \
    --to=dieter@duenenhof-wilhelm.de \
    --cc=hans-dieter.wilhelm@siemens.com \
    --cc=help-gnu-emacs@gnu.org \
    /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).