【问题标题】:Color code agenda view per file每个文件的颜色代码议程视图
【发布时间】:2013-06-12 13:17:38
【问题描述】:

我有几个 .org 文件,例如personal.org 和 work.org。

查看议程时,我希望每个文件中的事件颜色不同。

例如,

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

议程中已经有一些颜色,但这两条线都是白色的。如何将来自个人的线路设置为一种颜色,将来自工作的线路设置为另一种颜色?我认为至少必须有一种方法来定义基于personal:work: 文本的配色方案,如果没有简单的方法让组织通过文件来完成。

谢谢!

【问题讨论】:

    标签: emacs org-mode


    【解决方案1】:

    我找到的唯一解决方案是,你必须使用钩子函数,在议程视图准备好后换脸。以下代码未经测试,但应该可以帮助您:

    (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))))))
    

    【讨论】:

    • 谢谢!只需将 face bold 更改为 face (:foreground "green") 就完全符合我的要求。
    【解决方案2】:

    John Wiegley 发送了一次他编写的补丁,以便通过 :OVERLAY: 属性,所有工作项都具有相同的背景颜色。并且对于 Personal 的另一个值,这些项目具有不同的颜色。

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

    【讨论】:

    • 我似乎无法让它发挥作用,我已经像他一样添加了:OVERLAY: (face (:foreground "green")),但它似乎对议程没有任何影响 - 有什么想法吗?
    • @Josh 该线程包含一个你可能没有应用的补丁。
    • @SridharRatnakumar 我在他的电子邮件中看到了一个内嵌补丁,但它没有实现 :OVERLAY:?
    猜你喜欢
    • 2013-11-12
    • 2013-07-07
    • 2013-05-22
    • 2018-05-31
    • 2011-09-11
    • 1970-01-01
    • 1970-01-01
    • 2018-01-09
    相关资源
    最近更新 更多