2
參考鏈接, In C/C++ mode in Emacs, change face of code in #if 0...#endif block to comment face。在Emacs的C/C++模式下#if 0 ... #endif塊內更改代碼顏色21.3.1
我試過了代碼,但它似乎沒有工作。我的emacs版本是Linux上的GNU Emacs 21.3.1。
請你讓我知道我要去哪裏錯了。
TIA
參考鏈接, In C/C++ mode in Emacs, change face of code in #if 0...#endif block to comment face。在Emacs的C/C++模式下#if 0 ... #endif塊內更改代碼顏色21.3.1
我試過了代碼,但它似乎沒有工作。我的emacs版本是Linux上的GNU Emacs 21.3.1。
請你讓我知道我要去哪裏錯了。
TIA
cpp-highlight-mode
可製成無需用戶交互工作。這是我有我的設置:
(defun cpp-highlight-if-0/1()
"Modify the face of text in between #if 0 ... #endif."
(interactive)
(setq cpp-known-face '(background-color . "dim gray"))
(setq cpp-unknown-face 'default)
(setq cpp-face-type 'dark)
(setq cpp-known-writable 't)
(setq cpp-unknown-writable 't)
(setq cpp-edit-list
'((#("1" 0 1
(fontified nil))
nil
(background-color . "dim gray")
both nil)
(#("0" 0 1
(fontified nil))
(background-color . "dim gray")
nil
both nil)))
(cpp-highlight-buffer t))
(defun jpk/c-mode-hook()
(cpp-highlight-if-0/1)
(add-hook 'after-save-hook 'cpp-highlight-if-0/1 'append 'local)
)
(add-hook 'c-mode-common-hook 'jpk/c-mode-hook)
的關鍵是搞清楚是cpp-highlight-mode
看cpp-edit-list
。我按照我想要的交互方式進行設置,然後查看,結果爲C-h v
。
這是Emacs的一個非常舊的版本。你能升級嗎? – scottfrazer