emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Francesco Pizzolante" <fpz-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org>
To: mailing-list-org-mode <emacs-orgmode-mXXj517/zsQ@public.gmane.org>
Subject: [PATCH] Avoid modification hooks in org-clock-sum
Date: Thu, 31 Jan 2013 10:38:01 +0100	[thread overview]
Message-ID: <878v79elqe.fsf@somewhere.org> (raw)

Hello,

This patch avoid modification hooks to be run in org-clock-sum by using
org-unmodified (instead of simply saving and restoring buffer-modified-p).

On my system, this speeds up the creation of clock reports.

I should have indented the code but I didn't in order to respect the
less-than-20-lines change (I have no copyright assignment to the FSF yet).

Regards,
 Francesco

From b328fadfbc76143ab86286f8a9939fa2c49ba186 Mon Sep 17 00:00:00 2001
From: Francesco Pizzolante <fpz-djc/iPCCuDYQheJpep6IedvLeJWuRmrY@public.gmane.org>
Date: Wed, 30 Jan 2013 17:21:42 +0100
Subject: [PATCH] Avoid Protect org-clock-sum using org-unmodified

* org-clock.el (org-clock-sum): Avoid modification hooks in org-clock-sum

TINYCHANGE
---
 lisp/org-clock.el |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index 7bd5b5a..945fcd0 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -1675,8 +1675,8 @@ each headline in the time range with point at the headline.  Headlines for
 which HEADLINE-FILTER returns nil are excluded from the clock summation.
 PROPNAME lets you set a custom text property instead of :org-clock-minutes."
   (interactive)
-  (let* ((bmp (buffer-modified-p))
-	 (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*"
+  (org-unmodified
+    (let* ((re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*"
 		     org-clock-string
 		     "[ \t]*\\(?:\\(\\[.*?\\]\\)-+\\(\\[.*?\\]\\)\\|=>[ \t]+\\([0-9]+\\):\\([0-9]+\\)\\)"))
 	 (lmax 30)
@@ -1753,8 +1753,7 @@ PROPNAME lets you set a custom text property instead of :org-clock-minutes."
 	      (setq t1 0)
 	      (loop for l from level to (1- lmax) do
 		    (aset ltimes l 0)))))))
-      (setq org-clock-file-total-minutes (aref ltimes 0)))
-    (set-buffer-modified-p bmp)))
+	(setq org-clock-file-total-minutes (aref ltimes 0))))))
 
 (defun org-clock-sum-current-item (&optional tstart)
   "Return time, clocked on current item in total."
-- 
1.7.9

             reply	other threads:[~2013-01-31  9:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-31  9:38 Francesco Pizzolante [this message]
2013-01-31 13:19 ` [PATCH] Avoid modification hooks in org-clock-sum Bastien
     [not found]   ` <87ip6djxrj.fsf-E3UqQZAQFPqWIDz0JBNUog@public.gmane.org>
2013-01-31 15:21     ` Francesco Pizzolante
2013-01-31 18:10       ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878v79elqe.fsf@somewhere.org \
    --to=fpz-djc/ipccudyqhejpep6iedvlejwurmry@public.gmane.org \
    --cc=emacs-orgmode-mXXj517/zsQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).