Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Emacsclient to get current-buffer?

Tags:

emacs

elisp

When I use emacsclient --eval '(current-buffer)' it returns *server* instead of the current-buffer on emacs. I can insert and modify *server* with --eval command but is there a way to know make it do inserts to the real current buffer? Is there a way to pass a string like #<buffer index.html> and have it turn into a buffer object?

like image 272
BreezyChick89 Avatar asked Jul 05 '12 16:07

BreezyChick89


1 Answers

Try (window-buffer (selected-window)). For example,

emacsclient --eval '(with-current-buffer (window-buffer (selected-window)) (insert "foo"))'
like image 112
huaiyuan Avatar answered Sep 25 '22 17:09

huaiyuan