Given the command line option description from Emacs manual:
‘-f function’ ‘--funcall=function’ Call Lisp function function. If it
is an interactive function (a command), it reads the arguments
interactively just as if you had called the same function with a key
sequence. Otherwise, it calls the function with no arguments.
this is expected. You can try using -e
instead:
‘--eval=expression’ ‘--execute=expression’ Evaluate Lisp expression
expression.
You'll probably need something like this:
emacs --eval '(ediff-files "file1" "file2")'
Check this for something that looks like a ready-made script you can use:
An alternative is shown on the Ediff mode manual page:
which adds a command line switch -diff
:
(defun command-line-diff (switch)
(let ((file1 (pop command-line-args-left))
(file2 (pop command-line-args-left)))
(ediff file1 file2)))
(add-to-list 'command-switch-alist '("diff" . command-line-diff))
;; Usage: emacs -diff file1 file2