summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2011-07-11 21:48:44 +0200
committerBastien Guerry <bzg@altern.org>2011-07-12 08:31:36 +0200
commit1029a9251741c2cdf10281866a2fbbdaf2e1cb25 (patch)
tree3c99904de6d937b43b7ba5a2f41aadeab2d5de16
parent0b0684aa95c35085217bf17f15c825dab7f3a298 (diff)
downloadorg-mode-1029a9251741c2cdf10281866a2fbbdaf2e1cb25.tar.gz
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.
-rw-r--r--lisp/org-agenda.el25
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: "