diff options
| author | Yuchen Pei <id@ypei.org> | 2026-11-08 18:00:32 +1100 |
|---|---|---|
| committer | Yuchen Pei <id@ypei.org> | 2026-11-08 18:00:32 +1100 |
| commit | 93037b3fe903d9e3c3ff97269ad3d8fabb8ab260 (patch) | |
| tree | e676f648432a3f87bb054a526f7653a14e1e57cf /misc | |
| parent | 37c64109dc07a16417a42931c4eb4c682efc08ad (diff) | |
Diffstat (limited to 'misc')
| -rw-r--r-- | misc/.bashrc | 1 | ||||
| -rwxr-xr-x | misc/bin/org-a-sync.el | 27 |
2 files changed, 22 insertions, 6 deletions
diff --git a/misc/.bashrc b/misc/.bashrc index 2d44565..f64de44 100644 --- a/misc/.bashrc +++ b/misc/.bashrc @@ -140,7 +140,6 @@ alias which='alias | which -i' alias chx="chmod +x" # dedicated emacs instances for emms and erc, see `my-profile' in my # emacs init files -alias emms='EMACS_PROFILE=emms emacs' alias erc='EMACS_PROFILE=erc emacs' # Safer default for cp, mv, rm. These will print a verbose output of diff --git a/misc/bin/org-a-sync.el b/misc/bin/org-a-sync.el index 7123f04..4ed9052 100755 --- a/misc/bin/org-a-sync.el +++ b/misc/bin/org-a-sync.el @@ -7,6 +7,21 @@ (my-setq-from-local my-org-agenda-and-next-export-files) (my-setq-from-local org-agenda-files) +(defvar my-org-agenda-export-seen (make-hash-table :test #'equal) + "Hash table of headings already shown in the current agenda run.") + +(defun my-org-agenda-drop-seen (item) + "Return agenda ITEM, or nil if its heading was already shown. +Meant for `org-agenda-before-sorting-filter-function'. Items without +an `org-hd-marker' (diary entries and the like) are always kept." + (let ((m (get-text-property 0 'org-hd-marker item))) + (if (not (and my-org-agenda-export-seen (markerp m) (marker-buffer m))) + item + (let ((key (cons (marker-buffer m) (marker-position m)))) + (unless (gethash key my-org-agenda-export-seen) + (puthash key t my-org-agenda-export-seen) + item))))) + (progn (setq org-todo-keywords '((sequence "TODO(t)" "DOIN(i)" "WAIT(w)" "|" @@ -16,16 +31,18 @@ org-enforce-todo-checkbox-dependencies nil) (setq org-use-fast-todo-selection 'expert) (setq org-agenda-custom-commands - `(("A" "Agenda and next" - ((agenda "" + `(("E" "Agenda and next (export: each heading once)" + ((agenda "" ((org-agenda-span 32) ;; only works when `org-agenda-start-on-weekday' ;; is nil (org-agenda-start-day "-2d"))) (tags-todo "PRIORITY=\"A\"" nil)) - nil - ,my-org-agenda-and-next-export-files - ))) + ;; Command-level settings are evaluated once per run, so both + ;; blocks share one fresh table. + ((org-agenda-before-sorting-filter-function + #'my-org-agenda-drop-seen)) + ,my-org-agenda-and-next-export-files))) (setq large-file-warning-threshold nil) (setq org-agenda-todo-ignore-time-comparison-use-seconds t) (setq org-agenda-todo-ignore-deadlines 'all) |
