[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 14/38] Support extra org-fold optimisations for huge buffers
From: |
Ihor Radchenko |
Subject: |
[PATCH v2 14/38] Support extra org-fold optimisations for huge buffers |
Date: |
Wed, 20 Apr 2022 21:25:45 +0800 |
---
lisp/org.el | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index ca0a99681..f5936b67c 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5788,6 +5788,7 @@ (defun org-unfontify-region (beg end &optional
_maybe_loudly)
'(mouse-face t keymap t org-linked-text t
invisible t intangible t
org-emphasis t))
+ (org-fold-core-update-optimisation beg end)
(org-remove-font-lock-display-properties beg end)))
(defconst org-script-display '(((raise -0.3) (height 0.7))
@@ -6158,7 +6159,11 @@ (defun org-get-heading (&optional no-tags no-todo
no-priority no-comment)
(org-back-to-heading t)
(let ((case-fold-search nil))
(looking-at org-complex-heading-regexp)
- (let ((todo (and (not no-todo) (match-string 2)))
+ ;; When using `org-fold-core--optimise-for-huge-buffers',
+ ;; returned text may be invisible. Clear it up.
+ (save-match-data
+ (org-fold-core-remove-optimisation (match-beginning 0) (match-end
0)))
+ (let ((todo (and (not no-todo) (match-string 2)))
(priority (and (not no-priority) (match-string 3)))
(headline (pcase (match-string 4)
(`nil "")
@@ -6169,6 +6174,8 @@ (defun org-get-heading (&optional no-tags no-todo
no-priority no-comment)
"" h))
(h h)))
(tags (and (not no-tags) (match-string 5))))
+ ;; Restore cleared optimisation.
+ (org-fold-core-update-optimisation (match-beginning 0) (match-end 0))
(mapconcat #'identity
(delq nil (list todo priority headline tags))
" "))))))
@@ -6185,18 +6192,21 @@ (defun org-heading-components ()
(save-excursion
(org-back-to-heading t)
(when (let (case-fold-search) (looking-at org-complex-heading-regexp))
- (list (length (match-string 1))
- (org-reduced-level (length (match-string 1)))
- (match-string-no-properties 2)
- (and (match-end 3) (aref (match-string 3) 2))
- (match-string-no-properties 4)
- (match-string-no-properties 5)))))
+ (org-fold-core-remove-optimisation (match-beginning 0) (match-end 0))
+ (prog1
+ (list (length (match-string 1))
+ (org-reduced-level (length (match-string 1)))
+ (match-string-no-properties 2)
+ (and (match-end 3) (aref (match-string 3) 2))
+ (match-string-no-properties 4)
+ (match-string-no-properties 5))
+ (org-fold-core-update-optimisation (match-beginning 0) (match-end
0))))))
(defun org-get-entry ()
"Get the entry text, after heading, entire subtree."
(save-excursion
(org-back-to-heading t)
- (buffer-substring (point-at-bol 2) (org-end-of-subtree t))))
+ (filter-buffer-substring (point-at-bol 2) (org-end-of-subtree t))))
(defun org-edit-headline (&optional heading)
"Edit the current headline.
--
2.35.1
--
Ihor Radchenko,
PhD,
Center for Advancing Materials Performance from the Nanoscale (CAMP-nano)
State Key Laboratory for Mechanical Behavior of Materials, Xi'an Jiaotong
University, Xi'an, China
Email: yantar92@gmail.com, ihor_radchenko@alumni.sutd.edu.sg
- [PATCH v2 04/38] Remove functions from org.el that are now moved elsewhere, (continued)
- [PATCH v2 04/38] Remove functions from org.el that are now moved elsewhere, Ihor Radchenko, 2022/04/20
- [PATCH v2 05/38] Disable native-comp in agendaIt caused cryptic bugs in the past., Ihor Radchenko, 2022/04/20
- [PATCH v2 06/38] org-macs: New function org-find-text-property-region---, Ihor Radchenko, 2022/04/20
- [PATCH v2 07/38] org-at-heading-p: Accept optional argument* lisp/org.el (org-at-heading-p): Use second argument to allow, Ihor Radchenko, 2022/04/20
- [PATCH v2 08/38] org-string-width: Reimplement to work with new folding, Ihor Radchenko, 2022/04/20
- [PATCH v2 09/38] Rename old function call to use org-fold---, Ihor Radchenko, 2022/04/20
- [PATCH v2 10/38] Implement link folding* lisp/ol.el (org-link--link-folding-spec):, Ihor Radchenko, 2022/04/20
- [PATCH v2 12/38] org-fold: Handle indirect buffer visibility---, Ihor Radchenko, 2022/04/20
- [PATCH v2 11/38] Implement overlay- and text-property-based versions of some functions, Ihor Radchenko, 2022/04/20
- [PATCH v2 13/38] Fix subtle differences between overlays and invisible text properties, Ihor Radchenko, 2022/04/20
- [PATCH v2 14/38] Support extra org-fold optimisations for huge buffers,
Ihor Radchenko <=
- [PATCH v2 15/38] Alias new org-fold functions to their old shorter names, Ihor Radchenko, 2022/04/20
- [PATCH v2 16/38] Obsolete old function names that are now in org-fold---, Ihor Radchenko, 2022/04/20
- [PATCH v2 18/38] Move `org-buffer-list' to org-macs.el---, Ihor Radchenko, 2022/04/20
- [PATCH v2 19/38] Restore old visibility behaviour of org-refile---, Ihor Radchenko, 2022/04/20
- [PATCH v2 17/38] org-compat: Work around some third-party packages using outline-* functions, Ihor Radchenko, 2022/04/20
- [PATCH v2 20/38] Add org-fold-related tests---, Ihor Radchenko, 2022/04/20
- [PATCH v2 22/38] ORG-NEWS: Add list of changes---, Ihor Radchenko, 2022/04/20
- [PATCH v2 23/38] Backport contributed commits---, Ihor Radchenko, 2022/04/20
- [PATCH v2 21/38] org-manual: Update to new org-fold function names---, Ihor Radchenko, 2022/04/20
- [PATCH v2 25/38] Fix bug in org-get-headingFixes #26, where fontification could make the matching and extraction of heading, Anders Johansson, 2022/04/20