I want to make an alias in eshell so that when I type gcc it actually does gcc -Wall -pedantic -std=c99 but when I make the alias, it just displays gcc -Wall -pedantic -std=c99 and doesn't actually compile the program. Any ideas?

  • Show what you have tried, to help others help you.
    – Drew
    Dec 12 '15 at 2:06

In eshell aliases $* is replaced by the list of arguments passed after the aliased command. (You can also use $1 to get the first argument, $2 for the second, etc.)

So, try

alias gcc "gcc -Wall -pedantic -std=c99 \$*"

As far as I know this behavior is not documented in the manual. See the EmacsWiki Eshell Alias page and the comment at the top of em-alias.el, though.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.