Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacsclient -eval "(insert \"something\")" is not working for me

Tags:

emacs

I recently upgraded to Ubuntu 10.04 which comes with Emacs 23. I need Jabref to push citations to Emacs.

However, despite I installed the Jabref plugin to push citations through emacsclient, it's not working.

I did my testing, and read some of the Emacs Lisp Intro.

Some commands do work, for instance if I type (in the console):

  emacsclient --eval "(switch-to-buffer \"*sratch*\")"

the emacs windows switches to that buffer. However if I issue an insert command:

  emacsclient --eval "(insert \"do you see me?\")"

no text is inserted in the current buffer.

Does Emacs 23 changed something about insert?

like image 545
manu Avatar asked May 10 '10 13:05

manu


2 Answers

Yo are inserting in server buffer, you most likely want:

emacsclient --eval '(with-current-buffer "*scratch*" (insert "do you see me?"))'
like image 178
Jürgen Hötzel Avatar answered Nov 02 '22 11:11

Jürgen Hötzel


Emacs23 change something about emacsclient and server.

The expression is evaluated in the buffer " *server*" (with a leading space)... So you have to change buffer before inserting:

  emacsclient --eval "(with-current-buffer \"*scratch*\" (insert \"foo\"))"
like image 3
Rémi Avatar answered Nov 02 '22 13:11

Rémi