为shell-command定义别名?

时间:2010-09-05 19:27:02

标签: emacs elisp

有没有办法定义别名,以便shell-command可以识别它们? shell识别.emacs.d / init_bash.sh中定义的那些;是否有可能让shell-command意识到这些?

1 个答案:

答案 0 :(得分:2)

simple.el代码中阅读shell-command

    ;; 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)

nil之后的shell-file-name表示emacs不会向进程发送输入文件。因此,您应该检查shell-file-name的值以确定它是否是读取隐式.rc文件的进程。