diff options
author | Kyle Meyer <kyle@kyleam.com> | 2021-01-30 00:18:38 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2021-06-11 23:14:14 -0400 |
commit | 339961efd7135904a6d3da09f342b9e38ce1e991 (patch) | |
tree | 4c805de71246b053ba08ec24e0a03655ea55a4d5 | |
parent | 7737204be36e973cdc4d0bd0f7b9d796824dc6fb (diff) | |
download | emacs.d-339961efd7135904a6d3da09f342b9e38ce1e991.tar.gz |
org-agenda: Use other window and pop to existing
-rw-r--r-- | init.el | 12 | ||||
-rw-r--r-- | lisp/km-org-agenda.el | 8 |
2 files changed, 18 insertions, 2 deletions
@@ -241,8 +241,8 @@ (use-package org-agenda :init (define-key km/global-org-map "a" #'org-agenda) :config - (setq org-agenda-restore-windows-after-quit t - org-agenda-window-setup 'only-window) + (setq org-agenda-restore-windows-after-quit nil) + (setq org-agenda-window-setup 'other-window) (setq org-agenda-dim-blocked-tasks nil org-agenda-inhibit-startup t org-agenda-use-tag-inheritance nil @@ -259,12 +259,19 @@ (tags priority-down category-keep) (search category-keep))) (setq org-agenda-tags-column -90) + (advice-add 'org-agenda-goto-today :around (lambda (fn &rest args) (if (org-agenda-check-type nil 'agenda) (apply fn args) (goto-char (point-min))))) + (advice-add 'org-agenda-quit :around + (lambda (fn &rest args) + (let ((org-agenda-sticky t)) + (apply fn args))) + '((name . "org-agenda-quit-bury"))) + (bind-keys :map org-agenda-mode-map ;; Bind `org-agenda-follow-mode' to same key as ;; `next-error-follow-minor-mode'. @@ -345,6 +352,7 @@ (use-package km-org-agenda :init (bind-keys :map km/global-org-map + ("a" . km/org-agenda) ("j" . km/org-goto-agenda-heading) ("m" . km/org-open-default-notes-file-inbox) ("n" . km/org-agenda-add-or-remove-file)) diff --git a/lisp/km-org-agenda.el b/lisp/km-org-agenda.el index 45518b9..e377f69 100644 --- a/lisp/km-org-agenda.el +++ b/lisp/km-org-agenda.el @@ -23,6 +23,14 @@ (require 'org-agenda) (require 'km-org) +;;;###autoload +(defun km/org-agenda (&optional arg) + (interactive "P") + (if-let ((buffer (and (not arg) + (get-buffer org-agenda-buffer-name)))) + (pop-to-buffer buffer) + (org-agenda))) + (defun km/org-agenda-cd-and-read-dir-locals () (unless (get 'org-agenda-files 'org-restrict) (setq default-directory (expand-file-name "~/notes/")) |