CMake mode for emacs 提供了一些好的功能,一直都沒有注意到這個mode,今天正式開始使用。
首先,下載cmake-mode.el文件
??http://www.cmake.org/CMakeDocs/cmake-mode.el
放到自己的emacs plugin目錄下:
/opt/emacs_plugins/cmake-mode.el
然后在.emacs文件中設置如下:
- (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))
重新啟動Emacs后,打開我的CMake工程的CMakeLists.txt文件,里面command關鍵字都已經變成高亮。
M-x 執行 cmake-help-list-commands 后,可以看到所有當前CMake版本支持的命令。
將光標停在某個command(比如AUX_SOURCE_DIRECTORY)之上,運行cmake-help-command 會看到關于AUX_SOURCE_DIRECTORY command的詳細介紹。
其他功能后面慢慢體會吧。