From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Lundin Subject: [PATCH] Do not save target buffer after archiving subtree Date: Sat, 25 Nov 2017 22:00:08 -0600 Message-ID: <87d145elkn.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46982) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eIo77-0002qi-A3 for emacs-orgmode@gnu.org; Sat, 25 Nov 2017 23:00:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eIo72-00007q-5b for emacs-orgmode@gnu.org; Sat, 25 Nov 2017 23:00:17 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:49069) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eIo71-00006z-TA for emacs-orgmode@gnu.org; Sat, 25 Nov 2017 23:00:12 -0500 Received: from archair (c-73-246-123-194.hsd1.il.comcast.net [73.246.123.194]) by mail.messagingengine.com (Postfix) with ESMTPA id 4CBC67E8BF for ; Sat, 25 Nov 2017 23:00:09 -0500 (EST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org Mode --=-=-= Content-Type: text/plain The attached patch removes the call to save-buffer in org-archive-subtree. This significantly reduces the time necessary to archive a subtree, especially when archiving many subtrees in a region. Without this patch, Org Mode will save the archive buffer after each subtree is archived. If one were archiving a region of 50 trees, this would result in 50 writes to disk in quick succession. This patch makes the behavior of org-archive-subtree match that of org-refile, which does not save the target buffer after a refile. Best, Matt --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Do-not-save-target-buffer-after-archiving-subtree.patch >From 5c10b578461879d2770a85ae69c8182942074ee7 Mon Sep 17 00:00:00 2001 From: Matt Lundin Date: Sat, 25 Nov 2017 09:26:15 -0600 Subject: [PATCH] Do not save target buffer after archiving subtree * lisp/org-archive.el: (org-archive-subtree) Do not save buffer after each archive. Saving the archive buffer after archiving each subtree results in substantial slowdown and many writes to disk when archiving an active region. This brings the behavior of org-archive-subtree into line with org-refile, which does not save the target buffer after refiling. --- lisp/org-archive.el | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lisp/org-archive.el b/lisp/org-archive.el index b2e2178dc..37c5d6f62 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -381,10 +381,7 @@ direct children of this heading." (point) (concat "ARCHIVE_" (upcase (symbol-name item))) value)))) - (widen) - ;; Save and kill the buffer, if it is not the same - ;; buffer. - (unless (eq this-buffer buffer) (save-buffer))))) + (widen)))) ;; Here we are back in the original buffer. Everything seems ;; to have worked. So now run hooks, cut the tree and finish ;; up. -- 2.15.0 --=-=-=--