From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KOP1OluI2WDRMAEAgWs5BA (envelope-from ) for ; Mon, 28 Jun 2021 10:29:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id WNWRNluI2WBQUwAAbx9fmQ (envelope-from ) for ; Mon, 28 Jun 2021 08:29:15 +0000 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 31FB625E92 for ; Mon, 28 Jun 2021 10:29:15 +0200 (CEST) Received: from localhost ([::1]:47532 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxmdm-0000q6-6j for larch@yhetil.org; Mon, 28 Jun 2021 04:29:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33468) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxmd7-0000pb-9M for emacs-orgmode@gnu.org; Mon, 28 Jun 2021 04:28:33 -0400 Received: from mout01.posteo.de ([185.67.36.65]:54347) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxmd4-0005kq-9G for emacs-orgmode@gnu.org; Mon, 28 Jun 2021 04:28:33 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id A3C5E24002C for ; Mon, 28 Jun 2021 10:28:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.eu; s=2017; t=1624868907; bh=Td9FGnPzt4gJkByHPFuEddDb5nfjjiP6HpRr1Hhk8ZY=; h=Subject:To:From:Date:From; b=m50sUUsrpvDvTf2oq8VH0zIG+x0nmAJONFN7HtSDM9IMkcyG1XCskul86MKR49BpO QWG/s80LsR4FJfyralaWbPxKd/cZqJQOZEevwFuU4CUSikORJJN7uTsZzPwLAFqY8u d9U+9zGtYPzDzFm/ygX6qwbJvNA/sxm9tPxJ2yifEdl81A8Ev8oNm0cfAMIWwuCMFj bHCodfbWLXpdosY6TJ+2IW2B433L0bhyGonYF25Hofp+4qPRlxyCVkrS58g9xhgG7y XUjQ4LNv6X7LYV9mng25CWpbHl03VJ7e4TUF/2/nqOfUVvJgPAIP36m9kpX9sz/f3C KooySe5nlZbWw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4GD12x2J3kz9rxW; Mon, 28 Jun 2021 10:28:25 +0200 (CEST) Subject: Re: Large source block causes org-mode to be unusable To: =?UTF-8?Q?L=c3=a9o_Ackermann?= , Org Mode List References: <87o8by2v1q.fsf@ucl.ac.uk> <8735ta2j2d.fsf@ucl.ac.uk> <871r8raea9.fsf@disroot.org> From: =?UTF-8?Q?S=c3=a9bastien_Miquel?= Message-ID: <5c82f571-f36b-0d61-b69b-e057832f7d84@posteo.eu> Date: Mon, 28 Jun 2021 08:28:24 +0000 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------BDA270FAB8F549D7EA49037E" Content-Language: fr Received-SPF: pass client-ip=185.67.36.65; envelope-from=sebastien.miquel@posteo.eu; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sebastien.miquel@posteo.eu Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624868955; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=EYQyvpf90gT4HnNemmvGB3WSrJ7XynvmRnKIlDxSr4M=; b=qIKbs/zSwxeSZKUOqtCSMEzQFq3i7blunBiYDK1MdQq9Uk6UJyYmqwo5czb8FXBzEsCB/r I9cktGHhtarbHTUDYuxdarEezlsW9HAxW466MQXw4QpzcyiRCdmxAsCH/IwQvZpdURFwwl c+H5xladZu83x79ydoScvyeyLznE4GGY9dapH1M448r5XUKzs+MvFibM9wdftpGz1uLFcT wm+NocrPkRJDjC1+CKjjzv81vJzid7NKINYtESMlq6EJVVRItXc7rpvp0/6hvYz6YUDHNj NDeJ4qCYGg112THvA0aLlBstsn0XsIUo1LQiPun6GqLsXIloL9Ahyk78Crn61A== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624868955; a=rsa-sha256; cv=none; b=kT1VNAJEEdJx9LTpHdXD6FDCenHr9BzvQE5LIQ37WixnDryiKqEhqxXxDR4YPsqiKipxtS LinurBYm57dzSZj/OOdr3t4lG6NGmQDxPsuwYYRaCf93w2gMY9KwwcESqnEtgcZYJB5zuh ABfe9gvIUxAVOWqooe4ItJ6iU2VGNq4YnWpTCXlR8j4A7agvRDObxt9wS9TRizK/jIHwug ZoEwRQjMK778ylR9COfFe6JpyIu0nM/x4L5bxBpAGgAjajNNtRkaxXjd2idF794MXP+s2R +QUOylTlUY6v4tzpLxCRntnLIMObfvJPvdLfru+3aDQYlcrh5OJKJq847qWP0w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=m50sUUsr; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -3.12 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.eu header.s=2017 header.b=m50sUUsr; dmarc=pass (policy=none) header.from=posteo.eu; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 31FB625E92 X-Spam-Score: -3.12 X-Migadu-Scanner: scn1.migadu.com X-TUID: C9CwPSdVmjXa This is a multi-part message in MIME format. --------------BDA270FAB8F549D7EA49037E Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi, Léo Ackermann writes: > @EricSFrada, would you mind sharing your code for your proof sections ? This functionality is now built-in: headings with an `ignore' tag do not get exported (their contents do). For very large proof, this seems like the right thing to do. In small to moderate sized blocks, the delay can still be noticeable and ought to be fixed. Attached is a patch that seems to resolve this issue. I haven't noticed any drawbacks so far. Regards, -- Sébastien Miquel --------------BDA270FAB8F549D7EA49037E Content-Type: text/x-patch; charset=UTF-8; name="0001-WIP-do-not-refontify-special-blocks.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-WIP-do-not-refontify-special-blocks.patch" >From d843bdc5887a6e50a57e349128ebbe032086dc17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= Date: Sun, 27 Jun 2021 16:24:22 +0200 Subject: [PATCH] WIP : do not refontify special blocks --- lisp/org.el | 99 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 64 insertions(+), 35 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 1bd9e02eb..9fd3f8514 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5265,22 +5265,32 @@ by a #." (org-fontify-meta-lines-and-blocks-1 limit) (error (message "Org mode fontification error in %S at %d" (current-buffer) - (line-number-at-pos))))) + (line-number-at-pos)))) + nil) (defun org-fontify-meta-lines-and-blocks-1 (limit) "Fontify #+ lines and blocks." - (let ((case-fold-search t)) - (when (re-search-forward - (rx bol (group (zero-or-more (any " \t")) "#" - (group (group (or (seq "+" (one-or-more (any "a-zA-Z")) (optional ":")) - (any " \t") - eol)) - (optional (group "_" (group (one-or-more (any "a-zA-Z")))))) - (zero-or-more (any " \t")) - (group (group (zero-or-more (not (any " \t\n")))) - (zero-or-more (any " \t")) - (group (zero-or-more any))))) - limit t) + (let* ((case-fold-search t) + (fl-beg (point)) + (fl-end limit) + (fbeg (when (and (> fl-beg (point-min)) + (get-text-property (1- fl-beg) 'font-lock-multiline-block)) + (or (previous-single-property-change + fl-beg 'font-lock-multiline-block) + (point-min))))) + (when fbeg (goto-char fbeg)) + (while (and (< (point) limit) + (re-search-forward + (rx bol (group (zero-or-more (any " \t")) "#" + (group (group (or (seq "+" (one-or-more (any "a-zA-Z")) (optional ":")) + (any " \t") + eol)) + (optional (group "_" (group (one-or-more (any "a-zA-Z")))))) + (zero-or-more (any " \t")) + (group (group (zero-or-more (not (any " \t\n")))) + (zero-or-more (any " \t")) + (group (zero-or-more any))))) + limit t)) (let ((beg (match-beginning 0)) (end-of-beginline (match-end 0)) ;; Including \n at end of #+begin line will include \n @@ -5318,7 +5328,7 @@ by a #." (remove-text-properties beg end-of-endline '(display t invisible t intangible t))) (add-text-properties - beg end-of-endline '(font-lock-fontified t font-lock-multiline t)) + beg end-of-endline '(font-lock-fontified t font-lock-multiline-block t)) (org-remove-flyspell-overlays-in beg bol-after-beginline) (org-remove-flyspell-overlays-in nl-before-endline end-of-endline) (cond @@ -5327,7 +5337,8 @@ by a #." (add-text-properties bol-after-beginline block-end '(src-block t))) (quoting (add-text-properties - bol-after-beginline beg-of-endline + (max bol-after-beginline (or fl-beg bol-after-beginline)) + (min beg-of-endline (or fl-end beg-of-endline)) (list 'face (list :inherit (let ((face-name @@ -5426,26 +5437,41 @@ by a #." (add-text-properties closing-start end '(invisible t))) t))))) -(defun org-fontify-extend-region (beg end _old-len) - (let ((begin-re "\\(\\\\\\[\\|\\(#\\+begin_\\|\\\\begin{\\)\\S-+\\)") - (end-re "\\(\\\\\\]\\|\\(#\\+end_\\|\\\\end{\\)\\S-+\\)") - (extend - (lambda (r1 r2 dir) - (let ((re (replace-regexp-in-string - "\\(begin\\|end\\)" r1 - (replace-regexp-in-string - "[][]" r2 - (match-string-no-properties 0))))) - (re-search-forward (regexp-quote re) nil t dir))))) - (save-match-data - (save-excursion - (goto-char beg) - (back-to-indentation) - (cond ((looking-at end-re) - (cons (or (funcall extend "begin" "[" -1) beg) end)) - ((looking-at begin-re) - (cons beg (or (funcall extend "end" "]" 1) end))) - (t (cons beg end))))))) +(defun org-fontify-extend-region (bego endo _old-len) + (let* ((beg bego) (end endo) + (bol (save-excursion (goto-char beg) (point-at-bol))) + (eol (save-excursion (goto-char end) (point-at-eol)))) + (let ((before-multi (and (> bol (point-min)) + (get-text-property (1- bol) 'font-lock-multiline-block))) + (after-multi (get-text-property eol 'font-lock-multiline-block))) + (if before-multi + (unless after-multi + (setq beg (or (previous-single-property-change + bol 'font-lock-multiline-block) + (point-min)))) + (when after-multi + (setq end (or (text-property-any eol (point-max) + 'font-lock-multiline-block nil) + (point-max)))))) + (let ((begin-re "\\(\\\\\\[\\|\\(#\\+begin_\\|\\\\begin{\\)\\S-+\\)") + (end-re "\\(\\\\\\]\\|\\(#\\+end_\\|\\\\end{\\)\\S-+\\)") + (extend + (lambda (r1 r2 dir) + (let ((re (replace-regexp-in-string + "\\(begin\\|end\\)" r1 + (replace-regexp-in-string + "[][]" r2 + (match-string-no-properties 0))))) + (re-search-forward (regexp-quote re) nil t dir))))) + (save-match-data + (save-excursion + (goto-char beg) + (back-to-indentation) + (cond ((looking-at end-re) + (cons (or (funcall extend "begin" "[" -1) beg) end)) + ((looking-at begin-re) + (cons beg (max end (or (funcall extend "end" "]" 1) end)))) + (t (cons beg end)))))))) (defun org-activate-footnote-links (limit) "Add text properties for footnotes." @@ -5772,6 +5798,9 @@ needs to be inserted at a specific position in the font-lock sequence.") '(org-font-lock-keywords t nil nil backward-paragraph)) (setq-local font-lock-extend-after-change-region-function #'org-fontify-extend-region) + (setq-local font-lock-extra-managed-props + (append font-lock-extra-managed-props + '(font-lock-multiline-block))) (kill-local-variable 'font-lock-keywords) nil)) -- 2.32.0 --------------BDA270FAB8F549D7EA49037E--