如何创建一个结合了 diary-block 和 diary-circular 的 emacs 日记条目?

问题描述 投票:0回答:1

我本以为这是一个常见问题解答,但到目前为止我还无法编写找到它的搜索表达式。所以...

我想在 emacs 日记中编写表达式,使用日记块和日记循环函数来选择日期。也就是说,例如,每周二进行排练,但仅限从 9 月 8 日到 11 月 12 日。这似乎应该是可能的,但我无法从我的 emacs 日历指南中弄清楚如何做到这一点。读过。

emacs calendar
1个回答
0
投票

您可能忽略了一个关键点,即当您编写

%%(...)
时,
%%
之后的部分是一个 任意 lisp 形式,而不是一组有限的选项之一。因此答案很简单:

%%(and (diary-block ...) (diary-cyclic ...))

其他一些组合事物的例子:

%%(or (diary-float t 3 2) (diary-float t 3 4))
The 2nd and 4th Wednesday of each month.  (Not a 14-day cycle)

%%(or (diary-float '(1 3 5 7 9 11) 4 3) (diary-float '(2 4 6 8 10 12) 2 3))
Monthly dates alternating between the 3rd Tuesday and the 3rd Thursday
of each month.

%%(my-diary-foo)
Completely custom...

其中

my-diary-foo
是自定义函数:

;; To be called from diary-sexp-entry, where DATE, ENTRY are bound.
(defvar date)
(defun my-diary-foo ()
  "The first Thursday of the month following the 1st."
  ;; The first Thursday of the month unless the 1st is a Thursday,
  ;; in which case it will be on the 8th (being the 2nd Thursday).
  (if (and (eql (calendar-day-of-week date) 4) ;; Thursday
           (or (eql (calendar-extract-day date) 1)   ;; 1st of the month
               (eql (calendar-extract-day date) 8))) ;; 8th of the month
      (diary-float t 4 2)
    (diary-float t 4 1)))

欲了解更多信息,请阅读 C-hig

(emacs)Sexp Diary Entries

© www.soinside.com 2019 - 2024. All rights reserved.