emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Malcolm Purvis <malcolm@purvis.id.au>
To: emacs-orgmode@gnu.org
Subject: Regex Speedup for org-refresh-category-properties.
Date: Tue, 29 Jul 2014 13:41:14 +1000	[thread overview]
Message-ID: <m261igx25h.fsf@purvis.id.au> (raw)


I use the master version of org, and some months ago the time required
to generate my custom agenda view sky rocketed.  I've found that 90% of
the time was being spent in the call to re-search-forward in
org-refresh-category-properties.  The patch below speeds up the regular
expression search and makes the generation of my agenda as fast as
before.

Malcolm

diff --git a/lisp/org.el b/lisp/org.el
index 7e30061..2fc6854 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9474,7 +9474,7 @@ The refresh happens only for the current tree (not subtree)."
 	 (goto-char (point-min))
 	 (put-text-property (point) (point-max) 'org-category def-cat)
 	 (while (re-search-forward
-		 "^[ \t]*\\(#\\+CATEGORY:\\|[ \t]*:CATEGORY:\\)\\(.*\\)" nil t)
+		 "^[ \t]*\\(#\\+CATEGORY:\\|*:CATEGORY:\\)\\(.*\\)" nil t)
 	   (setq pos (match-end 0)
 		 optionp (equal (char-after (match-beginning 0)) ?#)
 		 cat (org-trim (match-string 2)))

-- 
	       Malcolm Purvis <malcolm@purvis.id.au>

             reply	other threads:[~2014-07-29  3:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-29  3:41 Malcolm Purvis [this message]
2014-07-29 13:23 ` Regex Speedup for org-refresh-category-properties Bastien
2014-07-29 14:47 ` Nick Dokos
2014-07-29 14:56   ` Bastien
2014-07-29 16:20 ` Achim Gratz
2014-07-29 21:28   ` Bastien
2014-07-29 23:46   ` Malcolm Purvis
2014-07-30  7:17     ` Achim Gratz

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=m261igx25h.fsf@purvis.id.au \
    --to=malcolm@purvis.id.au \
    --cc=emacs-orgmode@gnu.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).