2

Is there a way to define aliases so that shell-command can recognize them? shell recognizes those defined in .emacs.d/init_bash.sh; is it possible to make shell-command aware of these also?

hatmatrix
  • 42,883
  • 45
  • 137
  • 231

1 Answers1

2

Read in simple.el in shell-command code :

    ;; We do not use -f for csh; we will not support broken use of
    ;; .cshrcs.  Even the BSD csh manual says to use
    ;; "if ($?prompt) exit" before things which are not useful
    ;; non-interactively.  Besides, if someone wants their other
    ;; aliases for shell commands then they can still have them.
    (call-process shell-file-name nil
          (if error-file
              (list t error-file)
            t)
          nil shell-command-switch command)

The nil after shell-file-name indicates that emacs don't send an input file to the process. Thus, you should check the value of shell-file-name to determine if it's a process that read implicit .rc files.

Jérôme Radix
  • 10,285
  • 4
  • 34
  • 40