emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <n.goaziou@gmail.com>
To: news1142@Karl-Voit.at
Cc: emacs-orgmode@gnu.org
Subject: Re: A file with 'org-mode rot'?
Date: Sun, 13 Apr 2014 19:49:17 +0200	[thread overview]
Message-ID: <87siphglwi.fsf@gmail.com> (raw)
In-Reply-To: <2014-04-13T16-35-36@devnull.Karl-Voit.at> (Karl Voit's message of "Sun, 13 Apr 2014 16:53:35 +0200")

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

Karl Voit <devnull@Karl-Voit.at> writes:

> However, my (long) Org-mode files with the performance issues is not
> a situation I am satisfied. Last week I presented Org-mode at a
> Linuxdays-event here in Graz and I had to apologize for all the
> weird behavior. This was somewhat embarrassing :-(

Does this happen on stable branch?

> Sure. After a couple of minutes, I C-g and this is the output:
> http://paste.grml.org/1898/

Would the following patch improve the situation?


Regards,

-- 
Nicolas Goaziou

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-ob-exp-Improve-speed.patch --]
[-- Type: text/x-diff, Size: 2308 bytes --]

From 3b772bab6d99298844d9d05f79a12e1a9fb87a3a Mon Sep 17 00:00:00 2001
From: Nicolas Goaziou <n.goaziou@gmail.com>
Date: Sun, 13 Apr 2014 19:28:20 +0200
Subject: [PATCH] ob-exp: Improve speed

---
 lisp/ob-exp.el | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index 220a3c3..dc2bc94 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -153,20 +153,12 @@ may make them unreachable."
   (save-window-excursion
     (save-excursion
       (let ((case-fold-search t)
-	    (org-babel-exp-reference-buffer reference-buffer)
-	    (regexp (concat org-babel-inline-src-block-regexp "\\|"
-			    org-babel-lob-one-liner-regexp "\\|"
-			    "^[ \t]*#\\+BEGIN_SRC")))
+	    (org-babel-exp-reference-buffer reference-buffer))
 	(goto-char (point-min))
-	(while (re-search-forward regexp nil t)
+	(while (re-search-forward
+		"src_\\|^[ \t]*#\\+\\(call:\\|begin_src\\)\\|call_" nil t)
 	  (unless (save-match-data (org-in-commented-heading-p))
-	    (let* ((element (save-excursion
-			      ;; If match is inline, point is at its
-			      ;; end.  Move backward so
-			      ;; `org-element-context' can get the
-			      ;; object, not the following one.
-			      (backward-char)
-			      (save-match-data (org-element-context))))
+	    (let* ((element (save-match-data (org-element-context)))
 		   (type (org-element-type element))
 		   (begin (copy-marker (org-element-property :begin element)))
 		   (end (copy-marker
@@ -176,6 +168,10 @@ may make them unreachable."
 			   (point)))))
 	      (case type
 		(inline-src-block
+		 (goto-char begin)
+		 (unless (bolp) (backward-char))
+		 (looking-at org-babel-inline-src-block-regexp)
+		 (goto-char (match-end 0))
 		 (let* ((info (org-babel-parse-inline-src-block-match))
 			(params (nth 2 info)))
 		   (setf (nth 1 info)
@@ -201,6 +197,11 @@ may make them unreachable."
 		       (delete-region begin end)
 		       (insert replacement)))))
 		((babel-call inline-babel-call)
+		 (goto-char (or (org-element-property :post-affiliated element)
+				begin))
+		 (unless (bolp) (backward-char))
+		 (looking-at org-babel-lob-one-liner-regexp)
+		 (goto-char (match-end 0))
 		 (let* ((lob-info (org-babel-lob-get-info))
 			(results
 			 (org-babel-exp-do-export
-- 
1.9.2


  reply	other threads:[~2014-04-13 17:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02 12:41 A file with 'org-mode rot'? Sharon Kimble
2014-04-03 10:40 ` Karl Voit
2014-04-04  9:11   ` Eric S Fraga
2014-04-04 11:06     ` Eric S Fraga
2014-04-11  9:46       ` Bastien
2014-04-11 15:26         ` Nicolas Goaziou
2014-04-13 11:22         ` Karl Voit
2014-04-13 12:42           ` Nicolas Goaziou
2014-04-13 14:53             ` Karl Voit
2014-04-13 17:49               ` Nicolas Goaziou [this message]
2014-04-13 18:08                 ` Erik Iverson
2014-04-15  8:18                   ` Karl Voit
2014-04-14 16:34         ` Eric S Fraga
2014-11-11 16:50   ` Karl Voit
2014-11-11 20:43     ` Marco Wahl

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=87siphglwi.fsf@gmail.com \
    --to=n.goaziou@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=news1142@Karl-Voit.at \
    /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).