From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: A file with 'org-mode rot'? Date: Sun, 13 Apr 2014 19:49:17 +0200 Message-ID: <87siphglwi.fsf@gmail.com> References: <877g77aopf.fsf@talktalk.net> <2014-04-03T12-36-39@devnull.Karl-Voit.at> <877g75v4qh.fsf@ucl.ac.uk> <878url73r0.fsf@ucl.ac.uk> <877g6w2e7f.fsf@bzg.ath.cx> <2014-04-13T12-55-57@devnull.Karl-Voit.at> <87zjjph03b.fsf@gmail.com> <2014-04-13T16-35-36@devnull.Karl-Voit.at> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZOWX-0002bt-K4 for emacs-orgmode@gnu.org; Sun, 13 Apr 2014 13:49:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WZOWP-0008V7-7V for emacs-orgmode@gnu.org; Sun, 13 Apr 2014 13:48:57 -0400 Received: from mail-wg0-x231.google.com ([2a00:1450:400c:c00::231]:59730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WZOWP-0008Ur-09 for emacs-orgmode@gnu.org; Sun, 13 Apr 2014 13:48:49 -0400 Received: by mail-wg0-f49.google.com with SMTP id a1so7352315wgh.20 for ; Sun, 13 Apr 2014 10:48:47 -0700 (PDT) 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") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: news1142@Karl-Voit.at Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Karl Voit 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-ob-exp-Improve-speed.patch >From 3b772bab6d99298844d9d05f79a12e1a9fb87a3a Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou 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 --=-=-=--