-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20240426090022-emacs_添加农历纪念日.html
428 lines (375 loc) · 10.4 KB
/
20240426090022-emacs_添加农历纪念日.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2025-01-02 周四 15:00 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>+emacs+添加农历纪念日</title>
<meta name="generator" content="Org Mode" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
/*@import url("https://fonts.googleapis.com/css2?family=Lora:wght@500&display=fallback");
@import url("https://fonts.googleapis.com/css2?family=Inconsolata&display=fallback");
*/
body {
margin: 2% auto;
width: 90%;
max-width: 100%;
background-color: rgba(242,229,188,0.5);
/* background-color: rgba(255,255,255,0.5); */
font-size: 18px;
line-height: 1.4em;
}
@media screen and (min-width: 600px) {
body {
font-size: 18px;
}
}
@media screen and (min-width: 910px) {
body {
width: 900px;
}
}
#preamble {
width: 80%;
max-width: 980px;
text-align: right;
margin: auto;
}
hr {
border: none;
border-top: 5px double #333;
margin: 0px 0;
}
.button {
border: none;
color: black;
padding: 6px 14px;
text-align: center;
text-decoration: none;
display: inline-block;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
}
.button:hover {
background-color: #3a1616;
color: white;
}
.todo {
background-color: #9d0006;
color: #fbf1c7;
padding: .1em 0.3em;
border-radius: 3px;
background-clip: padding-box;
font-size: $code-size;
font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
line-height: 1;
}
.done {
background-color: #427b58;
color: #fbf1c7;
padding: .1em 0.3em;
border-radius: 3px;
background-clip: padding-box;
font-size: $code-size;
font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
line-height: 1;
}
#postamble p {
font-size: 80%;
margin: .2em;
}
#content, .content {
width: 80%;
max-width: 980px;
margin: auto;
}
#org-div-home-and-up{
position: fixed;
right: 0.5em;
margin-top: 70px;
font-family:sans-serif;
}
#table-of-contents {
margin-top: 105px;
font-size: 12pt;
position: fixed;
left: 0em;
top: 0em;
background: white;
max-height: 80%;
overflow: auto;
}
#table-of-contents h2 {
display: none;
}
#table-of-contents li {
clear: both;
}
.timestamp {
color: #928374;
font-size: $smaller;
}
.timestamp-kwd {
color: #5f9ea0;
}
@media screen and (max-width: 1200px) {
#table-of-contents {
position: relative;
margin-top: 0px;
}
}
/* p:not(blockquote > p) :not(ol > p) { */
/* text-indent: 2em; */
/* } */
p {
margin: 1em auto;
}
.title {
font-size: 30px;
line-height: 1.3;
font-weight: bold;
color: #0c2340;
}
h2:not(#table-of-contents > h2) {
font-size: 30px;
line-height: 1.2;
position: relative;
color: #204060;
}
h2::after {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
background-color: black;
}
h3:not(#table-of-contents > h3) {
font-size: 20px;
line-height: 1.1;
position: relative;
color: #4b748d;
}
h3::after {
content: "";
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 2px;
/* border-bottom: 1px dashed black; */
}
h4 {
font-size: 14px;
line-height: 1.1;
font-weight: bold;
}
a {
cursor: pointer;
text-decoration: none;
}
a:link {
color: #458588;
/* text-decoration: underline; */
}
a:hover {
/* font-weight: bold; */
text-decoration: underline;
/* color: #076678; */
}
.figure {
text-align: center;
}
a:visited{
color: #8f3f71;
/* text-decoration: underline; */
}
img {
max-width: 100%;
vertical-align: middle;
}
.MathJax_Display {
margin: 0!important;
width: $smaller!important;
}
@media screen and (max-width: 1200px) {
img {
width: 400px;
}
.MathJax_Display {
margin: 0!important;
width: $smaller!important;
}
}
.org-src-container {
font-size: 14px;
outline: 2px dashed #ccc;
outline-offset: 10px;
position: relative;
}
.org-src-container>pre {
overflow: auto;
font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Cascadia Code,Consolas, Liberation Mono, monospace;
}
.org-src-container>pre:before {
display: block;
position: absolute;
background-color: #b3b3b3;
top: 0;
right: 0;
padding: 0 0.5em;
border-bottom-left-radius: 8px;
border: 0;
color: white;
font-size: $code-size;
}
pre {
overflow: auto;
}
.example{
font-size: 14px;
outline: 2px dashed #ccc;
outline-offset: 10px;
position: relative;
}
.example::before {
content: "Results";
}
pre:before {
display: block;
position: absolute;
background-color: #b3b3b3;
top: 0;
right: 0;
padding: 0 0.5em;
border-bottom-left-radius: 8px;
border: 0;
color: white;
font-size: $code-size;
}
/* .org-src-container::before { */
/* content: "Copy"; */
/* position: absolute; */
/* top: 5px; */
/* right: 5px; */
/* padding: 5px; */
/* background-color: #ccc; */
/* color: #fff; */
/* border-radius: 3px; */
/* cursor: pointer; */
/* } */
code {
font-size: 16px;
color: #427b58;
}
.subtitle {
text-align: right;
}
blockquote {
border-left: 3px solid #ccc;
padding-left: 10px; /* Optional: add some left padding for the content */
margin-inline-start: 0px;
margin-inline-end: 0px;
}
.info {
overflow: hidden;
}
.created {
float: right;
}
.updated {
float: left;
}
.org-ol {
list-style-type: decimal; /* Set the list style type to decimal numbers */
/* margin-left: 0.5em; /\* Add left margin to the list *\/ */
}
b {
color: #9d0006;
}
#footnotes {
position: fixed;
left: auto;
right: 0;
top: 105px;
bottom: 0;
width: 20%;
padding: 10px;
overflow: auto;
font-size: 14px;
z-index: 9999;
}
#footnotes h2 {
display: none;
}
@media screen and (max-width: 1200px) {
#footnotes {
position: static;
left: 0;
right: 0;
bottom: 0;
width: 100%;
max-height: 30%;
overflow: auto;
padding: 10px;
font-size: 14px;
z-index: 9999;
}
}
/*]]>*/-->
</style>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href=""> UP </a>
|
<a accesskey="H" href="index.html"> HOME </a>
</div><div id="content" class="content">
<h1 class="title">+emacs+添加农历纪念日</h1>
<p>
<span class="timestamp-wrapper"><span class="timestamp">[2024-04-26 周五 09:00]</span></span><br />
</p>
<p>
纪念日可以显示在 <code>org-agenda</code> 中。要添加公历的纪念日,可以在 <code>org-agenda-files</code> 的某一文件中新建一行,输入以下代码<br />
</p>
<div class="org-src-container">
<pre class="src src-elisp">%%<span style="color: #458588;">(</span>diary-anniversary 10 1 1949<span style="color: #458588;">)</span> 新中国第 %d 个公历生日
</pre>
</div>
<p>
到了10月1日,就会在 <code>org-agenda</code> 中当天日程最下方显示为:<br />
</p>
<div class="org-src-container">
<pre class="src src-nil">新中国第 75 个公历生日
</pre>
</div>
<p>
添加农历纪念日需要用到另一个函数 <code>diary-chinese-anniversary</code> ,但这个函数接受的第三个可选参数 <code>year</code> 是黄帝纪年的第几次循环的第几个项拼接起来的,不能直接填入公元年份。所以需要做如下变化:<br />
</p>
<p>
添加函数<br />
</p>
<div class="org-src-container">
<pre class="src src-elisp"><span style="color: #458588;">(</span><span style="color: #9d0006;">defun</span> <span style="color: #b57614;">my/chinese-year</span> <span style="color: #b16286;">(</span>lunar-month lunar-day year<span style="color: #b16286;">)</span>
<span style="color: #b16286;">(</span>+ <span style="color: #8ec07c;">(</span>* 100 <span style="color: #d65d0e;">(</span>car <span style="color: #458588;">(</span>calendar-chinese-from-absolute <span style="color: #b16286;">(</span>calendar-absolute-from-gregorian <span style="color: #8ec07c;">(</span>diary-make-date lunar-month lunar-day year<span style="color: #8ec07c;">)</span><span style="color: #b16286;">)</span><span style="color: #458588;">)</span><span style="color: #d65d0e;">)</span><span style="color: #8ec07c;">)</span>
<span style="color: #8ec07c;">(</span>cadr <span style="color: #d65d0e;">(</span>calendar-chinese-from-absolute <span style="color: #458588;">(</span>calendar-absolute-from-gregorian <span style="color: #b16286;">(</span>diary-make-date lunar-month lunar-day year<span style="color: #b16286;">)</span><span style="color: #458588;">)</span><span style="color: #d65d0e;">)</span><span style="color: #8ec07c;">)</span><span style="color: #b16286;">)</span><span style="color: #458588;">)</span>
</pre>
</div>
<p>
然后使用以下代码<br />
</p>
<div class="org-src-container">
<pre class="src src-elisp">%%<span style="color: #458588;">(</span>diary-chinese-anniversary 8 10 <span style="color: #b16286;">(</span>my/chinese-year 8 10 1949<span style="color: #b16286;">)</span><span style="color: #458588;">)</span> 新中国第 %d 个农历生日
</pre>
</div>
</div>
<div id="postamble" class="status">
<p>▲ 编辑于 <span class="timestamp-wrapper"><span class="timestamp">[2024-12-31 周二 15:28]</span></span> | © Published by <a href="https://www.gnu.org/software/emacs/">Emacs</a> 31.0.50 (<a href="https://orgmode.org">Org</a> mode 9.7.18) on <span class="timestamp-wrapper"><span class="timestamp">[2025-01-02 周四 15:00]</span></span> | <a href="https://tomoemami.github.io/rss.xml">RSS</a></p>
</div>
</body>
</html>