From 627fb5c27515ea0b1950251475550fe175b8ca00 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sat, 20 Feb 2016 19:00:02 -0500 Subject: org-agenda: Add bulk command for deletion --- init.el | 5 ++++- lisp/km-org.el | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/init.el b/init.el index 3a8c784..0f891a0 100644 --- a/init.el +++ b/init.el @@ -313,7 +313,10 @@ (setq km/org-agenda-file-directory "~/notes/agenda/" org-agenda-files (list km/org-agenda-file-directory)) (add-hook 'org-agenda-finalize-hook #'km/org-agenda-cd-and-read-dir-locals) - (add-hook 'org-agenda-finalize-hook #'km/org-agenda-store-current-span)) + (add-hook 'org-agenda-finalize-hook #'km/org-agenda-store-current-span) + + (add-to-list 'org-agenda-bulk-custom-functions + '(?D km/org-agenda-delete-subtree))) (after 'ox-md (advice-add 'org-md-paragraph :filter-return #'km/org-md-fill-string)) :config diff --git a/lisp/km-org.el b/lisp/km-org.el index 49fa76f..74f7eb7 100644 --- a/lisp/km-org.el +++ b/lisp/km-org.el @@ -360,6 +360,16 @@ displayed in the agenda." (org-agenda-text-search-extra-files :maxlevel . 3)))) (org-refile '(4)))) +(defun km/org-delete-subtree () + (org-back-to-heading t) + (delete-region + (point) + (org-element-property :end (org-element-at-point)))) + +(defun km/org-agenda-delete-subtree () + (interactive) + (org-agenda-archive-with #'km/org-delete-subtree)) + ;;; Refiling -- cgit v1.2.3