I'm pretty sure there are other solutions, but you can do this using --eval instead of -f (--funcall):
emacs --eval '(ediff-files "file1" "file2")'
In fact, the Emacs manual on "Command Line Arguments for Emacs Invocation" says that -f function and --funcall function
Call Lisp function function. If it is an interactive ...
What I recommend you to try is to start Isearch first and then yank your word to the search string, effectively doing the same what you would do manually to add words in isearch-mode:
(defun my-search-word ()
(isearch-forward nil 1)
If you need to match word boundaries, then try this:
It's a synonym for -f / --funcall, included for backwards compatibility.
The argument-handling code in command-line-1 says:
"-f" ; what the manual claims
"-e")) ; what the source used to say
I use the following script: it checks in advance if there are differences, and in case there are, it opens Emacs with the appropriate function evaluated. With the -d option, it assumes the items provided are directories, and ediff-directories instead of ediff-files is used; otherwise it checks if they are directories or files, and sets the function to use ...
DOS does not recognize ' ' as quotes.
You will have to use the following:
emacs --eval "(set-background-color \"green\")"
Powershell works a little closer to what you expect:
emacs --eval '(set-background-color \"green\")'
But it too requires \ before the " to properly escape them.
I use this to diff from bash. --eval is what I think you are looking for.
If you are not using emacsclient you can adjust the first portion accordingly.
if [ -d $1 ]; then
emacsclient -c -a emacs -q --eval "(ediff-directories \"$1\" \"$2\" \"\")";
emacsclient -c -a emacs -q --eval "(ediff-files \"$1\" \"$2\")";
A solution based on suggestions by @phil and @glucas.
The idea is to set a dynamic HOME variable: first set it in the shell as the parent of .emacs.d; then reset it in my "pseudo-init" to the desired value (here the document folder).
Here is the full working solution.
emacs\bin\runemacs.exe -q --...
Sort-of solution: emacsclient -a '' ...
Looking at the automatic links appearing at the right of the question, I saw a question not seen before: emacsclient - Opening frames from emacs-daemon - Emacs Stack Exchange. User there uses emacsclient -a '' ... which incidentally solves the issue.
I guess it allows emacsclient to assume that callee is a real ...