unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Set-window-point in append-to-buffer
@ 2015-04-20 23:25 Steve Schooler
  2015-04-21 11:19 ` Michael Heerdegen
  0 siblings, 1 reply; 2+ messages in thread
From: Steve Schooler @ 2015-04-20 23:25 UTC (permalink / raw)
  To: help-gnu-emacs

The append-to-buffer function's definition ends with:

(dolist (window windows)
  (when (= (window-point window) point)
    (set-window-point window (point))))))))

What is the purpose of this?  Experimenting, I commented out this code and
re-ran, but could detect no difference in functionality?


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

* Re: Set-window-point in append-to-buffer
  2015-04-20 23:25 Set-window-point in append-to-buffer Steve Schooler
@ 2015-04-21 11:19 ` Michael Heerdegen
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Heerdegen @ 2015-04-21 11:19 UTC (permalink / raw)
  To: help-gnu-emacs

Steve Schooler <sgschooler@gmail.com> writes:

> The append-to-buffer function's definition ends with:
>
> (dolist (window windows)
>   (when (= (window-point window) point)
>     (set-window-point window (point))))))))
>
> What is the purpose of this?

AFAICT the purpose is to make what the doc of `append-to-buffer' says:

"Append to specified buffer the text of the region.
It is inserted into that buffer before its point."

valid for the window points of all windows displaying the target buffer.

>  Experimenting, I commented out this code and re-ran, but could detect
> no difference in functionality?

Try again with this snipped for example:

--8<---------------cut here---------------start------------->8---
(let ((buffer-to-modify (get-buffer-create "Test"))
      (buffer-with-text (get-buffer-create "Text")))
  (with-current-buffer buffer-to-modify (erase-buffer))
  (switch-to-buffer buffer-with-text)
  (erase-buffer)
  (insert "TextText")
  (display-buffer-pop-up-window buffer-to-modify '())
  (append-to-buffer buffer-to-modify (point-min) (point-max)))
--8<---------------cut here---------------end--------------->8---


Michael.




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

end of thread, other threads:[~2015-04-21 11:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-20 23:25 Set-window-point in append-to-buffer Steve Schooler
2015-04-21 11:19 ` Michael Heerdegen

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