0

Usually, I check the agenda-view with a calendar as:
1. M-x org-agenda
2. invoke calendar by strike "c"

at this moment, the focus stay on the calendar enter image description here

How could combine the two process? If C-c a a to invoke a agenda-view, a Day-agenda integrated with a calendar will be invoked and keep the cursor on the agenda's time-grid.

1 Answer 1

1

You can advice org-agenda to open the calendar and move the cursor back to the agenda. The second advice closes the calendar when you press q in the agenda.

(advice-add 'org-agenda :after
            (lambda ()
              (when (equal (buffer-name)
                           "*Org Agenda(a)*")
                (calendar)
                (other-window 1))))

(advice-add 'org-agenda-quit :before
            (lambda ()
              (let ((window (get-buffer-window calendar-buffer)))
                (when (and window (not (one-window-p window)))
                  (delete-window window)))))
4
  • What does the underscore "_" do in (lambda (_) (when (equal (buffer-name)??
    – Wizard
    Mar 13, 2020 at 8:25
  • In this case nothing. I removed it. Thanks. Where is general-advice-add defined? I don't have that.
    – jagrg
    Mar 13, 2020 at 10:52
  • general-advice-add is a compiled function defined in general.el. A drop-in replacement for advice-add.
    – Wizard
    Mar 13, 2020 at 10:57
  • This would require additional installation. I would suggest keeping advice-add for simplicity.
    – jagrg
    Mar 13, 2020 at 13:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.