hatmatrix
hatmatrix

Reputation: 44892

define aliases for shell-command?

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?

Upvotes: 2

Views: 631

Answers (1)

Jérôme Radix
Jérôme Radix

Reputation: 10533

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.

Upvotes: 2

Related Questions