`
kiol
  • 浏览: 42585 次
  • 来自: ...
社区版块
存档分类
最新评论

emacs下rails模式中的错误代码的颜色修改

阅读更多

联系使用emacs做rails开发,并使用color-theme做了色彩调整,我用的是(color-theme-calm-forest),但是在代码出错后,背景色变得和前景色极为相近,非常难辩认.修改color-theme不起作用,后来发现所有色彩主题都是同样的颜色,后又猜是ruby-mode搞得,看了一遍也没找到原因.最后终于找到,可以使用

"Set point on a comment and hit `M-x describe-face'.  You can also use
`M-x customize-face' to modify it."

然后看了一下,原来flyMake搞的鬼,应该rails带的,以前到没注意这个,有空看看除了实时提醒代码错误外,还能干嘛.

最后加了一行代码解决:

(custom-set-faces '(flymake-errline ((((class color)) (:background "DarkRed")))))

全部.emacs文件如下:

(desktop-save-mode 1)

(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill)


;;(global-font-lock-mode)
(transient-mark-mode t)

(fset 'yes-or-no-p 'y-or-n-p)
(display-time)
(show-paren-mode t)
(tool-bar-mode -1)
(menu-bar-mode -1)
(scroll-bar-mode -1)
(setq-default make-backup-files nil)
(setq default-directory "E:/NBProjects/")

(global-set-key [(meta g)] 'goto-line)
(global-set-key [(meta left)] 'backward-sexp)
(global-set-key [(meta right)] 'forward-sexp)
(global-set-key "\C-x\C-m" 'execute-extended-command)
(global-set-key "\C-c\C-m" 'execute-extended-command)
(global-set-key "\C-w" 'backward-kill-word)
(global-set-key "\C-x\C-k" 'kill-region)
(global-set-key "\C-c\C-k" 'kill-region)
(global-set-key [f5] 'call-last-kbd-macro)

;; Taken from the comment section in inf-ruby.el
;; (setq ruby-program-name "/usr/local/bin/ruby")
(add-to-list 'load-path (expand-file-name "D:/ruby/src/ruby-1.8.6-p111/misc"))
(autoload 'ruby-mode "ruby-mode" "Mode for editing ruby source files")
(add-to-list 'auto-mode-alist '("\\.rb$" . ruby-mode))
(add-to-list 'interpreter-mode-alist '("ruby" . ruby-mode))
(autoload 'run-ruby "inf-ruby" "Run an inferior Ruby process")
(autoload 'inf-ruby-keys "inf-ruby" "Set local key defs for inf-ruby in ruby-mode")
(add-hook 'ruby-mode-hook '(lambda () (inf-ruby-keys)
                 (require 'ruby-electric)
                 (ruby-electric-mode t)))


;; disable backup
(setq make-backup-files nil)
;; abbrev mode
(setq-default abbrev-mode t)
(read-abbrev-file "~/.emacs.d/abbrev_defs")
(setq save-abbrevs t)

(add-to-list 'load-path "~/site-lisp")
(add-to-list 'load-path "~/site-lisp/rails")
(add-to-list 'load-path "~/site-lisp/cedet/common")
(add-to-list 'load-path "~/site-lisp/ecb")

(add-hook 'nxml-mode-hook
          (lambda ()
            (setq local-abbrev-table nxml-mode-abbrev-table)))
(defun try-complete-abbrev (old)
  (if (expand-abbrev) t nil))

(setq hippie-expand-try-functions-list
      '(try-complete-abbrev
        try-complete-file-name
        try-expand-dabbrev))

(require 'psvn)
(require 'snippet)
(require 'cedet)
(require 'rails)
;; associate ruby-mode with .rb files
(add-to-list 'auto-mode-alist '("\.rb$" . ruby-mode))
(setq auto-mode-alist  (cons '("\\.rjs$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist  (cons '("\\.rake$" . ruby-mode) auto-mode-alist))
(setq auto-mode-alist  (cons '("\\.rhtml$" . nxml-mode) auto-mode-alist))
(setq auto-mode-alist  (cons '("\\.erb$" . nxml-mode) auto-mode-alist))

(modify-coding-system-alist 'file "\\.rhtml$" 'utf-8)
(modify-coding-system-alist 'file "\\.erb$" 'utf-8)
(modify-coding-system-alist 'file "\\.rb$" 'utf-8)
(modify-coding-system-alist 'file "\\.rjs$" 'utf-8)
(modify-coding-system-alist 'file "\\.yml$" 'utf-8)

(add-to-list 'load-path "~/site-lisp/yasnippet")
(require 'yasnippet)
(add-to-list 'yas/extra-mode-hooks
             'ruby-mode-hook)
(yas/initialize)
(yas/load-directory "~/site-lisp/yasnippet/snippets")
(setq yas/root-directory "~/snippets")
(yas/load-directory yas/root-directory)
(make-variable-buffer-local 'yas/trigger-key)
(add-hook 'ruby-mode-hook ; or rails-minor-mode-hook ?
          '(lambda ()
             (setq yas/trigger-key
                   (kbd "<tab>"))))
(semantic-load-enable-code-helpers)
(require 'ecb-autoloads)
(mouse-avoidance-mode 'animate) 
 
(load "~/site-lisp/nxml/autostart.el")

(add-to-list 'auto-mode-alist '("\\.css$" . css-mode)) 

(add-to-list 'load-path "~/site-lisp/color-theme")
(require 'color-theme) 
(color-theme-initialize) 
;;(color-theme-gnome2) 
(color-theme-calm-forest)
(custom-set-faces '(flymake-errline ((((class color)) (:background "DarkRed")))))

;;在html和css模式下将#XXXXXX按所代表的颜色着色
(defvar hexcolour-keywords
   '(("#[abcdef[:digit:]]\\{6\\}"
      (0 (put-text-property (match-beginning 0)
                            (match-end 0)
                            'face (list :background
                                        (match-string-no-properties 0)))))))
 (defun hexcolour-add-to-font-lock ()
   (font-lock-add-keywords nil hexcolour-keywords))
 (add-hook 'nxml-mode-hook 'hexcolour-add-to-font-lock)
 (add-hook 'css-mode-hook 'hexcolour-add-to-font-lock)
 
;; for yaml 
  
(require 'yaml-mode) 
 
(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode)) 
(add-hook 'yaml-mode-hook 
          '(lambda () 
             (define-key yaml-mode-map "\C-m" 'newline-and-indent))) 
 
;; for javascript 

;;启动emacsclient服务,然后用emacsclientw.exe打开文件就不用新开一个emacs了
(server-start)
 
(autoload 'javascript-mode "javascript" nil t) 
(add-to-list 'auto-mode-alist '( "\\.js\\'" . javascript-mode)) 
(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.33beta2"))

(ido-mode t)

3
0
分享到:
评论
1 楼 kiol 2008-07-02  
呵呵,终于找到正宗的修改方法了
;; I don't like the default colors
(set-face-background 'flymake-errline "red4")
(set-face-background 'flymake-warnline "dark slate blue")

相关推荐

    EMACS 的 VIPOR 模式命令卡片

    EMACS 的 VIPOR 模式的参考卡片, 使用EMACS 的 VIPOR 模式的时候放在手边很方便。 使用 EMACS 的时候, 又感觉 VI 的击键快捷很爽, 可以用 EMACS 的 VIPOR 模式, 这可以说是有点另类的程序员的选择。

    projectile-rails:基于弹丸的Emacs Rails模式

    Projectile Rails是用于在GNU Emacs中使用应用程序和引擎的次要模式。 在内部它是基于。 这意味着您可以使用Projectile的命令来获取(或确认)文件,运行测试,在项目之间切换等。 使用Projectile Rails,您可以:...

    projectile-rails, 基于弹丸的Rails 模式.zip

    projectile-rails, 基于弹丸的Rails 模式 弹 Rails 概要弹 Rails 是在 GNU Emacs中使用 Ruby on Rails 应用程序和引擎的次要模式。 在内部,它是基于弹 。这意味着你可以在 greping ( 或者 acking ) 文件。运行测试...

    emacs-elixir, Emacs主要Elixir模式.zip

    emacs-elixir, Emacs主要Elixir模式 Elixir模式提供字体锁定,缩进和导航支持 Elixir程序语言。 安装工具通过 package.el通过 el手动使用情况交互式命令配置文件Keymapping注释工具集成工具。

    windows下安装emacs及添加配置文件代码

    windows下安装emacs及添加配置文件代码

    Emacs详细安装配置,yasnippet和代码自动提示,强烈推荐

    Emacs详细安装配置,yasnippet和代码自动提示,强烈推荐 将文件解压到你的home目录下就可以,windows系统下放到 C:\Users\你的名字\AppData\Roaming下或者你自己设置的EMACS HOME目录

    Emacs配置及代码补全插件

    将文件夹中的“.emacs”文件复制到C:\ (由于系统限制暂时不支持代码不全) Linux: 1.打开文件夹,按住[Ctrl]+[H],并将文件夹里的文件全部复制到Home文件夹下 2.打开Emacs ,按住[Alt]+[[X]输入“load-file” 3.输入...

    emacs windows下emacs 编辑器

    emacs windows下emacs 编辑器 据说是神的编辑器

    Emacs下用GDB调试

    介绍在Emacs下如何使用GDB进行调试。

    emacs 快速配置脚本包

    快速搭建的主要思想是采用执行注册表脚本 设定 emacs 查找配置文件的路径为 c: emacs home emacs 同时又在此文件中定位到我们现在刚下载的路径 及更改 home 目录的方式 包含最基本的配置 颜色 字体等 脚本以及常用的...

    Emacs User 's Guide中文版电子书

    目录 导言 GNU 是什麽 GNU Emacs 是什麽 GNU EMACS 的特质 Emacs 的线上辅助说明 Emacs 的基本知识 Emacs 的自学教材 Ctrl-h 的用法 ...Emacs 下的中文编辑 中文化的 EMACS - Mule 结论

    solarized-emacs, Solarized颜色主题,移植到 Emacs.zip

    solarized-emacs, Solarized颜色主题,移植到 Emacs 用于Emacs的 SolarizedSolarized是vim开发的主题的Emacs端口,由Ethan开发。Emacs的Solarized仅在 24下测试,但应该在 Emacs 23下工作。 主题是按照定制和 def

    racket-mode, GNU Emacs主要的球拍模式.zip

    racket-mode, GNU Emacs主要的球拍模式 用于 GNU Emacs的球拍模式 这为编辑球拍和源文件提供了一个主要模式,同时也提供了一个主要模式来进行球拍替换。 编辑/运行体验类似于 DrRacket 。聚焦于球拍。模式行和菜单...

    emacs-tutorial-in-chinese, emacs系列教程,中文写作.zip

    emacs-tutorial-in-chinese, emacs系列教程,中文写作

    linum+.el emacs的行号模式,更好用,好不容易带回来的

    linum+.el emacs的行号模式,更好用,好不容易带回来的. 多少收点分,也给大家个方便,多谢支持.

    jsx-mode.el, JSX代码的Emacs主要模式.zip

    jsx-mode.el, JSX代码的Emacs主要模式 jsx-mode.el----主要模式用法开始将这里文件放入你的Emacs lisp路径( 比如 。 ~/.emacs.d/site-lisp) 并添加到你的~/.emacs.d/init.el. 中(add-to-list

    linux下emacs安装

    linux下emacs安装,里面有软件安装包和详细的安装文档~~

    Emacs中文手册.pdf

    Emacs中文手册.pdf

    我的emacs模版

    emacs模版,定制linux下的emacs编辑环境,自动添加代码模版,快速高效。

    transient-emacs:Atom编辑器VS代码的Emacs模式

    用于Atom编辑器/ VS代码的Emacs(瞬变标记模式) 这个软件包模拟了Emacs的。 特征 像键盘绑定的emacs 带有多个游标的杀死环 与剪贴板同步kill-ring 像增量搜索一样的emacs 从杀死环历史记录中选择抽出文本 键...

Global site tag (gtag.js) - Google Analytics