2012-07-05 91 views
4

當我使用emacsclient --eval '(current-buffer)'時,它返回*server*而不是emacs上的current-buffer。我可以用--eval命令插入並修改*server*命令,但是有沒有辦法知道讓它插入到實際的當前緩衝區中?有沒有辦法傳遞像#<buffer index.html>這樣的字符串,並將它變成緩衝區對象?Emacsclient獲取當前緩衝區?

回答

9

嘗試(window-buffer (selected-window))。例如,

emacsclient --eval '(with-current-buffer (window-buffer (selected-window)) (insert "foo"))'