summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.el12
-rw-r--r--lisp/km-org-agenda.el8
2 files changed, 18 insertions, 2 deletions
diff --git a/init.el b/init.el
index 70c7fd8..6445546 100644
--- a/init.el
+++ b/init.el
@@ -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/"))