all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* point when modifying other buffers
@ 2010-01-06 14:53 Daniel Carvalho
  2010-01-06 15:06 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Carvalho @ 2010-01-06 14:53 UTC (permalink / raw
  To: emacs-devel

hi
I want a lisp program to make changes to other buffer without visually
switching to it.

(with-current-buffer my-other-buffer
  (insert "abc\n")
  )

this keeps a temporary cursor while the elisp program runs but doesn't
move the buffer "real" position.
How can I make it change the buffer position?

(insert-before-markers "abc\n") works in this case, but it is not a
generic solution

I could use something like
(set-window-point window position)
but only if there is a window displaying the buffer!


I would like to listen for clarifications on this subjet, and if there
are better solutions

thanks
lDanie




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

* Re: point when modifying other buffers
  2010-01-06 14:53 point when modifying other buffers Daniel Carvalho
@ 2010-01-06 15:06 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2010-01-06 15:06 UTC (permalink / raw
  To: Daniel Carvalho; +Cc: emacs-devel

> (with-current-buffer my-other-buffer
>   (insert "abc\n"))

> this keeps a temporary cursor while the elisp program runs but doesn't
> move the buffer "real" position.
> How can I make it change the buffer position?

There is no such thing as the buffer's "real" position.

> I could use something like
> (set-window-point window position)
> but only if there is a window displaying the buffer!

But what you think as "the real position" is indeed the window-point.
If there's no window showing this buffer, you'll see that point moves
along with your text without having to do anything extra.


        Stefan




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

end of thread, other threads:[~2010-01-06 15:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-06 14:53 point when modifying other buffers Daniel Carvalho
2010-01-06 15:06 ` Stefan Monnier

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.