emacs CSS文件编辑利器-rainbow-mode(直观显示css颜色)
发表于 : 2012-06-02 12:36
发现一个CSS文件编辑利器-rainbow-mode 。这个el可以使得css文件,在颜色代码显示颜色。非常直观
不过,每次启动emacs后手动m-x rainbow-mode才能打开此模式。又什么方法,可以每次启动emacs后,自动打开改模式?
我参考了http://ar.newsmth.net/thread-4c0e86d44f946a.html 这个帖子的方法,进行配置。
如下是帖子内容:
看了一下rainbow-mode.el
我觉得应该是autoload搞的,你看看下面这段话,
是GNU Emacs Lisp Reference Manual(GELRM)里关于autoload的一段叙述:
The autoload facility allows you to make a function or macro
known in Lisp, but put off loading the file that defines it. The
first call to the function automatically reads the proper file to
install the real definition and other associated code, then runs
the real definition as if it had been loaded all along.
我在rainbow-mode的基础上,定义了一个global-rainbow-mode,
然后直接打开这个global-rainbow-mode就可以在每个buffer都自动打开
rainbow-mode,你把下面这段话放到.emacs里去吧
;; -------------------------------------------------------------------
;; 配置 rainbow-mode
;; -------------------------------------------------------------------
(require 'rainbow-mode)
;; -------------------------------------------------------------------
;; 定义一个全局的 rainbow-mode
;; -------------------------------------------------------------------
(define-globalized-minor-mode global-rainbow-mode
rainbow-mode rainbow-turn-on
:initialize 'custom-initialize-delay
:init-value (not (or noninteractive emacs-basic-display))
:group 'rainbow
:version "24")
;; -------------------------------------------------------------------
;; 打开 global-rainbow-mode
;; -------------------------------------------------------------------
(global-rainbow-mode)
可是贴上以上文件,放到emacs配置文件中,提示如下错误:
Warning (initialization): An error occurred while loading `/home/xxxx/.emacs':
Symbol's value as variable is void: global-rainbow-mode
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
这个问题,有那个知道怎么解决吗?
不过,每次启动emacs后手动m-x rainbow-mode才能打开此模式。又什么方法,可以每次启动emacs后,自动打开改模式?
我参考了http://ar.newsmth.net/thread-4c0e86d44f946a.html 这个帖子的方法,进行配置。
如下是帖子内容:
看了一下rainbow-mode.el
我觉得应该是autoload搞的,你看看下面这段话,
是GNU Emacs Lisp Reference Manual(GELRM)里关于autoload的一段叙述:
The autoload facility allows you to make a function or macro
known in Lisp, but put off loading the file that defines it. The
first call to the function automatically reads the proper file to
install the real definition and other associated code, then runs
the real definition as if it had been loaded all along.
我在rainbow-mode的基础上,定义了一个global-rainbow-mode,
然后直接打开这个global-rainbow-mode就可以在每个buffer都自动打开
rainbow-mode,你把下面这段话放到.emacs里去吧
;; -------------------------------------------------------------------
;; 配置 rainbow-mode
;; -------------------------------------------------------------------
(require 'rainbow-mode)
;; -------------------------------------------------------------------
;; 定义一个全局的 rainbow-mode
;; -------------------------------------------------------------------
(define-globalized-minor-mode global-rainbow-mode
rainbow-mode rainbow-turn-on
:initialize 'custom-initialize-delay
:init-value (not (or noninteractive emacs-basic-display))
:group 'rainbow
:version "24")
;; -------------------------------------------------------------------
;; 打开 global-rainbow-mode
;; -------------------------------------------------------------------
(global-rainbow-mode)
可是贴上以上文件,放到emacs配置文件中,提示如下错误:
Warning (initialization): An error occurred while loading `/home/xxxx/.emacs':
Symbol's value as variable is void: global-rainbow-mode
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file. Start Emacs with
the `--debug-init' option to view a complete error backtrace.
这个问题,有那个知道怎么解决吗?