[Emacs] Use org-agenda-transient

This commit is contained in:
Ivan Malison 2023-08-18 03:23:36 -06:00
parent 8a5af3416b
commit 4772ad922d

View File

@ -3017,8 +3017,20 @@ The following is taken from [[https://github.com/syl20bnr/spacemacs/blob/a650877
#+BEGIN_SRC emacs-lisp :tangle org-config.el #+BEGIN_SRC emacs-lisp :tangle org-config.el
(defvar imalison:org-dir "~/org") (defvar imalison:org-dir "~/org")
(use-package org (use-package org
:bind (:map org-mode-map :commands (org-mode org org-mobile-push org-mobile-pull org-agenda)
(("C-e" . end-of-visual-line))) :mode ("\\.org\\'" . org-mode)
:bind (("C-c c" . org-capture)
:map org-mode-map
(("C-e" . end-of-visual-line)
("C-c n t" . org-insert-todo-heading)
("C-c n s" . org-insert-todo-subheading)
("C-c n h" . org-insert-habit)
("C-c n m" . org-make-habit)
("C-c n l" . org-store-link)
("C-c n i" . org-insert-link)
("C-c C-t" . org-todo)
("C-c C-S-t" . org-todo-force-notes)
("M-." . elisp-slime-nav-find-elisp-thing-at-point)))
:preface :preface
(progn (progn
(require 'cl-lib) (require 'cl-lib)
@ -3040,6 +3052,20 @@ The following is taken from [[https://github.com/syl20bnr/spacemacs/blob/a650877
(add-hook 'org-mode-hook (lambda () (setq org-todo-key-trigger t))) (add-hook 'org-mode-hook (lambda () (setq org-todo-key-trigger t)))
(add-hook 'org-agenda-mode-hook 'imalison:disable-linum-mode) (add-hook 'org-agenda-mode-hook 'imalison:disable-linum-mode)
(cl-defun imalison:org-time-condition-met-p (&key (property "CREATED") (days 30) (future nil))
(let* ((property-value (org-entry-get (point) property))
(comparison-time
(if future
(time-add (current-time) (days-to-time days))
(time-subtract (current-time) (days-to-time days))))
(formatted-time-string (format-time-string "<%Y-%m-%d %H:%M>" comparison-time))
(compare-time (org-time-string-to-time formatted-time-string))
(node-time (when property-value (org-time-string-to-time property-value))))
(when node-time
(if future
(time-less-p node-time compare-time)
(time-less-p compare-time node-time)))))
(defun org-archive-if (condition-function) (defun org-archive-if (condition-function)
(if (funcall condition-function) (if (funcall condition-function)
(let ((next-point-marker (let ((next-point-marker
@ -3131,20 +3157,6 @@ The following is taken from [[https://github.com/syl20bnr/spacemacs/blob/a650877
the same tree node, and the headline of the tree node in the Org-mode file." the same tree node, and the headline of the tree node in the Org-mode file."
(interactive "P") (interactive "P")
(org-agenda-todo "DONE"))) (org-agenda-todo "DONE")))
:commands (org-mode org org-mobile-push org-mobile-pull org-agenda)
:mode ("\\.org\\'" . org-mode)
:bind (("C-c a" . org-agenda)
("C-c c" . org-capture)
:map org-mode-map
("C-c n t" . org-insert-todo-heading)
("C-c n s" . org-insert-todo-subheading)
("C-c n h" . org-insert-habit)
("C-c n m" . org-make-habit)
("C-c n l" . org-store-link)
("C-c n i" . org-insert-link)
("C-c C-t" . org-todo)
("C-c C-S-t" . org-todo-force-notes)
("M-." . elisp-slime-nav-find-elisp-thing-at-point))
:config :config
(progn (progn
(setq org-global-properties (setq org-global-properties
@ -3338,20 +3350,6 @@ The following is taken from [[https://github.com/syl20bnr/spacemacs/blob/a650877
:STYLE: habit :STYLE: habit
:END:")) :END:"))
(cl-defun imalison:org-time-condition-met-p (&key (property "CREATED") (days 30) (future nil))
(let* ((property-value (org-entry-get (point) property))
(comparison-time
(if future
(time-add (current-time) (days-to-time days))
(time-subtract (current-time) (days-to-time days))))
(formatted-time-string (format-time-string "<%Y-%m-%d %H:%M>" comparison-time))
(compare-time (org-time-string-to-time formatted-time-string))
(node-time (when property-value (org-time-string-to-time property-value))))
(when node-time
(if future
(time-less-p node-time compare-time)
(time-less-p compare-time node-time)))))
(defmacro imalison:def-agenda-pred (&rest forms) (defmacro imalison:def-agenda-pred (&rest forms)
`(lambda () `(lambda ()
(unless ,@forms (unless ,@forms
@ -3388,7 +3386,9 @@ The following is taken from [[https://github.com/syl20bnr/spacemacs/blob/a650877
((org-agenda-overriding-header "Recently Created:") ((org-agenda-overriding-header "Recently Created:")
(org-agenda-skip-function (org-agenda-skip-function
,(imalison:def-agenda-pred ,(imalison:def-agenda-pred
(imalison:org-time-condition-met-p :property "DEADLINE" :days 10)))))) (imalison:org-time-condition-met-p :days 10)))
(org-agenda-cmp-user-defined 'org-cmp-creation-times)
(org-agenda-sorting-strategy '(user-defined-down)))))
(next '(todo "NEXT")) (next '(todo "NEXT"))
(started '(todo "STARTED")) (started '(todo "STARTED"))
(missing-deadline (missing-deadline
@ -3422,6 +3422,10 @@ The following is taken from [[https://github.com/syl20bnr/spacemacs/blob/a650877
((org-agenda-overriding-header ((org-agenda-overriding-header
"At least priority C:")))))) "At least priority C:"))))))
(require 'org-agenda)
(when (fboundp 'org-agenda-transient)
(bind-key "C-c a" 'org-agenda-transient))
;; What follows is a description of the significance of each of ;; What follows is a description of the significance of each of
;; the values available in `org-todo-keywords'. All headings with ;; the values available in `org-todo-keywords'. All headings with
;; one of these keywords deal with the concept of the completion ;; one of these keywords deal with the concept of the completion