Emacs Python-mode syntax highlighting

半腔热情 提交于 2019-12-03 07:12:57
hargriffle

For me running emacs -nw from inside byobu with TERM=xterm produced the correct colours for syntax highlighting (the comments in python and bash are all red not just the #) and the function keys work. Note I set TERM as part of an alias for running emacs rather than setting it generally in .bashrc:

alias emacs='TERM=xterm; emacs -nw'

See also this post: Terminal emacs colors only work with TERM=xterm-256color

I don't have the programs you are using installed to test this, but I did notice some differences in the way the function keys are defined between screen-bce and xterm-color. You can try using the below steps to copy the settings from screen-bce to xterm-color.

Using the infocmp program, you can view the differences between the terminfo settings for two TERM settings:

infocmp -d screen-bce xterm-color

You can use infocmp to decompile the terminfo file to its source and make changes to it to try to mimic the behavior of the other terminal. Start by decoding the xterm-color terminfo file.

infocmp xterm-color > xterm-color.src

Edit xterm-color.src and modify the definitions of the kf1 through kf19 fields to match the values for screen-bce. Use infocmp to see screen-bce's definitions.

infocmp screen-bce

Finally compile using the tic program.

tic xterm-color.src

If you run it as a non-root user, it will put the compiled terminfo file into $HOME/.terminfo directory. On my system, it seems like Ubuntu picks this up automatically. You can also install it into the standard /usr/share/terminfo when you're satisfied. Running tic as root should do this for you.

Good luck!

I just added

(set-face-foreground 'font-lock-comment-face "red")

to my .emacs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!