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

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

Re: Set-window-point in append-to-buffer


From: Michael Heerdegen
Subject: Re: Set-window-point in append-to-buffer
Date: Tue, 21 Apr 2015 13:19:21 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

Steve Schooler <address@hidden> 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.




reply via email to

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