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

后端 未结 6 2079
失恋的感觉
失恋的感觉 2020-12-13 19:40

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

相关标签:
6条回答
  • 2020-12-13 20:00

    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.

    0 讨论(0)
  • 2020-12-13 20:01

    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

    0 讨论(0)
  • 2020-12-13 20:03

    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*")))    
    
    0 讨论(0)
  • 2020-12-13 20:03

    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.

    0 讨论(0)
  • 2020-12-13 20:14

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

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

    Enjoy.

    0 讨论(0)
  • 2020-12-13 20:24

    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)
    
    0 讨论(0)
提交回复
热议问题