简体   繁体   English

每个文件的颜色代码议程视图

[英]Color code agenda view per file

I have several .org files, eg personal.org and work.org. 我有几个.org文件,例如personal.org和work.org。

When viewing the agenda, I'd like to have events from each file differently colored. 在查看议程时,我希望每个文件中的事件都有不同的颜色。

For example, 例如,

Wednesday  12 June 2013
  personal:   11:00am........ Personal Meeting
  work:       2:00pm- 3:00pm  Work Meeting

There are already some colors in the agenda, but those two lines are both white. 议程中已经有一些颜色,但这两行都是白色的。 How can I set the line coming from personal to one color, and the line coming from work to another? 如何设置从个人到一种颜色的线,以及从工作到另一种颜色的线? I figure at least there has to be a way to define a color scheme based on the personal: and work: text if there's no easy way to have org do it by file. 我认为至少必须有一种方法来定义基于personal:的颜色方案personal:work:文本,如果没有简单的方法让org按文件进行。

Thanks! 谢谢!

The only thing I found as solution for what you ask, you have to use a hook function, changing faces after the agenda view is ready. 我找到的唯一解决方案是你要求的,你必须使用钩子函数,在议程视图准备好后更换面孔。 The following code is untested, but should get you going: 以下代码未经测试,但应该让你去:

(add-hook 'org-finalize-agenda-hook
    (lambda ()
      (save-excursion
        (goto-char (point-min))
        (while (re-search-forward "personal:" nil t) 
          (add-text-properties (match-beginning 0) (point-at-eol)
             '(face secondary-selection)))
        (goto-char (point-min))
        (while (re-search-forward "work:" nil t) 
          (add-text-properties (match-beginning 0) (point-at-eol)
             '(face bold))))))

John Wiegley sent once a patch he wrote so that, with an :OVERLAY: property, all Work items have the same background color. John Wiegley曾经发送了一个他写的补丁,所以使用:OVERLAY:属性,所有工作项都具有相同的背景颜色。 And with another value for Personal, those items have a different color. 对于Personal的另一个值,这些项目具有不同的颜色。

See http://comments.gmane.org/gmane.emacs.orgmode/54342 http://comments.gmane.org/gmane.emacs.orgmode/54342

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM