emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Fabrice Niessen <fni-news@pirilampo.org>
Cc: emacs-orgmode@gnu.org, 16832@debbugs.gnu.org
Subject: Re: bug#16832: Emacs goes crazy when deleting lines
Date: Sat, 15 Mar 2014 17:47:58 +0200	[thread overview]
Message-ID: <83y50bbh01.fsf@gnu.org> (raw)
In-Reply-To: <861ty4ojm1.fsf@somewhere.org>

> From: Fabrice Niessen <fni-news@pirilampo.org>
> Cc: 16832@debbugs.gnu.org, emacs-orgmode <emacs-orgmode@gnu.org>
> 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%
>    - #<compiled 0xe22f27>                                        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%
>                    - #<lambda 0x1741100e>                        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%
     - #<compiled 0xe22f27>                                        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.

  reply	other threads:[~2014-03-15 15:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <86d2igl9x3.fsf@somewhere.org>
     [not found] ` <mailman.15712.1393002495.10748.bug-gnu-emacs@gnu.org>
     [not found]   ` <861tys93qy.fsf@somewhere.org>
     [not found]     ` <mailman.15925.1393259354.10748.bug-gnu-emacs@gnu.org>
     [not found]       ` <86eh2r4ipj.fsf@somewhere.org>
     [not found]         ` <mailman.16008.1393345635.10748.bug-gnu-emacs@gnu.org>
     [not found]           ` <86bnxugmkv.fsf@somewhere.org>
     [not found]             ` <83txbly9xq.fsf@gnu.org>
     [not found]               ` <86y50xirtv.fsf@somewhere.org>
     [not found]                 ` <mailman.16142.1393444275.10748.bug-gnu-emacs@gnu.org>
     [not found]                   ` <86d2igl9x3.fsf-oHC15RC7JGTNLxjTenLetw@public.gmane.org>
2014-03-14 16:00                     ` bug#16832: Emacs goes crazy when deleting lines Fabrice Niessen
2014-03-15 15:47                       ` Eli Zaretskii [this message]
2014-03-15 16:17                         ` Nicolas Goaziou
2014-03-15 17:36                           ` Eli Zaretskii
2014-03-15 17:57                             ` Nicolas Goaziou
     [not found]                           ` <87ob17sag9.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-03-20 11:33                             ` Fabrice Niessen
2014-03-17 14:57                       ` Stefan
     [not found]                         ` <jwvsiqg6fn6.fsf-monnier+emacsbugs-mXXj517/zsQ@public.gmane.org>
2014-03-17 21:29                           ` Fabrice Niessen
2014-03-17 23:28                             ` Stefan

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=83y50bbh01.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=16832@debbugs.gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=fni-news@pirilampo.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).