在Emacs minibuffer中访问OS X / UNIX环境变量 [英] Accessing OS X / UNIX environment variables in Emacs minibuffer

查看:110
本文介绍了在Emacs minibuffer中访问OS X / UNIX环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在OS X豹上编译了Emacs 23,我很喜欢它。但是,当我从Aquamancs切换时,我注意到有一件事情是,我不能再访问我的.bash_profile文件中指定的环境变量。例如,我有一行:

  export WORK = / Users / myname / Documents / otherpaths / Work 

所以要打开文件,我可以输入minibuffer:

 查找文件:$ WORK / projectname / filename.txt 

或为了节省自己输入整个文件路径的麻烦。



我发现了一些编辑指令〜/ .MacOSX / environment.plist,.profile,和.login档案:



http ://www.emacswiki.org/emacs/CarbonEmacsPackage



但似乎不起作用,我不确定它是否适用。我想知道有没有人知道解决方案?感谢您的预期,



-Stephen

解决方案

你可以告诉emacs通过放置一个像

 (setenvWORK/ Users / myname / Documents / otherpaths / Work)的任何环境变量您的emacs配置文件(.emacs,.emacs.d / init.el或任何您使用的内容)中的



Aquamacs和CarbonEmacs可能使用一些技巧来实现,而无需手动指定。看看两者的源代码。


I compiled Emacs 23 on OS X Leopard and I am loving it. But one thing I noticed when I switched from Aquamancs is that I am no longer able to access my environment variables that I specify in my .bash_profile file. For instance, I have a line:

export WORK=/Users/myname/Documents/otherpaths/Work

So to open files I can type in the minibuffer:

Find file: $WORK/projectname/filename.txt

or something to that effect, to save myself the trouble of typing the whole file path.

I found some instructions on editing ~/.MacOSX/environment.plist, .profile, and .login files from this site:

http://www.emacswiki.org/emacs/CarbonEmacsPackage

but does not appear to work and I am not certain it is applicable. I wonder if anyone knows of a solution? Thanks in anticipation,

-Stephen

解决方案

you can tell emacs any environment variable by putting a line like

(setenv "WORK" "/Users/myname/Documents/otherpaths/Work")

in your emacs config file (.emacs, .emacs.d/init.el or whatever you use)

Probably Aquamacs and CarbonEmacs uses some tricks to achieve that without specifying it by hand. Take a look at the source code of both.

这篇关于在Emacs minibuffer中访问OS X / UNIX环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆