Emacs在运行编译命令时忽略了我的路径 [英] Emacs is ignoring my path when it runs a compile command
问题描述
(when(equal system-type'darwin)
(setenvPATH concat/Users/fearoffish/.rvm/bin:/Users/fearoffish/.rvm/rubies/ruby-1.8.7-p249/bin:/Users/fearoffish/.rvm/gems/ruby-1.8.7-p249/ bin:/Users/fearoffish/.rvm/gems/ruby-1.8.7-p249%global/bin:/Users/fearoffish/.rvm/bin))
(push/Users/fearoffish/.rvm / binexec-path)
(push/Users/fearoffish/.rvm/rubies/ruby-1.8.7-p249/binexec-path)
(push/ Users / fearoffish / exec-path)
(推/Users/fearoffish/.rvm/gems/ruby-1.8.7-p249%global/binexec-路径)
(推/Users/fearoffish/.rvm/binexec-path))
这是emacs初学者绝望的尝试得到我想要的。它仍然在它的前面,所以我的路径最终是:
/ usr / bin :/ bin中:/ usr / sbin目录:/ sbin目录:在/ usr / local / bin目录:在/ usr / X11 / bin中:/Users/fearoffish/.rvm/bin:/Users/fearoffish/.rvm/rubies/ruby-1.8。 7-p249 / bin:/Users/fearoffish/.rvm/gems/ruby-1.8.7-p249/bin:/Users/fearoffish/.rvm/gems/ruby-1.8.7-p249%global/bin
我不希望/ usr / bin和其他人在前面,我想要我的路径首先和emacs前面的路径是结束,我认为这将解决我的问题。
我通过简单地打开Aquamacs并运行 meta-x编译
然后 echo $ PATH
。
任何想法? p>
sanityinc解决方案的一个小的修改(在上面的评论中找不到一个方法来输入)我使用 修改后的代码: 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/environment.plist has the correct path in it, but emacs insists on prepending to this path and therefore making it useless. I've also tried: It was the desperate attempt of an emacs beginner to get what I wanted. It still prepends in front of it, so my path ends up being: I don't want /usr/bin and others prepending, I want my path first and the emacs prepended path to be at the end, I reckon this would fix my problem. I test this by simply opening Aquamacs and running Any ideas? A small modification to the solution by sanityinc (couldn't find a way to enter it in the comments above -- is that just me?) Modified code:
这篇关于Emacs在运行编译命令时忽略了我的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! -l </ code>选项到shell来强制登录shell(它读取
.profile
或 .bash_profile
),而不是一个交互式shell(只读 .bashrc
)。
(defun set-exec-path-from-shell-PATH()
let((path-from-shell
(replace-regexp-in-string[[:space:] \\\
] * $
(shell-command-to-string$ SHELL -l -c'echo $ PATH'))))
(setenvPATHfrom-shell)
(setq exec-path(split-string path-from-shell path-分隔符))))
(等于系统类型'darwin)(set-exec-path-from-shell-PATH))
(when (equal system-type 'darwin)
(setenv "PATH" (concat "/Users/fearoffish/.rvm/bin:/Users/fearoffish/.rvm/rubies/ruby-1.8.7-p249/bin:/Users/fearoffish/.rvm/gems/ruby-1.8.7-p249/bin:/Users/fearoffish/.rvm/gems/ruby-1.8.7-p249%global/bin:/Users/fearoffish/.rvm/bin"))
(push "/Users/fearoffish/.rvm/bin" exec-path)
(push "/Users/fearoffish/.rvm/rubies/ruby-1.8.7-p249/bin" exec-path)
(push "/Users/fearoffish/.rvm/gems/ruby-1.8.7-p249/bin" exec-path)
(push "/Users/fearoffish/.rvm/gems/ruby-1.8.7-p249%global/bin" exec-path)
(push "/Users/fearoffish/.rvm/bin" exec-path))
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Users/fearoffish/.rvm/bin:/Users/fearoffish/.rvm/rubies/ruby-1.8.7-p249/bin:/Users/fearoffish/.rvm/gems/ruby-1.8.7-p249/bin:/Users/fearoffish/.rvm/gems/ruby-1.8.7-p249%global/bin
meta-x compile
and then echo $PATH
.
-l
option to the shell to force a login shell (which reads .profile
or .bash_profile
), rather than an interactive shell (which only reads .bashrc
). (defun set-exec-path-from-shell-PATH ()
(let ((path-from-shell
(replace-regexp-in-string "[[:space:]\n]*$" ""
(shell-command-to-string "$SHELL -l -c 'echo $PATH'"))))
(setenv "PATH" path-from-shell)
(setq exec-path (split-string path-from-shell path-separator))))
(when (equal system-type 'darwin) (set-exec-path-from-shell-PATH))