unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* 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

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).