以前都是用sublime写erlang代码,好处不多说,主要是觉得一点不好用,不能实现函数跳转,及其不方便,尤其是代码一多,头疼。后来折腾过IntelliJ,下了个收费$0.00的版本,风格还是挺稀饭的,函数什么的都解决了,留下一个bug,粘贴`复制神马的老是不搭调。。。没办法,还是回归开天神器emacs的怀抱!

  各种度娘 谷哥后,一路颠簸,终于勉强可以用了,不过还是不太稀饭。后来找师兄拷了个配置,折腾了下,上图:

下面是配置文件:

(setq default-directory "~/erlang")
(global-set-key (kbd "C-SPC") 'nil)
;; share clipboard with outside programs
(setq x-select-enable-clipboard t) (tool-bar-mode nil)
;;(menu-bar-mode nil)
(scroll-bar-mode nil)
(setq make-backup-files nil)
;; 设置另外一些颜色:语法高亮显示的背景和主题,区域选择的背景和主题,二次选择的背景和选择
(set-face-foreground 'highlight "white")
(set-face-background 'highlight "blue")
(set-face-foreground 'region "cyan")
(set-face-background 'region "blue")
(set-face-foreground 'secondary-selection "skyblue")
(set-face-background 'secondary-selection "darkblue")
(set-foreground-color "grey")
(set-background-color "black")
(set-cursor-color "gold1")
(set-mouse-color "gold1")
;;(set-scroll-bar-mode nil)
;设定光标为短线
(setq-default cursor-type 'bar)
;设置标题
(setq frame-title-format
'(" AcmeLtt - Emacs - [ " (buffer-file-name "%f \]"
(dired-directory dired-directory "%b \]"))))
;设置启动大小
(set-frame-height (selected-frame) 65)
(set-frame-width (selected-frame) 170) (setq inhibit-startup-message t);关闭起动时LOGO
(setq visible-bell t);关闭出错时的提示声
(setq default-major-mode 'erlang-mode);一打开就起用 text 模式
(global-font-lock-mode t);语法高亮
(auto-image-file-mode t);打开图片显示功能
(fset 'yes-or-no-p 'y-or-n-p);以 y/n代表 yes/no
(column-number-mode t);显示列号
(show-paren-mode t);显示括号匹配
(setq mouse-yank-at-point t);支持中键粘贴
(transient-mark-mode t);允许临时设置标记
(setq x-select-enable-clipboard t);支持emacs和外部程序的粘贴
(setq auto-save-default nil);关闭备份文件#xxx# ;;-----kill ring 长度
(setq kill-ring-max 200) (require 'linum)
(global-linum-mode 1) ;;--------------------------快捷键定义------------------------
(global-set-key [(f12)] 'loop-alpha) ;;玻璃
;;F1列模式
(global-set-key [f1] 'cua-mode)
;;恢复,常用键
(global-set-key [f2] 'undo)
;;F4,kill键,习惯设置,关闭当前buffer
(global-set-key [f4] 'kill-this-buffer)
;;定义查找快捷键
(global-set-key [f5] 'replace-regexp) ;;支持正则表达式
(global-set-key [f6] 'replace-string) (global-set-key [f8] 'erlang-mode)
(global-set-key [f7] 'ecb-activate) ;;定义F7键为激活ecb
(global-set-key [C-f7] 'ecb-deactivate)
(global-set-key [f11] 'delete-other-windows) ;;设置F11为删除其它窗口
(global-set-key (kbd "C-c z") (quote shell)) ;;-------------------------------全选--------------------- (defun select-all ()
"Select the whole buffer."
(interactive)
(goto-char (point-min))
;; Mark current position and push it into the mark ring.
(push-mark-command nil nil)
(goto-char (point-max))
(message "ok.")) (provide 'select-all) (autoload 'select-all "select-all"
"Select the whole buffer." t nil) ;; user defined keys (global-set-key "\C-x\C-a" 'select-all)
;;-------------------glass style------------------ (setq alpha-list '((85 55) (100 100))) (defun loop-alpha ()
(interactive)
(let ((h (car alpha-list)))
((lambda (a ab)
(set-frame-parameter (selected-frame) 'alpha (list a ab))
(add-to-list 'default-frame-alist (cons 'alpha (list a ab)))
) (car h) (car (cdr h)))
(setq alpha-list (cdr (append alpha-list (list h))))
)) ;;--------------------------erlang----------------------------------------------------
(setq load-path (cons "/usr/lib/erlang/lib/tools-2.6.6.5/emacs" load-path))
(setq erlang-root-dir "/usr/lib/erlang")
(setq exec-path (cons "/usr/lib/erlang/bin" exec-path))
(require 'erlang-start) (add-to-list 'auto-mode-alist '("\\.erl?$" . erlang-mode))
(add-to-list 'auto-mode-alist '("\\.hrl?$" . erlang-mode))
(add-to-list 'load-path "~/.emacs.d/erlware-mode") ;;----------------------distel------------------- (let ((distel-dir "~/.emacs.d/distel/elisp"))
(unless (member distel-dir load-path)
;; Add distel-dir to the end of load-path
(setq load-path (append load-path (list distel-dir))))) (require 'distel)
(distel-setup) ;; Some Erlang customizations (add-hook 'erlang-mode-hook
(lambda () ;; when starting an Erlang shell in Emacs, default in the node name (setq inferior-erlang-machine-options '("-sname" "emacs")) ;; add Erlang functions to an imenu menu (imenu-add-to-menubar "imenu"))) ;; prevent annoying hang-on-compile
(defvar inferior-erlang-prompt-timeout t) ;; tell distel to default to that node
(setq erl-nodename-cache
(make-symbol
(concat
"emacs@"
;; Mac OS X uses "name.local" instead of "name", this should work
;; pretty much anywhere without having to muck with NetInfo
;; ... but I only tested it on Mac OS X.
(car (split-string (shell-command-to-string "hostname")))))) ;; A number of the erlang-extended-mode key bindings are useful in the shell too
(defconst distel-shell-keys
'(("\C-\M-i" erl-complete)
("\M-?" erl-complete)
("\M-." erl-find-source-under-point)
("\M-," erl-find-source-unwind)
("\M-*" erl-find-source-unwind)
)
"Additional keys to bind when in Erlang shell.") (add-hook 'erlang-shell-mode-hook
(lambda ()
;; add some Distel bindings to the Erlang shell
(dolist (spec distel-shell-keys)
(define-key erlang-shell-mode-map (car spec) (cadr spec))))) ;;------------------------esense-------------------- (setq load-path (cons "~/.emacs.d/esense-1.12" load-path))
(require 'esense-start)
(setq esense-indexer-program "~/.emacs.d/esense-1.12/esense.sh") ;;----------------ecb--------------
;; cedet
(load-file "~/.emacs.d/cedet-1.0/common/cedet.el")
(global-ede-mode 1) ; Enable the Project management system
(semantic-load-enable-code-helpers) ; Enable prototype help and smart completion
(global-srecode-minor-mode 1) ; Enable template insertion menu (add-to-list 'load-path "~/.emacs.d/ecb-2.40")
(require 'ecb)
;;(require 'ecb-autoloads)
;;(setq ecb-auto-activate t)
(setq ecb-tip-of-the-day nil) ;; tabbar
(add-to-list 'load-path "~/.emacs.d/tabbar")
(require 'tabbar)
(tabbar-mode t)
(global-set-key [(meta j)] 'tabbar-backward)
(global-set-key [(meta k)] 'tabbar-forward) ;;--------------------- tabbar----------
(set-face-attribute 'tabbar-default-face nil
:family "DejaVu Sans Mono"
:background "gray80"
:foreground "gray30"
:height 1.0
)
(set-face-attribute 'tabbar-selected-face nil
:inherit 'tabbar-default
:foreground "DarkGreen"
:background "LightGoldenrod"
:box '(:line-width 2 :color "Darkgoldenrod")
:overline "black"
:underline "black"
:weight 'bold
)
(set-face-attribute 'tabbar-unselected-face nil
:inherit 'tabbar-default
:box '(:line-width 2 :color "#00B2BF")
)
(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.
'(ecb-options-version "2.40")
'(ecb-primary-secondary-mouse-buttons (quote mouse-1--C-mouse-1)))
(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.
)
;;wrangler ;; --------- wrangler -----------------------
(add-to-list 'load-path "/usr/local/lib/erlang/lib/wrangler-1.0/elisp")
(require 'wrangler) ;;---------------------YASnippet-------------------- (add-to-list 'load-path
"~/.emacs.d")
(require 'yasnippet-bundle) ;;----------------------auto-complete------------- ;;(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
;;(require 'auto-complete-config)
;;(ac-config-default)
(add-to-list 'load-path "~/.emacs.d/")
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d//ac-dict")
(ac-config-default)

  红色部分根据情况自己修改,wrlangler需要自己编译,路径是编译后的。

  除了wrangler需要自己编译外,其余的都在.emacs.d下。当然,得自己M-x load-library。嫌麻烦的可以email哦。

  最后,希望路过的牛牛能分享下自己的,诚心求教。

Emacs配置erlang开发环境(.emacs 文件)的更多相关文章

  1. 使用IntelliJ IDEA配置Erlang开发环境

    这篇文章比较详细,感谢作者,拷贝过来做个记录 ————————————————————————————————————————————————————————————————————————————— ...

  2. MacOS配置Erlang开发环境

    Mac下安装Erlang brew 的安装: $ curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C ...

  3. emacs 搭建racket开发环境

    emacs 搭建racket开发环境 emacs下搭建开发racket的环境,笔者之前用过下面两种模式:geiser和racket-mode.相对而言,后一种方式要显得简单.本文主要介绍后一种方式环境 ...

  4. Visual Studio 开发(二):VS 2017配置FFmpeg开发环境

    在上篇文章Visual Studio 开发(一):安装配置Visual Studio Code 中,我们讲了一下如何配置VS CODE,来编写和调试C的代码.如果你已经使用VS Code回顾和复习好C ...

  5. eclipse配置c开发环境

    // */ // ]]> eclipse配置c开发环境 1. eclipse配置c开发环境 1.1. 缘起 1.2. cygwin 1.3. eclipse 1.4. 配置 1 eclipse配 ...

  6. Notepad++ 使用nppexec插件配置简易开发环境

    notepad++  采用nppexec插件来配置简易开发环境,而不需要笨重的IDE以及麻烦.重复的命令行.控制台输入: 以下为本人最近用到的脚本配置: //编程语言脚本中$(NAME_PART).x ...

  7. VC 6中配置OpenGL开发环境

    2010,2012中配置类似 http://hi.baidu.com/yanzi52351/item/f9a600dffa4caa4ddcf9be1d VC 6中配置OpenGL开发环境 这里,我习惯 ...

  8. Macbook Pro配置PHP开发环境

    Macbook Pro配置PHP开发环境 安装环境如下: Mac OS 10.10.1 Apache 2.4.9 PHP 5.5.14 MySQL 5.6.22 Apache配置 在Mac OS 10 ...

  9. [转]Aptana Studio 3配置Python开发环境图文教程

    转载URL:http://www.cr173.com/html/49260_1.html 一.安装Aptana Studio 3 安装完运行时建议将相关默认工作目录设定在英文的某个目录下.避免可能出现 ...

随机推荐

  1. 【Android类型SDK测试(一)】认识Android类型的 SDK

    (一)SDK是个什么东东 接触软件相关行业的同学都应该知道,SDK(即 Software Development Kit),软件开发包.其作用就是为开发某些软件提供一些便利的东西,包括工具 集合,文档 ...

  2. Linux Power(一): kernel/power/earlysuspend.c

    /* kernel/power/earlysuspend.c * * Copyright (C) 2005-2008 Google, Inc. * * This software is license ...

  3. Django 模板中引用静态资源(js,css等)

    Django 模板中免不了要用到一些js和CSS文件,查了很多网页,被弄得略晕乎,还是官网靠谱,给个链接大家可以自己看英文的. https://docs.djangoproject.com/en/1. ...

  4. 03-树2. Tree Traversals Again (25)

    03-树2. Tree Traversals Again (25) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 8000 B 判题程序 Standard 作者 CHEN, Yue ...

  5. MYSQL 关于索引的部分问题!

    1. PRIMARY KEY也可以只指定为KEY.这么做的目的是与其它数据库系统兼容.二来key 是index的同意词! 2. 在UNIQUE索引中,所有的值必须互不相同.如果您在添加新行时使用的关键 ...

  6. gdal读写图像分块处理(精华版)

    一.gdal进行数据操作在安装好gdal后,即可调用gdal库中的函数.(需要包含的头文件:gdal_priv.h)1.打开数据集使用gdal库进行数据(影像)操作的第一步就是打开一个数据集.对于“数 ...

  7. 解决:getWeatherbyCityName(city),服务器无法处理请求。 ---> 未将对象引用设置到对象的实例。

    原文:getWeatherbyCityName(city),服务器无法处理请求. ---> 未将对象引用设置到对象的实例. 解决方法:不要直接使用 “服务引用” , 添加为 “Web 引用” 最 ...

  8. linux之SQL语句简明教程---DISTINCT

    SELECT 指令让我们能够读取表格中一个或数个栏位的所有资料.这将把所有的资料都抓出,无论资料值有无重复.在资料处理中,我们会经常碰到需要找出表格内的不同资料值的情况.换句话说,我们需要知道这个表格 ...

  9. iOS 原生地图 开发

    iOS开发有时候用到地图,不少人第一想到的是用第三方.当然有时候为了和安卓同步,可能会一起使用某一第三方.但有时候,我们是可以用原生地图开发的.上面两个示意图是原生地图的自定义开发.运行demo,将展 ...

  10. Pet(dfs+vector)

    Pet Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...