From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2L56Fmwo9WFkbwEAgWs5BA (envelope-from ) for ; Sat, 29 Jan 2022 12:43:40 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id aNEgD2wo9WEzCgAAG6o9tA (envelope-from ) for ; Sat, 29 Jan 2022 12:43:40 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A44F0290CB for ; Sat, 29 Jan 2022 12:43:39 +0100 (CET) Received: from localhost ([::1]:42388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nDm8o-0007mg-MG for larch@yhetil.org; Sat, 29 Jan 2022 06:43:38 -0500 Received: from eggs.gnu.org ([209.51.188.92]:58852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nDm1l-0003D0-TC for emacs-orgmode@gnu.org; Sat, 29 Jan 2022 06:36:22 -0500 Received: from [2607:f8b0:4864:20::1030] (port=36572 helo=mail-pj1-x1030.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nDm1j-0000ab-EA; Sat, 29 Jan 2022 06:36:21 -0500 Received: by mail-pj1-x1030.google.com with SMTP id h20-20020a17090adb9400b001b518bf99ffso13436096pjv.1; Sat, 29 Jan 2022 03:36:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P6PsOVlt23a4fnCPCapC12fniMjUWbGKqwAsfMn48iI=; b=CnvKDr+O3zC78UznvcVP+2NfpI2NPV9mHKnCXcKHbGp4mesBdW2dMaY+Zo1Rb9yF4G vQWo8sXfcAT1HJq75cHLdtD8Aa6x51vWTXFWeE4M0CsSTCNG+yo35Ac/9uTmMWOHNRCy NVnGbV97Vte+kTuWnVhFLv3BGkztR2J9aoRlId1Nl8OI/JkRgNy+hNu8+ThaXShJ76S5 bjdv93Jqse0fU3Aycp/uNvbVaVuXd5gSqWDqrIGXD2y84qU2ZjfYjQncX7a2U1h1WLGG 9JMLNvcPw0Luug8K6Xvb36fJQoo7327gSuHFt1+YiG5FrvgBJ+doyVj44eAU3ytkpU5a gzdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P6PsOVlt23a4fnCPCapC12fniMjUWbGKqwAsfMn48iI=; b=ywm6XuEj1m1FZxFoOXdBb2p3PeeZEf4y/hAAP4SJLF+8URFlBwSfWMQPu8Poy0BevO yJaO8FdSMmY0r5fBSBKD5BNaIL+X3+F4I3Mqt3wIuw1ZLGQ6UtxZhUY6qtLlUxHBwfC5 bneNrZfEBR5mrTIaXDECV2N7vtJAZnw1olCzOkePrGkr6fdqLBLw6nBdCnQ0yHBZr+a9 ER5fwXXPoOIaCwUCO0rC3wnVohQx3Y4y4OaYOYnMKCcDUS98sIUiGS8iMVBCQcFgYdLP Z4J0tbuDG9kUglOYpy7Ob7UPnW8XnDvYU9RiOiBcHstYQYdewP2lROgGVQOWIbcBwa55 PyMw== X-Gm-Message-State: AOAM533KLC4dXoA9ZbSSvK8kZupHddfZs5Ge6y/dEd+fuFV0O6YxJlFg vIlXwR2rScIebX4jU/CrYaD4wNFGcLWbWNpQ X-Google-Smtp-Source: ABdhPJyZHp205jzHnWRY+kofuafhSPiR1820P9/iY8+q1kDRn6hTbcB3j4F0VgrmxN/+vqQSJ4JG4g== X-Received: by 2002:a17:90a:de01:: with SMTP id m1mr24438340pjv.215.1643456169869; Sat, 29 Jan 2022 03:36:09 -0800 (PST) Received: from localhost ([209.95.60.92]) by smtp.gmail.com with ESMTPSA id b6sm12720429pfl.126.2022.01.29.03.36.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jan 2022 03:36:09 -0800 (PST) From: Ihor Radchenko To: Bastien , Kyle Meyer , Nicolas Goaziou , Karl Voit , Christian Heinrich , emacs-orgmode@gnu.org Subject: [PATCH 14/35] Support extra org-fold optimisations for huge buffers Date: Sat, 29 Jan 2022 19:38:06 +0800 Message-Id: <47d36950c97c786b681f4eea086961071888b96f.1643454546.git.yantar92@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: <87y2cvloay.fsf@gnu.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------2.34.1" Content-Transfer-Encoding: 8bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::1030 (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=yantar92@gmail.com; helo=mail-pj1-x1030.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ihor Radchenko Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1643456619; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=P6PsOVlt23a4fnCPCapC12fniMjUWbGKqwAsfMn48iI=; b=oo1TVuDVV4FDW0zEsbOOJt2g/4hmU6CSwX4yOb57aRL+7PRt7Z5reY8TGFXM4y+dRo/kwN /Mq/9GqL/YkWfIPjeO2P4CJg+C/rNsw1t/+PPiecKLu4+xINUSHzNcAnrVTYuFVuwfYolI Xwor5u9seh/ay1Vdh+ISccmUgI0MSIlelthEzVTroTphqp+mgeTZg4552ftzWZs3bCt4Oe 45HXQ6XKA2Ux9F5tWYCECwxzG5ZxXL5euoWrNSe2ngkmGvehA4Vs+aWZYui+fxBSZvMWOq mi0+Uv7nbUZT/cmCfbjTf7rQ8jVdPJdtBh6dzMVHEvjxqCKXkO2DmEczY3+hEQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1643456619; a=rsa-sha256; cv=none; b=cwzet9LOk7prN1Qc7Q4w9qONgeB5BpNQtUbK0zoYcHWepIhweBUz0ZWgZAUG/PC2crodJ9 Zocm+H1x7zw92X7ZNEAtJXh7RmVpuoXHUg6V+6njzJQ8s1ol+HCbM5aRfPSWnirT9iS3m6 Pp8Bknl9wP5I/vou54F67sUEsO5JXYxa+GRW47VYboqeOUX/woukGFdsTKqbT94qYOi5eZ 5jCFfCV/j2jmWrW47bUIhhLJlf4TFfnnRImyUB6tsXPmumXsposJC7QTaRH5Ut1409SbqH 8Ztvvh/bDEQ6w0sAD19o5tjMvx3JFG3gD/zuLEJFb7hyghNrb9e4ClHTP9Ji5A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CnvKDr+O; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.33 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CnvKDr+O; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: A44F0290CB X-Spam-Score: -3.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: qHhXkMUijg3r This is a multi-part message in MIME format. --------------2.34.1 Content-Type: text/plain; charset=UTF-8; format=fixed Content-Transfer-Encoding: 8bit --- lisp/org.el | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) --------------2.34.1 Content-Type: text/x-patch; name="0014-Support-extra-org-fold-optimisations-for-huge-buffer.patch" Content-Transfer-Encoding: 8bit Content-Disposition: attachment; filename="0014-Support-extra-org-fold-optimisations-for-huge-buffer.patch" diff --git a/lisp/org.el b/lisp/org.el index a59d550ca..22fce184e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5787,6 +5787,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)) @@ -6157,7 +6158,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 "") @@ -6168,6 +6173,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)) " ")))))) @@ -6184,18 +6191,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.34.1--