* Bulk cut in agenda view @ 2011-07-10 14:45 Julien Cubizolles 2011-07-11 19:50 ` Bastien ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Julien Cubizolles @ 2011-07-10 14:45 UTC (permalink / raw) To: emacs-orgmode I often need to purge DONE items from my org files. I have set up a special agenda view for checking those items and cutting some subtrees from it using bulk commands. I'm using a function adapted from the example in the manual (I've no idea if it's the best way to do it however) : ,---- | (defun bulk-cut () | (interactive "P") | (let* ((marker (or (org-get-at-bol 'org-hd-marker) | (org-agenda-error))) | (buffer (marker-buffer marker))) | (with-current-buffer buffer | (save-excursion | (save-restriction | (widen) | (goto-char marker) | (org-back-to-heading t) | (org-cut-subtree)))))) `---- Typing B f bulk-cut RET removes the selected items but it's a lot of typing for a very useful action in my opinion. Could it be added to the list of default bulk actions, with a "X" key for example ? ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Bulk cut in agenda view 2011-07-10 14:45 Bulk cut in agenda view Julien Cubizolles @ 2011-07-11 19:50 ` Bastien 2011-07-12 7:19 ` Bastien 2011-07-18 12:22 ` Bernt Hansen 2 siblings, 0 replies; 8+ messages in thread From: Bastien @ 2011-07-11 19:50 UTC (permalink / raw) To: Julien Cubizolles; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 1076 bytes --] Hi Julien, Julien Cubizolles <j.cubizolles@free.fr> writes: > I often need to purge DONE items from my org files. I have set up a > special agenda view for checking those items and cutting some subtrees > from it using bulk commands. I'm using a function adapted from the > example in the manual (I've no idea if it's the best way to do it > however) : > > ,---- > | (defun bulk-cut () > | (interactive "P") > | (let* ((marker (or (org-get-at-bol 'org-hd-marker) > | (org-agenda-error))) > | (buffer (marker-buffer marker))) > | (with-current-buffer buffer > | (save-excursion > | (save-restriction > | (widen) > | (goto-char marker) > | (org-back-to-heading t) > | (org-cut-subtree)))))) > `---- > > Typing B f bulk-cut RET removes the selected items but it's a lot of > typing for a very useful action in my opinion. > > Could it be added to the list of default bulk actions, with a "X" key > for example ? Please test this patch and try to set `org-agenda-bulk-custom-functions' (see the docstring). Thanks for bringing this up! [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org-agenda.el-New-variable-for-custom-bulk-action-fu.patch --] [-- Type: text/x-patch, Size: 2382 bytes --] From 0c90c476015f4b9e20199df30652bb341fd0d811 Mon Sep 17 00:00:00 2001 From: Bastien Guerry <bzg@altern.org> Date: Mon, 11 Jul 2011 21:48:44 +0200 Subject: [PATCH] org-agenda.el: New variable for custom bulk action functions. * org-agenda.el (org-agenda-bulk-custom-functions): New variable for custom bulk action functions. (org-agenda-bulk-action): Use it. Thanks to Julien Cubizolles for triggering this idea. --- lisp/org-agenda.el | 25 ++++++++++++++++++++++++- 1 files changed, 24 insertions(+), 1 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 37f8e84..4209b45 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -1695,6 +1695,19 @@ the lower-case version of all tags." :group 'org-agenda :type 'function) +(defcustom org-agenda-bulk-custom-functions nil + "Alist of characters and custom functions for bulk action. +For example, this value makes those two functions available: + + '((?R set-category) + (?C bulk-cut)) + +With selected entries in an agenda buffer, `B R' will execute +set-category on the selected entries. Note that functions in +this alist don't need to be quoted." + :type 'alist + :group 'org-agenda) + (eval-when-compile (require 'cl)) (require 'org) @@ -8149,7 +8162,13 @@ The prefix arg is passed through to the command if possible." org-agenda-bulk-marked-entries) ;; Prompt for the bulk command - (message "Bulk: [r]efile [$]arch [A]rch->sib [t]odo [+/-]tag [s]chd [S]catter [d]eadline [f]unction") + (message (concat "Bulk: [r]efile [$]arch [A]rch->sib [t]odo" + " [+/-]tag [s]chd [S]catter [d]eadline [f]unction" + (when org-agenda-bulk-custom-functions + (concat " Custom: [" + (mapconcat (lambda(f) (char-to-string (car f))) + org-agenda-bulk-custom-functions "") + "]")))) (let* ((action (read-char-exclusive)) (org-log-refile (if org-log-refile 'time nil)) (entries (reverse org-agenda-bulk-marked-entries)) @@ -8243,6 +8262,10 @@ The prefix arg is passed through to the command if possible." (org-agenda-schedule nil time)) (error nil))))))) + ((assoc action org-agenda-bulk-custom-functions) + (setq cmd (list (cadr (assoc action org-agenda-bulk-custom-functions))) + redo-at-end t)) + ((equal action ?f) (setq cmd (list (intern (org-icompleting-read "Function: " -- 1.7.5.2 [-- Attachment #3: Type: text/plain, Size: 14 bytes --] -- Bastien ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: Bulk cut in agenda view 2011-07-10 14:45 Bulk cut in agenda view Julien Cubizolles 2011-07-11 19:50 ` Bastien @ 2011-07-12 7:19 ` Bastien 2011-07-14 10:59 ` Julien Cubizolles 2011-07-18 12:22 ` Bernt Hansen 2 siblings, 1 reply; 8+ messages in thread From: Bastien @ 2011-07-12 7:19 UTC (permalink / raw) To: Julien Cubizolles; +Cc: emacs-orgmode Hi Julien, I've applied the patch I proposed. Please report any problem about it. Thanks, -- Bastien ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Bulk cut in agenda view 2011-07-12 7:19 ` Bastien @ 2011-07-14 10:59 ` Julien Cubizolles 2011-07-14 15:45 ` Bastien 0 siblings, 1 reply; 8+ messages in thread From: Julien Cubizolles @ 2011-07-14 10:59 UTC (permalink / raw) To: Bastien; +Cc: emacs-orgmode Bastien <bzg@altern.org> writes: > Hi Bastien > I've applied the patch I proposed. Please report any problem > about it. You beat me to it, I hadn't gotten the chance to give it a try. I just did and it just works. Thanks. Julien. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Bulk cut in agenda view 2011-07-14 10:59 ` Julien Cubizolles @ 2011-07-14 15:45 ` Bastien 0 siblings, 0 replies; 8+ messages in thread From: Bastien @ 2011-07-14 15:45 UTC (permalink / raw) To: Julien Cubizolles; +Cc: emacs-orgmode Julien Cubizolles <j.cubizolles@free.fr> writes: > Bastien <bzg@altern.org> writes: > >> Hi Bastien > >> I've applied the patch I proposed. Please report any problem >> about it. > > You beat me to it, I hadn't gotten the chance to give it a try. I just > did and it just works. Thanks. Thanks for confirming it works! -- Bastien ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Bulk cut in agenda view 2011-07-10 14:45 Bulk cut in agenda view Julien Cubizolles 2011-07-11 19:50 ` Bastien 2011-07-12 7:19 ` Bastien @ 2011-07-18 12:22 ` Bernt Hansen 2011-07-19 18:52 ` Julien Cubizolles 2 siblings, 1 reply; 8+ messages in thread From: Bernt Hansen @ 2011-07-18 12:22 UTC (permalink / raw) To: Julien Cubizolles; +Cc: emacs-orgmode Julien Cubizolles <j.cubizolles@free.fr> writes: > I often need to purge DONE items from my org files. I have set up a > special agenda view for checking those items and cutting some subtrees > from it using bulk commands. I'm using a function adapted from the > example in the manual (I've no idea if it's the best way to do it > however) : Hi Julien, Could you describe your use-case for this bulk cut function? Is this bulk cut function destructive (ie. it deletes content from your org files permanently) - wouldn't archiving (to another file) give you the same end result for your org file but also allow searching for the old content alter in case you archive (cut) too early or find you need to dig into some old history for a project. Regards, -- Bernt ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Bulk cut in agenda view 2011-07-18 12:22 ` Bernt Hansen @ 2011-07-19 18:52 ` Julien Cubizolles 2011-07-19 18:52 ` Bernt Hansen 0 siblings, 1 reply; 8+ messages in thread From: Julien Cubizolles @ 2011-07-19 18:52 UTC (permalink / raw) To: Bernt Hansen; +Cc: emacs-orgmode Bernt Hansen <bernt@norang.ca> writes: > Hi Julien, > > Could you describe your use-case for this bulk cut function? > > Is this bulk cut function destructive (ie. it deletes content from your > org files permanently) Yes, it is destructive. I use it for todo items like buying groceries for which there is no need to archive. ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Bulk cut in agenda view 2011-07-19 18:52 ` Julien Cubizolles @ 2011-07-19 18:52 ` Bernt Hansen 0 siblings, 0 replies; 8+ messages in thread From: Bernt Hansen @ 2011-07-19 18:52 UTC (permalink / raw) To: Julien Cubizolles; +Cc: emacs-orgmode Julien Cubizolles <j.cubizolles@free.fr> writes: > Bernt Hansen <bernt@norang.ca> writes: > >> Hi Julien, >> >> Could you describe your use-case for this bulk cut function? >> >> Is this bulk cut function destructive (ie. it deletes content from your >> org files permanently) > > Yes, it is destructive. I use it for todo items like buying groceries > for which there is no need to archive. Thanks for the clarification. Regards, -- Bernt ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-07-19 18:53 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-07-10 14:45 Bulk cut in agenda view Julien Cubizolles 2011-07-11 19:50 ` Bastien 2011-07-12 7:19 ` Bastien 2011-07-14 10:59 ` Julien Cubizolles 2011-07-14 15:45 ` Bastien 2011-07-18 12:22 ` Bernt Hansen 2011-07-19 18:52 ` Julien Cubizolles 2011-07-19 18:52 ` Bernt Hansen
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.