如何在 Emacs 启动时显示 Org 模式议程?

发布于 2024-08-16 12:18:31 字数 139 浏览 4 评论 0原文

我希望当我打开 Emacs 时 Org 模式议程能够自动显示我今天要做的事情。 org-agenda 命令是交互式的,因此它似乎不太适合此目的。

有没有办法在 Emacs 启动时显示 Org 模式议程?

谢谢,

康纳

I would like the Org-mode agenda to automatically show what I have to do today when I open Emacs. The org-agenda command is interactive, so it doesn't seem to work well for this purpose.

Is there a way to show the Org-mode agenda on Emacs start-up?

Thanks,

Conor

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

风渺 2024-08-23 12:18:31

您可以使用 after-init-hook 在初始化完成后运行一段代码。要在 init 后运行 (org-agenda-list),请使用:

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

You can use after-init-hook to run a piece of code after initialization has finished. To run (org-agenda-list) after init, use:

(add-hook 'after-init-hook 'org-agenda-list)
私野 2024-08-23 12:18:31

这对我有用(在 .emacs 中):

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

没有第一行,启动屏幕“覆盖”了议程;如果没有第三个,暂存缓冲区仍然可见。

This works for me (in .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.

浅浅淡淡 2024-08-23 12:18:31

挂钩的一种替代方法是设置 initial-buffer-choice 变量。如果挂钩上有多个缓冲区或多个函数,这尤其有用。该变量上的函数需要返回一个缓冲区。天真地这可能是:

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

One alternative to the hook is to set the initial-buffer-choice variable. 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*")))    
海风掠过北极光 2024-08-23 12:18:31

尝试(org-agenda-list)。如果您只想今天,(org-agenda-list 1)

当然,apropos 是你的朋友。 Ch Ca org-agenda(或任何命令)将向您显示有关该命令的有用信息。

Try (org-agenda-list). If you just want today, (org-agenda-list 1).

And of course, apropos is your friend. C-h C-a org-agenda (or whatever command) will show you useful info on that command.

抚你发端 2024-08-23 12:18:31

我有一个 bash 别名来启动 emacs 并打开议程:


别名 org='/usr/bin/emacs --funcall org-agenda-list &'
享受吧

I have a bash alias to start emacs with the Agenda open:


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

Enjoy.

王权女流氓 2024-08-23 12:18:31

这并不完全是在启动时,但我让 Emacs 保持运行,所以我需要一种不同的方法

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

感谢 https://stackoverflow.com/a/ 14947354/217408

It is not exactly at startup, but I keep Emacs running so I need a different approach

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

Credits to https://stackoverflow.com/a/14947354/217408

强辩 2024-08-23 12:18:31

当 emacs 守护进程创建客户端时,您可以使用 server-after-make-frame-hook 运行任何命令 -

(use-hook 'server-after-make-frame-hook 'org-agenda-list)

这对我来说非常适合,因为每当我打开 emacsclient 时,就会出现 org 议程,这正是我想要。

如果以下钩子更适合您的需求,您还可以查看它们-
https://www.gnu.org/software/ emacs/manual/html_node/elisp/Standard-Hooks.html

You can use the server-after-make-frame-hook to run any command when the emacs daemon creates a client-

(use-hook 'server-after-make-frame-hook 'org-agenda-list)

This works perfectly for me because whenever I open emacsclient, org agenda appears which is exactly what I wanted.

You can also look at the following hooks if they suit your needs more-
https://www.gnu.org/software/emacs/manual/html_node/elisp/Standard-Hooks.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文