博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
完美支持中文编程的 Emacs 配置文件 .emacs
阅读量:6082 次
发布时间:2019-06-20

本文共 3919 字,大约阅读时间需要 13 分钟。

hot3.png

完美支持中文编程的 Emacs 配置文件 .emacs

经过今天早晨的一番调试,终于完成这个比较通用的配置文件,使用该配置文件启动的 Emacs,具备如下特点:

1、完美支持中文;

2、支持自动补全,开启按键是(C-c a),需要把 Auto-complete 插件安装好;

3、支持暗色背景,让你的眼睛舒服一些,自己可以通过直接修改这句配置来调背景色:

(set-background-color "gray30")

4、支持语法高亮,当然这个本来就支持,不过做了点小改进,把左右括号单独拿出来上色,看起来更醒目一些;

5、支持显示行号;

6、支持切换 ccl 和 sbcl 

效果图在这里:

配置文件如下:

;(require 'cl)(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. '(current-language-environment "Chinese-GBK") '(uniquify-buffer-name-style (quote forward) nil (uniquify)))(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. );;; =========(set-language-environment "utf-8")(add-to-list 'load-path "~/LispBox-0.92/ccl-1.8-darwinx86/")(add-to-list 'load-path "~/LispBox-0.92/sbcl-1.0.55/")(add-to-list 'load-path "~/LispBox-0.92/slime-2012-11-13/")(setq load-path (cons "~/LispBox-0.92/slime-2012-11-13/" load-path));(add-to-list 'load-path "~/.emacs.d/slime-2012-11-13/");(setq load-path (cons "~/.emacs.d/slime-2012-11-13/" load-path))(global-font-lock-mode t)(font-lock-add-keywords 'lisp-mode '("[(]" "[)]"))(font-lock-add-keywords 'emacs-lisp-mode '("[(]" "[)]"))(font-lock-add-keywords 'lisp-interaction-mode '("[(]" "[)]"))(set-cursor-color "white")(set-mouse-color "blue")(set-foreground-color "green")(set-background-color "gray30")(set-border-color "lightgreen")(set-face-foreground 'highlight "red")(set-face-background 'highlight "lightblue")(set-face-foreground 'region "darkcyan")(set-face-background 'region "lightblue")(set-face-foreground 'secondary-selection "skyblue")(set-face-background 'secondary-selection "darkblue")(require 'linum)(setq linum-format "%3d ")(add-hook 'find-file-hooks (lambda () (linum-mode 1))) (add-to-list 'load-path "~/LispBox-0.92/auto-complete-1.3.1/")(require 'auto-complete-config)(add-to-list 'ac-dictionary-directories "~/LispBox-0.92/auto-complete-1.3.1/ac-dict")(ac-config-default)(add-hook 'lisp-mode-hook  '(lambda ()      (define-key lisp-mode-map "\C-ca" 'auto-complete-mode)))(add-to-list 'default-frame-alist '(width . 120))(add-to-list 'default-frame-alist '(height . 50))(set-buffer-file-coding-system 'utf-8)(set-terminal-coding-system 'utf-8)(set-keyboard-coding-system 'utf-8)(set-selection-coding-system 'utf-8)(set-default-coding-systems 'utf-8)(set-clipboard-coding-system 'utf-8)  (setq ansi-color-for-comint-mode t)(modify-coding-system-alist 'process "*" 'utf-8)  (setq-default pathname-coding-system 'utf-8)  (prefer-coding-system 'utf-8)(setq default-process-coding-system '(utf-8 . utf-8))  (setq locale-coding-system 'utf-8)(setq file-name-coding-system 'utf-8) (setq default-buffer-file-coding-system 'utf-8)  (setq slime-net-coding-system 'utf-8-unix);;; =========;;; Note that if you save a heap image, the character;;; encoding specified on the command line will be preserved,;;; and you won't have to specify the -K utf-8 any more.;;; (setq inferior-lisp-program "/usr/local/bin/ccl64 -K utf-8")(setq inferior-lisp-program "dx86cl64 -K utf-8")(setq inferior-lisp-program "sbcl -K utf-8")(setq slime-lisp-implementations      '((ccl ("/Users/admin/LispBox-0.92/ccl-1.8-darwinx86/dx86cl64") :coding-system utf-8-unix)(sbcl ("/Users/admin/LispBox-0.92/sbcl-1.0.55/sbcl") :coding-system utf-8-unix)))(require 'slime-autoloads)(global-set-key "\C-cs" 'slime-selector)(slime-setup '(slime-fancy slime-asdf slime-banner))

内置了 ccl 和 sbcl 两种 Common Lisp 实现,直接启动 slime 的话会调用 ccl ,可以通过命令来选择调用哪种实现,具体操作如下:

启动方式:M-- M-x slime说明一下,就是同时按住 ALT 键 和 - 键(减号),然后再同时按住 ALT 键和 x 键。接下来会提示你输入你要启动的 Lisp 实现:输入 ccl 就是 ccl输入 sbcl 就是 sbcl

转载于:https://my.oschina.net/freeblues/blog/105566

你可能感兴趣的文章
新手IT人员,如何找到适合自己专业书籍的6个问题?
查看>>
去除JSP主机默认的8080端口
查看>>
关系型数据库之mysql-proxy实现读写分离
查看>>
EMC模拟器下载
查看>>
3月移动设备占比TOP10:苹果冠军 红米晋身第五
查看>>
阿里巴巴Java开发 之 工程规约
查看>>
我的友情链接
查看>>
我是如何在12周内由零基础成为一名程序员的——记Matt程序员快速成长之路
查看>>
windows server免安装IIS强性能LAMP+memcached
查看>>
世界杯迄今最火的一场比赛 一文看懂世界杯背后的阿里云黑科技
查看>>
罗辑思维在全链路压测方面的实践和工作笔记
查看>>
机器对外扫描,重装了系统也不行,打补丁也不行,什么原因?
查看>>
基于OpenSSL自建CA和颁发SSL证书
查看>>
vagrant+phpStorm配置xdebug
查看>>
union和union all的区别
查看>>
编写Shell管理脚本(下)
查看>>
LoadRunner 测试脚本C语言常用函数
查看>>
OpenStack-Rocky版单机部署
查看>>
tomcat 在 Linux 的部署,以 Ubuntu 为例
查看>>
storm 基本安装
查看>>