emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Regex Speedup for org-refresh-category-properties.
@ 2014-07-29  3:41 Malcolm Purvis
  2014-07-29 13:23 ` Bastien
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Malcolm Purvis @ 2014-07-29  3:41 UTC (permalink / raw)
  To: emacs-orgmode


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>

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-07-30  7:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-29  3:41 Regex Speedup for org-refresh-category-properties Malcolm Purvis
2014-07-29 13:23 ` 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

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).