From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eli Zaretskii Subject: Re: bug#16832: Emacs goes crazy when deleting lines Date: Sat, 15 Mar 2014 17:47:58 +0200 Message-ID: <83y50bbh01.fsf@gnu.org> References: <86d2igl9x3.fsf@somewhere.org> <861tys93qy.fsf@somewhere.org> <86eh2r4ipj.fsf@somewhere.org> <86bnxugmkv.fsf@somewhere.org> <83txbly9xq.fsf@gnu.org> <86y50xirtv.fsf@somewhere.org> <861ty4ojm1.fsf@somewhere.org> Reply-To: Eli Zaretskii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49483) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOqoh-0007F5-G3 for emacs-orgmode@gnu.org; Sat, 15 Mar 2014 11:48:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOqob-0003AT-Lu for emacs-orgmode@gnu.org; Sat, 15 Mar 2014 11:48:07 -0400 Received: from mtaout22.012.net.il ([80.179.55.172]:59323) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOqob-00038H-EI for emacs-orgmode@gnu.org; Sat, 15 Mar 2014 11:48:01 -0400 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0N2H00300I5RUH00@a-mtaout22.012.net.il> for emacs-orgmode@gnu.org; Sat, 15 Mar 2014 17:47:59 +0200 (IST) In-reply-to: <861ty4ojm1.fsf@somewhere.org> 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: Fabrice Niessen Cc: emacs-orgmode@gnu.org, 16832@debbugs.gnu.org > From: Fabrice Niessen > Cc: 16832@debbugs.gnu.org, emacs-orgmode > Date: Fri, 14 Mar 2014 17:00:54 +0100 > > I realized that Emacs did not into an infloop, but simply gave me back > control after a very long time (more than 2 mins). Good news #1. > > I thought at using the profiler of Emacs 24, and it gives meaningful > results. Good news #2. > > Here they are: > > --8<---------------cut here---------------start------------->8--- > - flyspell-post-command-hook 3271 98% > - apply 3271 98% > - ad-Advice-flyspell-post-command-hook 3271 98% > - # 3271 98% > - byte-code 3271 98% > - flyspell-word 3271 98% > - org-mode-flyspell-verify 3246 97% > - if 3246 97% > - let* 3246 97% > - prog1 3053 91% > - catch 3053 91% > - while 3053 91% > - if 3053 91% > - progn 3053 91% > - setq 3053 91% > - org-element--get-next-object-candidates 3053 91% > - delq 3053 91% > - if 3053 91% > - mapcar 3053 91% > - # 3053 91% > - funcall 3053 91% > - org-element-inline-babel-call-successor 2873 86% > - save-excursion 2873 86% > if 2873 86% Thanks. So this looks like a problem with Org Mode. In particular, org-element-inline-babel-call-successor takes a lot of time in this case. That function traverses the buffer from top to bottom: (while (search-forward "call_" nil t) (save-excursion (goto-char (match-beginning 0)) (when (looking-at org-babel-inline-lob-one-liner-regexp) (throw 'exit (cons 'inline-babel-call (point))))))))) Perhaps this takes too long in such a huge buffer with such long lines. > Though, I don't understand yet why Flyspell seems to be a problem in Org > mode buffers Clearly, that's because Org functions, in particular org-mode-flyspell-verify, are called from flyspell-post-command-hook: - flyspell-post-command-hook 3271 98% - apply 3271 98% - ad-Advice-flyspell-post-command-hook 3271 98% - # 3271 98% - byte-code 3271 98% - flyspell-word 3271 98% - org-mode-flyspell-verify 3246 97% If org-mode-flyspell-verify is expensive, it is not a good idea to use it as flyspell-generic-check-word-predicate in huge Org buffers, since Flyspell will invoke it after each command. I hope Org developers will respond. Or maybe you should simply submit this bug report to Org bug tracker/list.