我使用emacs org-mode进行各种任务。最常用的功能是使用特殊标签TODO
和DONE
标记我的任务。是否有一种方法可以添加自定义标签(例如IN_PROGRESS
)并使用单独的颜色突出显示?
此外,如果这个标签能够在与TODO
和DONE
相同的缓冲区中滚动,那么就很好了,这样我就可以使用相同的热键在它们之间切换。
我在我的 init.el 文件中使用以下代码,为所有 org 文件设置了额外的任务状态及其样式:
(setq org-todo-keyword-faces
'(
("NOT-TODO" . (:foreground "blue" :weight bold))
("IF-TIME" . (:foreground "yellow" :weight bold))
("NOT-REPRO" . (:foreground "purple" :weight bold))
))
(setq org-todo-keywords
'((sequence "TODO" "NOT-TODO" "NOT-REPRO" "IF-TIME" "DONE")))
我使用以下代码生成TODO关键字,使它们在我的提纲和日程中更加醒目。如果我没记错的话,这个样式是从邮件列表上得到的。
(setq org-todo-keywords
'((sequence "TODO"
"MAYBE"
"NEXT"
"STARTED"
"WAITING"
"DELEGATED"
"|"
"DONE"
"DEFERRED"
"CANCELLED")))
(setq org-todo-keyword-faces
'(("PROJ" :background "blue" :foreground "black" :weight bold :box (:line-width 2 :style released-button))
("TODO" :background "red1" :foreground "black" :weight bold :box (:line-width 2 :style released-button))
("NEXT" :background "red1" :foreground "black" :weight bold :box (:line-width 2 :style released-button))
("STARTED" :background "orange" :foreground "black" :weight bold :box (:line-width 2 :style released-button))
("WAITING" :background "yellow" :foreground "black" :weight bold :box (:line-width 2 :style released-button))
("DEFERRED" :background "gold" :foreground "black" :weight bold :box (:line-width 2 :style released-button))
("DELEGATED" :background "gold" :foreground "black" :weight bold :box (:line-width 2 :style released-button))
("MAYBE" :background "gray" :foreground "black" :weight bold :box (:line-width 2 :style released-button))
("APPT" :background "red1" :foreground "black" :weight bold :box (:line-width 2 :style released-button))
("DONE" :background "forest green" :weight bold :box (:line-width 2 :style released-button))
("CANCELLED" :background "lime green" :foreground "black" :weight bold :box (:line-width 2 :style released-button))))
这将使我的日程看起来像下面这样:
(set-face-attribute 'org-todo nil :background "red1" :foreground "black" :weight 'bold :box '(:line-width 2 :style released-button))
。如果我发现任何剩余的“完成”状态,我可以用类似的方式进行修复 (set-face-attribute 'org-done ...
。 - Brady Trainor(setq org-todo-keyword-faces
'(...
)
如果你想对每个TODO
状态做出调整,可以考虑一种分割方法,该方法基本上为|
管道两侧的两组制作一个面孔,例如。
(set-face-attribute 'org-todo nil
:foreground "#AFD8AF"
)
(set-face-attribute 'org-done nil
:foreground "#CC9393"
)
(这种颜色选择是我当前在zenburn
主题中使用的开关。)也就是说,分别适用于以下组:
TODO1 TODO2 ... TODOk | DONE1 DONE2 ... DONEn
预计完成时间:
我后来不得不处理各种org-mode标题级别的不同颜色,并且很难找到可以与所有标题级别形成良好对比的颜色对(对于org-todo
和org-done
)。此外,还必须处理更改Emacs的配色方案,因为低对比度的zenburn可能随着季节变化而不太合适。
简单地反转默认颜色要容易得多。结果的矩形边缘有点尴尬,所以边框有助于使其看起来更自然。然后,我得到了一个类似于Stuart Hickinbottom的方案。
所以现在我的方案如下:
(set-face-attribute 'org-todo nil
:box '(:line-width 2
:color "grey75"
:style released-button)
:inverse-video t
)
(set-face-attribute 'org-done nil
:box '(:line-width 2
:color "grey75"
:style released-button)
:inverse-video t
)
(set-face-attribute 'org-priority nil
:inherit font-lock-keyword-face
:inverse-video t
:box '(:line-width 2
:color "grey75"
:style released-button)
)
(load-theme 'deeper-blue t)
的结果,如下图所示: