Emacs is ignoring my path when it runs a compile command

后端 未结 8 1681
盖世英雄少女心
盖世英雄少女心 2020-12-05 11:24

I\'m trying to get a compile command (rake cucumber) to run with a specific ruby version on my Mac OS X system, I use rvm to do this currently in the terminal. My ~/.MacOSX/

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-05 12:19

    I find the environment.plist scheme on Macs pretty ugly, so I use the following snippet, which assumes you want Emacs to use the same PATH that you see in your Terminal.app:

    (defun set-exec-path-from-shell-PATH ()
      (let ((path-from-shell (shell-command-to-string "$SHELL -i -c 'echo $PATH'")))
        (setenv "PATH" path-from-shell)
        (setq exec-path (split-string path-from-shell path-separator))))
    

    (This works for me in Emacs 23; haven't tried it in other versions, but I'd expect it to work.)

提交回复
热议问题