emacs术语模式下的Unicode字符 [英] Unicode characters in emacs term-mode
问题描述
我使用字符± 作为我的git存储库提示。
在Emacs的安全术语中,我的提示没有呈现为unicode,并显示为\302\261 。显示当前编码系统显示,默认为输入到进程的utf-8-unix,但是我将原始二进制文件作为解码输出。我可以打C-c RET p改变编码和解码编码系统。当我启动一个终端时,我正在绘制一个如何自动设置的空白?我已经尝试添加到term-mode-hook来设置缓冲区的编码系统无效。我想我已经在term.el中找到了我正在寻找的内容,但是我并不在乎调整分发elisp,而且似乎添加了原始的二进制文件来修复其他地方的错误。
编辑:原来不清楚。我在MacOS上设置可可式Emacs 23.3下安装程序的默认流程编码系统的问题。 Emacs本身没有运行在终端中,我的终端正在Emacs中运行。
在更好地了解 term.el
,以下作品:
(defadvice ansi-term(之后adv-ansi-term-coding-system)
(set-buffer-process-coding-system'utf-8-unix'utf-8-unix))
(ad-activate'ansi-term )
尝试使用 term-mode-hook
因为在term.el中, term-mode-hook
在切换到终端缓冲区之前被调用,所以 set-buffer-process-coding -system
由于缺少与缓冲区关联的进程而中断。
I use ansi-term for my normal terminal sessions. I tend to use unicode characters in my prompt to do things like set the trailing character based on the type of source control I'm using.
I use the character "±" as my prompt for git repositories.
In Emacs' ansi-term, my prompt isn't rendered as unicode, and shows as "\302\261". Displaying the current coding system shows that it defaults to utf-8-unix for input to the process, but I get raw binary as the decoding output. I can hit C-c RET p to change the encoding and decoding coding systems. I'm drawing a blank as to how to set this automatically when I start a terminal? I've tried adding to term-mode-hook to set the buffer's coding system to no avail. I think I've found what I'm looking for in term.el, but I don't care to tweak the distribution elisp, and it appears the raw binary was added to fix a bug somewhere else.
EDIT: This was unclear originally. I'm having issues setting the default process coding system for ansi-term running under Cocoa-ized Emacs 23.3 on MacOS. Emacs itself isn't running in a terminal, my terminal is running in Emacs.
After getting a better understanding of term.el
, the following works:
(defadvice ansi-term (after advise-ansi-term-coding-system)
(set-buffer-process-coding-system 'utf-8-unix 'utf-8-unix))
(ad-activate 'ansi-term)
Trying this with term-mode-hook
is broken because in term.el, term-mode-hook
is called before switching to the terminal buffer, so set-buffer-process-coding-system
breaks due to the lack of a process associated with the buffer.
这篇关于emacs术语模式下的Unicode字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!