diff options
Diffstat (limited to 'gui/conf/init.el')
| -rw-r--r-- | gui/conf/init.el | 27 |
1 files changed, 27 insertions, 0 deletions
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 |
