0

I was looking for a way to alias the emacs ediff for easier use in c-shell. When writing emacs --eval "(ediff "f1" "f2")", emacs is opened in ediff mode, comparing file f1 to file f2.
When trying to alias it, however, I didn't find a way to insert the files names from the command line.
The following code works for bash, but not for c-shell (because c-shell don't support functions):

function ediff() {  
    emacs --eval "(ediff \"$1\" \"$2\")"}  

Also tried emacs --eval "(ediff \!*)", but it didn't work as well.
Anyone knows of a way to make this aliasing?

edit
Following the suggestion in the comments, I created a bash script called ediff that all it does is emacs --eval "(ediff \"$1\" \"$2\")".
Couldn't make the csh to even eval \"$1\"!

Community
  • 1
  • 1
user2141046
  • 862
  • 2
  • 7
  • 21
  • I removed tags `emacs` and `eval`. The question is not about Emacs or `ediff`. It is about shell command aliasing. – Drew Aug 23 '15 at 17:07
  • 1
    in csh, the best you can do is make it into a callable script. Then you can pass in a whole cmd-line full of arguments. Good luck. – shellter Aug 23 '15 at 22:27
  • @shellter - it is a valid possibility, but id there is a solution, I'd rather find it. – user2141046 Aug 24 '15 at 08:53

1 Answers1

0

Use single quotes, but break out of them for arguments like !:1. Also escape double quotes, !, spaces, and parentheses with \.

The result is:

alias ediff emacsclient --eval '\(ediff-files\ \"'\!:1'\"\ \"'\!:2'\"\)'
Kevin
  • 86
  • 4