From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH] Archive subtree and move to next visible task Date: Tue, 7 Jul 2009 18:00:16 -0400 Message-ID: <1247004016-7384-1-git-send-email-bernt@norang.ca> Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MOIiO-0003EM-BY for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 18:00:40 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MOIiL-0003Dx-Qf for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 18:00:40 -0400 Received: from [199.232.76.173] (port=58758 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MOIiL-0003Dt-Nd for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 18:00:37 -0400 Received: from mho-02-ewr.mailhop.org ([204.13.248.72]:51969) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MOIiL-0005CS-AH for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 18:00:37 -0400 Received: from cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com ([99.239.148.180] helo=mail.norang.ca) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1MOIiJ-000CG5-Hs for emacs-orgmode@gnu.org; Tue, 07 Jul 2009 22:00:36 +0000 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 Cc: Bernt Hansen This skips over blank lines preceeding the next task when archiving a task or subtree. This allows us to use a keyboard macro to remember the archive key sequence incantation and skips to the next heading so we don't accidentally archive the wrong task. This fixes an issue with blank line handling. Tasks which have blank lines following them do not include the blank lines -- they are part of the following task. This moves the point forward to the next visible headline so that if we repeat the archive operation it affects the following task and not the previous one by mistake. --- This patch is available at git://git.norang.ca/org-mode for-carsten lisp/org-archive.el | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/org-archive.el b/lisp/org-archive.el index 2c55a5c..35de4f9 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -308,7 +308,9 @@ this heading." (if (eq this-buffer buffer) (concat "under heading: " heading) (concat "in file: " (abbreviate-file-name afile)))))) - (org-reveal)) + (org-reveal) + (if (looking-at "^[ \t]*$") + (outline-next-visible-heading 1))) (defun org-archive-to-archive-sibling () "Archive the current heading by moving it under the archive sibling. @@ -360,7 +362,9 @@ sibling does not exist, it will be created at the end of the subtree." (hide-subtree) (org-cycle-show-empty-lines 'folded) (goto-char pos))) - (org-reveal)) + (org-reveal) + (if (looking-at "^[ \t]*$") + (outline-next-visible-heading 1))) (defun org-archive-all-done (&optional tag) "Archive sublevels of the current tree without open TODO items. -- 1.6.3.2.198.g6096d