简体   繁体   English

如何在 Emacs 启动时显示 Org-mode 议程?

[英]How can I show the Org-mode agenda on Emacs start-up?

I would like the Org-mode agenda to automatically show what I have to do today when I open Emacs.我希望 Org-mode 议程在我打开 Emacs 时自动显示我今天必须做的事情。 The org-agenda command is interactive, so it doesn't seem to work well for this purpose. org-agenda 命令是交互式的,因此它似乎不适用于此目的。

Is there a way to show the Org-mode agenda on Emacs start-up?有没有办法在 Emacs 启动时显示 Org-mode 议程?

Thanks,谢谢,

Conor康纳

You can use after-init-hook to run a piece of code after initialization has finished.初始化完成after-init-hook您可以使用after-init-hook运行一段代码。 To run (org-agenda-list) after init, use:要在 init 之后运行(org-agenda-list) ,请使用:

(add-hook 'after-init-hook 'org-agenda-list)

This works for me (in .emacs ):这对我.emacs (在.emacs ):

(setq inhibit-splash-screen t)
(org-agenda-list)
(delete-other-windows)

Without the first line, the splash screen "covered" the agenda;没有第一行,启动画面“覆盖”了议程; without the third one, the scratch buffer remained visible.如果没有第三个,暂存缓冲区仍然可见。

One alternative to the hook is to set the initial-buffer-choice variable.钩子的一种替代方法是设置initial-buffer-choice变量。 This is particularly useful if there are multiple buffers or a number of functions on the hook.如果挂钩上有多个缓冲区或多个函数,这将特别有用。 The function on this variable needs to return a buffer.此变量上的函数需要返回一个缓冲区。 Naively this might be:天真地这可能是:

(setq initial-buffer-choice (lambda ()
    (org-agenda-list 1)
    (get-buffer "*Org Agenda*")))    

Try (org-agenda-list) .试试(org-agenda-list) If you just want today, (org-agenda-list 1) .如果你只是想要今天, (org-agenda-list 1)

And of course, apropos is your friend.当然,apropos 是你的朋友。 Ch Ca org-agenda (or whatever command) will show you useful info on that command. Ch Ca org-agenda (或任何命令)将显示有关该命令的有用信息。

I have a bash alias to start emacs with the Agenda open:我有一个 bash 别名,可以在 Agenda 打开的情况下启动 emacs:

alias org='/usr/bin/emacs --funcall org-agenda-list &'

Enjoy.享受。

It is not exactly at startup, but I keep Emacs running so I need a different approach它并不完全在启动时,但我保持 Emacs 运行,所以我需要一种不同的方法

(require 'midnight)
(midnight-delay-set 'midnight-delay "7:30am")
(add-hook 'midnight-hook 'org-agenda-list)

Credits to https://stackoverflow.com/a/14947354/217408归功于https://stackoverflow.com/a/14947354/217408

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

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