From ef560bb1d546766e64b666b16377c3b06d4c1ce1 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Tue, 28 Oct 2025 15:10:59 +0100 Subject: emacs/niri: Add agenda shortcut --- gui/conf/init.el | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'gui/conf/init.el') diff --git a/gui/conf/init.el b/gui/conf/init.el index 3c2cfb4..af4bd71 100644 --- a/gui/conf/init.el +++ b/gui/conf/init.el @@ -285,6 +285,33 @@ ((org-agenda-overriding-header "Top Priorities"))) (agenda "" nil))))) +(defcustom custom/org-agenda-frame-name "**Agenda**" + "Customize dedicated frame name to launch `org-agenda' in." + :type 'string) + +(defun custom/org-agenda-frame (command) + "Invoke `org-agenda' in a dedicated Emacs frame. + This function is designed to be called from a shell script using `emacsclient'. + If the dedicated frame already exists, we will use it, otherwise we will create a + new frame. + Finally, the dedicated frame will be deleted up after `org-agenda' finalizes." + (interactive '(nil)) + (if (not (equal custom/org-agenda-frame-name (frame-parameter nil 'name))) + (make-frame '((name . custom/org-agenda-frame-name)))) + (select-frame-by-name custom/org-agenda-frame-name) + (delete-other-windows) + (defun org-agenda-quit--clean-up () + "Close the frame after `org-agenda-quit'." + (advice-remove 'org-agenda 'delete-other-windows) + (advice-remove 'org-agenda-quit 'org-agenda-quit--clean-up) + (advice-remove 'org-agenda-Quit 'org-agenda-quit--clean-up) + (select-frame-by-name custom/org-agenda-frame-name) + (delete-frame nil t)) + (advice-add 'org-agenda-quit :after #'org-agenda-quit--clean-up) + (advice-add 'org-agenda-Quit :after #'org-agenda-quit--clean-up) + (advice-add 'org-agenda :after #'delete-other-windows) + (org-agenda nil command)) + (use-package org-fragtog :ensure t :config -- cgit v1.2.3