CMake mode for emacs 提供了一些好的功能,一直都沒有注意到這個(gè)mode,今天正式開始使用。
首先,下載cmake-mode.el文件
??http://www.cmake.org/CMakeDocs/cmake-mode.el
放到自己的emacs plugin目錄下:
/opt/emacs_plugins/cmake-mode.el
然后在.emacs文件中設(shè)置如下:
- (setq load-path (cons (expand-file-name "/opt/emacs_plugins") load-path))
- (require 'cmake-mode)
- (setq auto-mode-alist
- (append '(("CMakeLists\\.txt\\'" . cmake-mode)
- ("\\.cmake\\'" . cmake-mode))
- auto-mode-alist))
(setq load-path (cons (expand-file-name "/opt/emacs_plugins") load-path)) (require 'cmake-mode) (setq auto-mode-alist (append '(("CMakeLists\\.txt\\'" . cmake-mode) ("\\.cmake\\'" . cmake-mode)) auto-mode-alist))
重新啟動(dòng)Emacs后,打開我的CMake工程的CMakeLists.txt文件,里面command關(guān)鍵字都已經(jīng)變成高亮。
M-x 執(zhí)行 cmake-help-list-commands 后,可以看到所有當(dāng)前CMake版本支持的命令。
將光標(biāo)停在某個(gè)command(比如AUX_SOURCE_DIRECTORY)之上,運(yùn)行cmake-help-command 會(huì)看到關(guān)于AUX_SOURCE_DIRECTORY command的詳細(xì)介紹。
其他功能后面慢慢體會(huì)吧。