Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

external script inserting text at point

3 views
Skip to first unread message

LanX

unread,
Nov 26, 2009, 11:10:41 AM11/26/09
to
hi

I'm trying to trigger insertion of text-snippets into the current
buffer/point from external scripts.

E.g I tried from bash to call

emacsclient -e '(insert "huhu")'

and

emacsclient -ne '(insert-file "~/tmp/tst.pl")'

but without success... what am I missing? Do I have to select the
current point?

(I already checked that client and server communication works)

Any help appreciated

Cheers
Rolf

Lennart Borgman

unread,
Nov 26, 2009, 12:42:49 PM11/26/09
to LanX, help-gn...@gnu.org
On Thu, Nov 26, 2009 at 5:10 PM, LanX <lanx...@googlemail.com> wrote:
> hi
>
> I'm trying to trigger insertion of  text-snippets into the current
> buffer/point from external scripts.
>
> E.g I tried from bash to call
>
> emacsclient -e '(insert "huhu")'
>
> and
>
> emacsclient -ne '(insert-file "~/tmp/tst.pl")'
>
> but without success... what am I missing? Do I have to select the
> current point?

You have to select buffer.

LanX

unread,
Nov 26, 2009, 2:49:26 PM11/26/09
to
Hi

On 26 Nov., 18:42, Lennart Borgman <lennart.borg...@gmail.com> wrote:
> You have to select buffer.

well the question was more how to find the last selected buffer...

anyway after some fiddling I found a working approach: 8)

emacsclient -e '(progn (switch-to-buffer (car (buffer-list)))(insert
"huhu"))'


Cheers
Rolf

Lennart Borgman

unread,
Nov 26, 2009, 3:45:10 PM11/26/09
to LanX, help-gn...@gnu.org


Is that guaranteed to give the current buffer on the selected frame?


LanX

unread,
Nov 29, 2009, 1:34:17 PM11/29/09
to Lennart Borgman, help-gn...@gnu.org
Is that guaranteed to give the current buffer on the selected frame?

you're asking me? :)

I don't know, till now it worked fine!


Lennart Borgman

unread,
Nov 29, 2009, 1:36:21 PM11/29/09
to LanX, help-gn...@gnu.org


What does the doc string tell you?


LanX

unread,
Nov 29, 2009, 1:42:16 PM11/29/09
to Lennart Borgman, help-gn...@gnu.org

What does the doc string tell you?

What does Lennart want to tell me?

Lennart Borgman

unread,
Nov 29, 2009, 4:54:48 PM11/29/09
to LanX, help-gn...@gnu.org
On Sun, Nov 29, 2009 at 7:42 PM, LanX <lanx...@googlemail.com> wrote:
>>
>> What does the doc string tell you?
>
> What does Lennart want to tell me?


That he is interested in if the documentation in this case is good
enough. Actually he does not think so, but someone else might find it
better.


LanX

unread,
Nov 29, 2009, 6:52:55 PM11/29/09
to Lennart Borgman, help-gn...@gnu.org

That he is interested in if the documentation in this case is good
enough. Actually he does not think so, but someone else might find it
better.

Lennart, answering with trivial questions sounds much like the therapist finally got access into gnus! ;-)


No, the documentation I saw so far is not good enough.

But I didn't read *all* the docs thats why I'm asking here for help and insight...

oh ... 

...well googling for buffer-list brought deeper insight, it's in the elisp-info:

"The order of the buffers in this list is based primarily on how recently each buffer has been displayed in a window. "

http://www.gnu.org/software/emacs/elisp/html_node/The-Buffer-List.html

Sufficient? :)

Lennart Borgman

unread,
Nov 29, 2009, 7:10:37 PM11/29/09
to LanX, help-gn...@gnu.org


I wouldn't say so ;-)

It is unclear to me what "displayed in a window" mean.


Steve Revilak

unread,
Nov 29, 2009, 7:33:17 PM11/29/09
to help-gn...@gnu.org
LanX> I'm trying to trigger insertion of text-snippets into the current
LanX> buffer/point from external scripts.

If you don't mind shell typing commands into the mini-buffer, then
shell-command (typically bound to M-!) will do what you want.

To give an example, the text on the line below
Sun Nov 29 19:28:15 EST 2009

Came from

ESC 1 M-! date RETURN

(The prefix argument inserts command output at point, as opposed to
inserting the command output into a separate buffer.)

Steve

0 new messages