保存组织议程
每次计算组织议程时,我想将组织议程的输出保存到文本文件中。 这样,我可以使用外部程序(例如 Windows 上的 ATNotes 或 Linux 上的 conky)来获取此文本文件并将其显示在我的桌面上。
我怎样才能做到这一点?
I'd like to save the output of org-agenda to a text file, every time that the org-agenda is calculated. This way, I can use an external program (like ATNotes on windows or conky on linux), to pick up this text file and display it on my desktop.
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
所以我最终决定打开 emacs lisp 手册并自己解决这个问题。 我写了这段代码,看起来运行得很好! :)
编辑原因:
1)如果没有kill-buffer,defadvice会在每次执行org-todo-list时创建一个新的todo缓冲区。 这让人非常恼火。
2) 如果没有 get-buffer-create 函数,kill-buffers 第一次会失败,因为当时没有名为 todo 的缓冲区。
3)如果没有set-buffer-modified-p,该函数将不断告诉您“todo缓冲区已修改。真的杀死它吗?(y或n)”这确实会破坏整个目的。
哇! 我很高兴我真的花了时间和精力来解决这个问题! :D
So I finally decided to open the emacs lisp manual and figure this out myself. I wrote this bit of code, which seems to be working just fine! :)
EDIT REASONS:
1) Without kill-buffer, the defadvice creates a new todo buffer on every execution of org-todo-list. This gets pretty irritating.
2) Without the get-buffer-create function, kill-buffers fails the first time since there is no buffer named todo at that time.
3) Without set-buffer-modified-p, the function will keep telling you "todo buffer is modified. Really kill it? (y or n)" which would defeat the whole purpose really.
Whew! I'm so happy I actually took the time and effort to figure this out! :D
如果您想在 emacs 打开时执行此操作,只需通过
Mx save-buffer
在*Agenda*
缓冲区上调用save-buffer
> (因为 orgmode 将Cx Cs
绑定到org-save-all-org-buffer。
您可以将save-buffer
绑定到org-mode-map
如果你想通过 cron 来完成,你应该能够使用 组织模式邮件列表上的这个线程将输出通过管道传输到文件。我过去使用过这个:
If you want to do it while you have emacs open, you can just call
save-buffer
on the*Agenda*
buffer viaM-x save-buffer
(since orgmode bindsC-x C-s
toorg-save-all-org-buffer.
You could bindsave-buffer
to something else in theorg-mode-map
if you wanted.If you want to do it via a cron, you should be able to use the snippet in this thread on the org-mode mailing list to pipe the output to a file. I've used this in the past:
在你费尽心思编写这段代码(并且还使用了一些周围的建议!)之后,我觉得我对你的游行感到很高兴,但实际上这个功能已经融入了组织模式,并记录在手动的。 您需要的命令是 org-write-agenda(议程缓冲区中的 Cx Cw)。 请参阅组织模式信息中标题为“导出议程视图”的部分。
I feel like I'm raining on your parade after you went to the trouble to write this code snipped (and used a piece of around advice, too!), but actually this feature is already baked into org-mode, and documented in the manual. The command you want is
org-write-agenda
(C-x C-w in an agenda buffer). See the section of the org-mode info entitled "Exporting Agenda Views."