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 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 explains why you can not get the behavior you want with -f
/--funcall
.
ediff-directories
takes three arguments, so the command shown above changes to
emacs --eval '(ediff-directories "dir1" "dir2" "regexp")'
As explained here, ediff-directories
causes Emacs to enter ediff-meta-mode
, so you'll be dropped into the "Ediff Session Group Panel" first. From the Ediff manual on Session Groups:
Several major entries of Ediff perform comparison and merging on directories. On entering
ediff-directories
,ediff-directories3
, [...] the user is presented with a Dired-like buffer that lists files common to the directories involved along with their sizes. [...] We call this buffer Session Group Panel because all Ediff sessions associated with the listed files will have this buffer as a common focal point. [...]In directory comparison or merging, a session group panel displays only the files common to all directories involved. The differences are kept in a separate directory difference buffer and are conveniently displayed by typing D to the corresponding session group panel. [...]
So to display the actual diff, just hit D (ediff-show-dir-diffs
).