[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [patch suggestion] Mitigating the poor Emacs performance on huge org

From: Nicolas Goaziou
Subject: Re: [patch suggestion] Mitigating the poor Emacs performance on huge org files: Do not use overlays for PROPERTY and LOGBOOK drawers
Date: Tue, 12 May 2020 12:03:33 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Completing myself,

Nicolas Goaziou <address@hidden> writes:

> Each syntactical element has a "sensitive part", a particular area that
> can change the nature of the element when it is altered. Luckily drawers
> (and blocks) are sturdy. For a drawer, there are three things to check:
> 1. the opening line must match org-drawer-regexp
> 2. the closing line must match org-property-end-re (case ignored)
> 3. between those, you must not insert text match org-property-end-re or
>    org-outline-regexp-bol
> Obviously, point 3 needs not be checked during deletion.

Point 3 above is inaccurate, one also needs to check that

  "^[ \t]#\\+end[:_]"

doesn't match the body, either.

> Instead of `after-change-functions', we may use `modification-hooks' for
> deletions, and `insert-behind-hooks' for insertions. For example, we
> might add modification-hooks property to both opening and closing line,
> and `insert-behind-hooks' on all the drawer. If any of the 3 points
> above is verified, we remove all properties.
> Note that if we can implement something robust with text properties, we
> might use them for headlines too, for another significant speed-up.

Another, less ambitious, possibility is to expand the drawer as soon as
text is inserted or removed in the invisible part. Callers (e.g.,
`org-entry-put') are then responsible to fold it again, if necessary.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]