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?
Try (window-buffer (selected-window)). For example,
emacsclient --eval '(with-current-buffer (window-buffer (selected-window)) (insert "foo"))'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With