From mboxrd@z Thu Jan 1 00:00:00 1970 From: info@s-hahn.de Subject: [PATCH] Added command in org-agenda-bulk-action to copy marked entries to a new buffer. Date: Tue, 20 Jul 2010 10:22:05 +0200 Message-ID: <20100720082205.GB4680@pille.home> References: <1279611661-6628-1-git-send-email-info@s-hahn.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Received: from [140.186.70.92] (port=37905 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ob85f-0006tI-Cw for emacs-orgmode@gnu.org; Tue, 20 Jul 2010 04:22:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ob85c-00061P-8F for emacs-orgmode@gnu.org; Tue, 20 Jul 2010 04:22:14 -0400 Received: from moutng.kundenserver.de ([212.227.126.186]:55681) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ob85b-000618-DI for emacs-orgmode@gnu.org; Tue, 20 Jul 2010 04:22:12 -0400 Received: from pille.home (localhost [127.0.0.1]) by pille.home (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id o6K8M5nv008293 for ; Tue, 20 Jul 2010 10:22:05 +0200 Received: (from hs@localhost) by pille.home (8.14.3/8.14.3/Submit) id o6K8M5m6008292 for emacs-orgmode@gnu.org; Tue, 20 Jul 2010 10:22:05 +0200 Content-Disposition: inline In-Reply-To: <1279611661-6628-1-git-send-email-info@s-hahn.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org To print all org items which are shown in agenda buffer, a new command has been added to org-agenda-bulk-action which copies all marked enntries to an new buffer. Signed-off-by: Stefan-W. Hahn --- doc/org.texi | 2 ++ lisp/org-agenda.el | 30 +++++++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 1 deletions(-) diff --git a/doc/org.texi b/doc/org.texi index 27d1874..5bbb5d1 100644 --- a/doc/org.texi +++ b/doc/org.texi @@ -7857,6 +7857,8 @@ these special timestamps. @example r @r{Prompt for a single refile target and move all entries. The entries} @r{will no longer be in the agenda, refresh (@kbd{g}) to bring them back.} +c @r{Copy all marked entries to the buffer *org-temp*. If the buffer does not} + @r{exist it will be created.} $ @r{Archive all selected entries.} A @r{Archive entries by moving them to their respective archive siblings.} t @r{Change TODO state. This prompts for a single TODO keyword and} diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 191ee52..0eabe09 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7466,13 +7466,38 @@ This will remove the markers, and the overlays." (setq org-agenda-bulk-marked-entries nil) (org-agenda-bulk-remove-overlays (point-min) (point-max))) +(defun org-agenda-copy-marked-items () + "Copy all marked items to buffer *org-temp*. If buffer does not +exist, create it." + (let* ((marker (or (org-get-at-bol 'org-hd-marker) + (org-agenda-error))) + (buffer (marker-buffer marker)) + (dbuf (get-buffer-create "*org-temp*"))) + (with-current-buffer buffer + (save-excursion + (save-restriction + (widen) + (goto-char marker) + (org-copy-subtree 1) + (set-buffer dbuf) + (org-mode) + (widen) + (goto-char (point-max)) + (if (not (bolp)) (newline)) + (org-paste-subtree 1) + (show-all) + (when (featurep 'org-inlinetask) + (org-inlinetask-remove-END-maybe)) + (message "Copied to \"%s\"" (buffer-name dbuf)) + (switch-to-buffer dbuf)))))) + (defun org-agenda-bulk-action (&optional arg) "Execute an remote-editing action on all marked entries. The prefix arg is passed through to the command if possible." (interactive "P") (unless org-agenda-bulk-marked-entries (error "No entries are marked")) - (message "Bulk: [r]efile [$]archive [A]rch->sib [t]odo [+/-]tag [s]chedule [d]eadline") + (message "Bulk: [r]efile [c]opy [$]archive [A]rch->sib [t]odo [+/-]tag [s]chedule [d]eadline") (let* ((action (read-char-exclusive)) (org-log-refile (if org-log-refile 'time nil)) (entries (reverse org-agenda-bulk-marked-entries)) @@ -7500,6 +7525,9 @@ The prefix arg is passed through to the command if possible." (setq cmd (list 'org-agenda-refile nil (list 'quote rfloc) t) redo-at-end t)) + ((equal action ?c) + (setq cmd '(org-agenda-copy-marked-items))) + ((equal action ?t) (setq state (org-icompleting-read "Todo state: " -- 1.7.2.rc2