Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/bash/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Bash OS X上的Emacs 24.3 ansi术语无颜色_Bash_Emacs_Emacs24_Dot Emacs_Ansi Term - Fatal编程技术网

Bash OS X上的Emacs 24.3 ansi术语无颜色

Bash OS X上的Emacs 24.3 ansi术语无颜色,bash,emacs,emacs24,dot-emacs,ansi-term,Bash,Emacs,Emacs24,Dot Emacs,Ansi Term,我使用自制软件安装了Emacs 24.3(使用--cocoa和--srgb安装)。每当我启动emacs.app,然后启动ansi术语时,它都没有颜色。然而,当我启动应用程序时,ansi术语有颜色 所以我想我的init.el文件中可能有什么地方出错了。我把所有东西都注释掉了,但ansi术语对颜色不起作用 最奇怪的是,当我启用init.el中的所有内容时,当我执行emacs-nw,然后在那里执行ansi术语时(我知道,很复杂,但我正在尝试测试),它在所有主题和所有加载项运行时都能正常工作。这太奇怪了

我使用自制软件安装了Emacs 24.3(使用
--cocoa
--srgb
安装)。每当我启动emacs.app,然后启动ansi术语时,它都没有颜色。然而,当我启动应用程序时,ansi术语有颜色

所以我想我的
init.el
文件中可能有什么地方出错了。我把所有东西都注释掉了,但ansi术语对颜色不起作用

最奇怪的是,当我启用
init.el
中的所有内容时,当我执行
emacs-nw
,然后在那里执行ansi术语时(我知道,很复杂,但我正在尝试测试),它在所有主题和所有加载项运行时都能正常工作。这太奇怪了,我都不知道从哪里开始

应用程序运行时,似乎没有使用我的
bash\u配置文件中的设置。我为什么这么说?因为当ansi术语运行正常(使用
emacs-nw
)时,它说了以下内容:
bash:\u powerline\u prompt:command not found
,这意味着它试图加载我为终端安装的电源线,但不知道如何处理它。我只是禁用了电源线,看看它是否是罪魁祸首,即使这样也不能解决问题

然而,当ansi术语没有颜色时,它不会喷出该行

有人知道到底发生了什么吗?(自制
emacs.app
是否使用另一个
.bash\u配置文件
可能?)

这是我的
init.el
,禁用了外部包,因此其中的所有内容都由emacs和包自动设置:

;; emacs customizations (automatic)
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(TeX-command-list (quote (("TeX" "%(PDF)%(tex) %`%S%(PDFout)%(mode)%' %t" TeX-run-TeX nil (plain-tex-mode texinfo-mode ams-tex-mode) :help "Run plain TeX") ("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil (latex-mode doctex-mode) :help "Run LaTeX") ("Makeinfo" "makeinfo %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with Info output") ("Makeinfo HTML" "makeinfo --html %t" TeX-run-compile nil (texinfo-mode) :help "Run Makeinfo with HTML output") ("AmSTeX" "%(PDF)amstex %`%S%(PDFout)%(mode)%' %t" TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX") ("ConTeXt" "texexec --once --texutil %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt once") ("ConTeXt Full" "texexec %(execopts)%t" TeX-run-TeX nil (context-mode) :help "Run ConTeXt until completion") ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help "Run BibTeX") ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber") ("View" "open -a Preview.app %s.pdf" TeX-run-discard-or-function t t :help "Run Viewer") ("Print" "%p" TeX-run-command t t :help "Print the file") ("Queue" "%q" TeX-run-background nil t :help "View the printer queue" :visible TeX-queue-command) ("File" "%(o?)dvips %d -o %f " TeX-run-command t t :help "Generate PostScript file") ("Index" "makeindex %s" TeX-run-command nil t :help "Create index file") ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help "Check LaTeX file for correctness") ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t :help "Spell-check the document") ("Clean" "TeX-clean" TeX-run-function nil t :help "Delete generated intermediate files") ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help "Delete generated intermediate and output files") ("Other" "" TeX-run-command t t :help "Run an arbitrary command"))))
 '(ansi-color-faces-vector [default bold shadow italic underline bold bold-italic bold])
 '(ansi-color-names-vector ["#fdf6e3" "#dc322f" "#859900" "#b58900" "#268bd2" "#d33682" "#2aa198" "#657b83"])
 '(ansi-term-color-vector [unspecified "#1F1611" "#660000" "#144212" "#EFC232" "#5798AE" "#BE73FD" "#93C1BC" "#E6E1DC"])
 '(compilation-message-face (quote default))
 '(custom-safe-themes (quote ("e16a771a13a202ee6e276d06098bc77f008b73bbac4d526f160faa2d76c1dd0e" "bbd99b10462e3d0f4ac6da09e23e5de1fed4f7fe87d679a6468a14b0b6c8e634" "77bd459212c0176bdf63c1904c4ba20fce015f730f0343776a1a14432de80990" "ccba14aeee25adc49effe868f1820dfbf28b557353e4f69ca55de50642caf63f" "a30d5f217d1a697f6d355817ac344d906bb0aae3e888d7abaa7595d5a4b7e2e3" "290987f8b1cbe93977fc21403c1e9bdc95013cb0cf29d0f6120768463ee61442" "0d19ff470ad7029d2e1528b3472ca2d58d0182e279b9ab8acd65e2508845d2b6" "9a217ee1dcefd5e83f78381c61e25e9c4d25c7b80bf032f44d7d62ca68c6a384" "96efbabfb6516f7375cdf85e7781fe7b7249b6e8114676d65337a1ffe78b78d9" "c1fb68aa00235766461c7e31ecfc759aa2dd905899ae6d95097061faeb72f9ee" "7feeed063855b06836e0262f77f5c6d3f415159a98a9676d549bfeb6c49637c4" "c739f435660ca9d9e77312cbb878d5d7fd31e386a7758c982fa54a49ffd47f6e" "fc2782b33667eb932e4ffe9dac475f898bf7c656f8ba60e2276704fabb7fa63b" "ca229a0a89717c8a6fe5cd580ee2a85536fbafce6acb107d33cf38d52e2f492c" "5bd5af0deb1ab0e2c1b9c54d94a3f030529b6c7034fdf0d3cc4b0e7e0338cb91" "c27b3d858a9c033b93f9447337659d3ba34a72251b794e8bfe792ed722cc1f67" "2affb26fb9a1b9325f05f4233d08ccbba7ec6e0c99c64681895219f964aac7af" "65ae93029a583d69a3781b26044601e85e2d32be8f525988e196ba2cb644ce6a" "c4e6fe8f5728a5d5fd0e92538f68c3b4e8b218bcfb5e07d8afff8731cc5f3df0" "758da0cfc4ecb8447acb866fb3988f4a41cf2b8f9ca28de9b21d9a68ae61b181" "5bee853b49605401494a6574d1c5a991a0d75e86fedf5ad9a1577de6cbba7691" "f0ea6118d1414b24c2e4babdc8e252707727e7b4ff2e791129f240a2b3093e32" "9370aeac615012366188359cb05011aea721c73e1cb194798bc18576025cabeb" "0e121ff9bef6937edad8dfcff7d88ac9219b5b4f1570fd1702e546a80dba0832" "968d1ad07c38d02d2e5debffc5638332696ac41af7974ade6f95841359ed73e3" "d070fa185078bf753dcfd873ec63be19fa36a55a0c97dc66848a6d20c5fffdad" "d677ef584c6dfc0697901a44b885cc18e206f05114c8a3b7fde674fce6180879" "8aebf25556399b58091e533e455dd50a6a9cba958cc4ebb0aab175863c25b9a4" "92653253cdebc448ad0b8b2ba08c6bd87c8af5d8d1c346f86fb4029a1f46a716" default)))
 '(fci-rule-character-color "#452E2E")
 '(fci-rule-color "#eee8d5")
 '(fringe-mode 6 nil (fringe))
 '(highlight-changes-colors (quote ("#d33682" "#6c71c4")))
 '(highlight-tail-colors (quote (("#eee8d5" . 0) ("#B4C342" . 20) ("#69CABF" . 30) ("#69B7F0" . 50) ("#DEB542" . 60) ("#F2804F" . 70) ("#F771AC" . 85) ("#eee8d5" . 100))))
 '(linum-format " %7d ")
 '(magit-diff-use-overlays nil)
 '(main-line-color1 "#191919")
 '(main-line-color2 "#111111")
 '(package-archives (quote (("gnu" . "http://elpa.gnu.org/packages/") ("melpa" . "http://melpa.milkbox.net/packages/"))))
 '(syslog-debug-face (quote ((t :background unspecified :foreground "#2aa198" :weight bold))))
 '(syslog-error-face (quote ((t :background unspecified :foreground "#dc322f" :weight bold))))
 '(syslog-hour-face (quote ((t :background unspecified :foreground "#859900"))))
 '(syslog-info-face (quote ((t :background unspecified :foreground "#268bd2" :weight bold))))
 '(syslog-ip-face (quote ((t :background unspecified :foreground "#b58900"))))
 '(syslog-su-face (quote ((t :background unspecified :foreground "#d33682"))))
 '(syslog-warn-face (quote ((t :background unspecified :foreground "#cb4b16" :weight bold))))
 '(vc-annotate-background nil)
 '(vc-annotate-color-map (quote ((20 . "#dc322f") (40 . "#CF4F1F") (60 . "#C26C0F") (80 . "#b58900") (100 . "#AB8C00") (120 . "#A18F00") (140 . "#989200") (160 . "#8E9500") (180 . "#859900") (200 . "#729A1E") (220 . "#609C3C") (240 . "#4E9D5B") (260 . "#3C9F79") (280 . "#2aa198") (300 . "#299BA6") (320 . "#2896B5") (340 . "#2790C3") (360 . "#268bd2"))))
 '(vc-annotate-very-old-color nil)
 '(weechat-color-list (quote (unspecified "#fdf6e3" "#eee8d5" "#990A1B" "#dc322f" "#546E00" "#859900" "#7B6000" "#b58900" "#00629D" "#268bd2" "#93115C" "#d33682" "#00736F" "#2aa198" "#657b83" "#839496"))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
应用程序运行时,似乎没有使用中的设置 我的bash_档案

我相信这就是问题所在,emacs作为应用程序(即不是从shell)启动时,似乎没有选择正确的路径。这解释了为什么从shell启动emacs时,
ansi术语
会有颜色(我合理地假设您从shell运行了
emacs-q
emacs-nw


有关可能的解决方案,请参阅。你可能也会觉得有用。

这可能是一个黑客攻击,但我通过将
.bash\u配置文件
复制到
.bashrc
(因此我有
.bash\u配置文件
.bashrc
)解决了这个问题

如果我从Terminal.app启动Emacs.app,它将读取我的
.bash\u配置文件
。当我通过单击Applications文件夹中的Emacs图标启动它时,它会显示my
.bashrc
。我不知道这是否是正常行为,但出于我的目的,它运行得非常完美,因为我已从
中删除了电源线。bashrc
因此
ansi term
不会不断抛出错误


总而言之,这是一个非常简单的修复方法,我希望其他人能从中受益。

也许可以尝试将光标放在ansi术语窗口中的一个字符上,您知道该字符应该有颜色,但没有颜色,然后键入:
C-u C-x=
,然后查看在该特定位置使用了哪些面(如果有)。与其使用自制程序,不如考虑使用:这样,与Emacs有关的所有东西都被打包在一个应用程序中,而不是分散在硬盘驱动器上——唯一需要担心的其他地方就是你的代码> Emacs。code>C-u C-x=
一直跳回提示,没有显示任何有关面的信息。你使用emacsformacosx.com是对的,我只是觉得用自制软件更新会很容易。试图减轻自己的痛苦,但似乎我正在增加更多的痛苦。:-)我试过了。这并不能解决问题。在有人能提出解决方案之前,我暂时从终端启动emacs。同时,我尝试了下面的代码:paste.lisp.org/display/132476将其保存在一个文件中,并将其加载到我的init.el中。调用类似so
(shell环境中的setenv)
的函数,您知道如何实际使用它吗?正如您可能看到的,我是emacs和lisp的noob。我现在真的有emacs pinky…您正确地使用了函数
(来自shell环境的setenv)
。它只是从您的shell中获取环境变量并在emacs中设置它们。我很高兴您能够修复它,祝贺您!为什么不接受这个答案?@IqbalAnsari我可以在发布24小时后接受我自己的答案。还有一段时间我才能做到:-)