* Emacsclient --eval with command line arguments.
@ 2022-05-05 1:23 Hongyi Zhao
2022-05-05 15:07 ` Manuel Giraud
0 siblings, 1 reply; 2+ messages in thread
From: Hongyi Zhao @ 2022-05-05 1:23 UTC (permalink / raw)
To: help-gnu-emacs
I want to call Emacsclient to format the gap script with the following steps:
1. Put the following code snippet in scratch buffer, and `C-x C-e` it:
```emacs-lisp
(server-start)
(defun my-gap-format-file (file)
"Open file, format as GAP, and save."
(with-current-buffer (find-file "test.gap")
(gap-format-buffer)
(save-buffer)))
```
2. According to the comment here [1], I tried the following method but failed:
```shell
$ time emacsclient -s read --eval '(my-gap-format-file (file-truename
"'"$1"'"))' gap-test.g
emacsclient: Should XDG_RUNTIME_DIR='/run/user/1000' be in the environment?
emacsclient: (Be careful: XDG_RUNTIME_DIR is security-related.)
emacsclient: can't find socket; have you started the server?
emacsclient: To start the server in Emacs, type "M-x server-start".
emacsclient: error accessing socket "read"
real 0m0.012s
user 0m0.009s
sys 0m0.005s
```
How can I run `emacsclient --eval` with command line arguments in this
situation?
[1] https://www.reddit.com/r/emacs/comments/hhbcg7/emacsclient_eval_with_command_line_arguments/
Regards
--
Assoc. Prof. Hongsheng Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Emacsclient --eval with command line arguments.
2022-05-05 1:23 Emacsclient --eval with command line arguments Hongyi Zhao
@ 2022-05-05 15:07 ` Manuel Giraud
0 siblings, 0 replies; 2+ messages in thread
From: Manuel Giraud @ 2022-05-05 15:07 UTC (permalink / raw)
To: Hongyi Zhao; +Cc: help-gnu-emacs
Hongyi Zhao <hongyi.zhao@gmail.com> writes:
[...]
> $ time emacsclient -s read --eval '(my-gap-format-file (file-truename
> "'"$1"'"))' gap-test.g
Why are you using this "read" socket that you don't seem to have
created? Try to remove this parameter to see what emacsclient does by
default.
Best regards,
--
Manuel Giraud
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-05-05 15:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-05 1:23 Emacsclient --eval with command line arguments Hongyi Zhao
2022-05-05 15:07 ` Manuel Giraud
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.