From af33e3a8f4df99c6bfdca06e47d8097a72426748 Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Sun, 8 Oct 2023 00:04:46 -0400 Subject: [PATCH] Add newline before habits in agenda view --- .gitmodules | 3 +++ global.org | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ org-timeline | 1 + 3 files changed, 60 insertions(+) create mode 160000 org-timeline diff --git a/.gitmodules b/.gitmodules index b82d92b..851c661 100644 --- a/.gitmodules +++ b/.gitmodules @@ -142,3 +142,6 @@ [submodule "emacs-powerthesaurus"] path = emacs-powerthesaurus url = https://github.com/SavchenkoValeriy/emacs-powerthesaurus +[submodule "org-timeline"] + path = org-timeline + url = https://github.com/Fuco1/org-timeline.git diff --git a/global.org b/global.org index fb0cf3d..9c989a3 100644 --- a/global.org +++ b/global.org @@ -22,6 +22,7 @@ ** TODO revert org-files on frame activation. What was the deal with auto-revert-mode again? +** DONE Add an empty line before habits in the daily agenda * COMMENT About indentation in this file This file will be indented with ~org-adapt-indentation~ set to t @@ -1114,6 +1115,61 @@ (setq org-use-speed-commands t) #+end_src Customize the agenda interface a bit + - newline before habits + #+begin_src emacs-lisp + (defun wilder/insert-before-first (pred el list &optional base) + "Returns a list in which EL is inserted before the first occurrence in LIST satisfying PRED" + (if (not list) + base + (if (funcall pred (car list)) + (append base (list el) list) + (wilder/insert-before-first pred el (cdr list) (nconc base (list (car list))))))) + + (defun org-agenda-finalize-entries (list &optional type) + "Sort, limit and concatenate the LIST of agenda items. + The optional argument TYPE tells the agenda type." + (setq org-planner list) + (let ((max-effort (cond ((listp org-agenda-max-effort) + (cdr (assoc type org-agenda-max-effort))) + (t org-agenda-max-effort))) + (max-todo (cond ((listp org-agenda-max-todos) + (cdr (assoc type org-agenda-max-todos))) + (t org-agenda-max-todos))) + (max-tags (cond ((listp org-agenda-max-tags) + (cdr (assoc type org-agenda-max-tags))) + (t org-agenda-max-tags))) + (max-entries (cond ((listp org-agenda-max-entries) + (cdr (assoc type org-agenda-max-entries))) + (t org-agenda-max-entries)))) + (when org-agenda-before-sorting-filter-function + (setq list + (delq nil + (mapcar + org-agenda-before-sorting-filter-function list)))) + (setq list (mapcar #'org-agenda-highlight-todo list) + list (mapcar #'identity (sort list #'org-entries-lessp))) + (when max-effort + (setq list (org-agenda-limit-entries + list 'effort-minutes max-effort + (lambda (e) (or e (if org-agenda-sort-noeffort-is-high + 32767 -1)))))) + (when max-todo + (setq list (org-agenda-limit-entries list 'todo-state max-todo))) + (when max-tags + (setq list (org-agenda-limit-entries list 'tags max-tags))) + (when max-entries + (setq list (org-agenda-limit-entries list 'org-hd-marker max-entries))) + (when (and org-agenda-dim-blocked-tasks org-blocker-hook) + (setq list (mapcar #'org-agenda--mark-blocked-entry list))) + + (setq list + (wilder/insert-before-first #'(lambda (string) + (get-text-property 0 'org-habit-p string)) + "" list)) + + (mapconcat #'identity list "\n"))) + + #+end_src - Sleeker time-grid #+begin_src emacs-lisp (setq org-agenda-time-grid '((daily today require-timed) diff --git a/org-timeline b/org-timeline new file mode 160000 index 0000000..2b300ab --- /dev/null +++ b/org-timeline @@ -0,0 +1 @@ +Subproject commit 2b300abc8adc9955418fa2334f55e0610bff79f5