all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.