scripting - emacs --daemon with --batch and input file -


I would like to create a script that clears spaces and tabs on several files in a folder for me. A bash file has been created with other things:

  emacsclient -t -e '(Prague (pregloo-cleanup buffer-to-field) (save-buffer-kill-terminal)' $ FILE  

It does not appear to work because it defines all file arguments as running tasks (So ​​is executed as $ FILE function). (PS prelude - cleanup-buffer-or-area)

Now I want what I want - batch (because I really do not want to display anything screen) but This is not one of the options of the emacsclient, the reason is that I just want to use emacsclient instead of using emacs --batch is that I have many startup files, so this If all this is loaded, then I want to The replay will take a lot of time.

means emacsclient -e Evaluate Lispi forms, do not edit the file

From the man page

  -e, - do not go to files only, rather evaluate the arguments in the form of amaxes lisp expression .  

I think you can add a (search-file "file") to your list of forms

I have just tried the snippet -

  / opt / local / bin / emacsclient -e '(Progi (search file "./tmpfoo") (end-of-buffer) ("FFF" Insert) -buffer)) ' 

And it does silently render the file you expected.

You can increase the logic file name by using shell globing and a script, the list of forms. Do not go with

-t switch, -e does not expect a continuous editor window, and you do not need a kill-terminal . The client will just run his alias and he gets out.

I think I would probably write a lispie function, which takes the name of the file name, that I loaded at emacs at startup time, and then a file name for Emacsclient,

Eg FILENAME = "somefile"; Emacsclient -e "(now-do-my-cheese $ FILENAME)"


Comments