From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Gillespie Subject: Re: [PATCH] Fix verbatim block fontification to end blocks on headlines Date: Fri, 13 Dec 2019 15:25:17 -0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:37549) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifuJR-0001Nk-J3 for emacs-orgmode@gnu.org; Fri, 13 Dec 2019 18:25:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifuJO-0002wA-Nr for emacs-orgmode@gnu.org; Fri, 13 Dec 2019 18:25:32 -0500 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]:38811) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifuJO-0002ps-Ds for emacs-orgmode@gnu.org; Fri, 13 Dec 2019 18:25:30 -0500 Received: by mail-lj1-x244.google.com with SMTP id k8so464681ljh.5 for ; Fri, 13 Dec 2019 15:25:29 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Adam Porter writes: > May I recommend using the rx macro for regexps? They are much easier > for humans to parse, which helps reduce errors like the ones mentioned > here. And they are about to gain some very useful new features > in Emacs 27. Yep. I'll switch the regex in over to use rx. An unrelated question. I've written some basic tests for this and I couldn't find any other tests that seemed to deal with fontification at all. In order to get fontification tests to work I added a call to `font-lock-ensure' inside `org-test-with-temp-text' (see excerpted patch bit below). Given how frequently `org-test-with-temp-text' is used, does it make sense to create a separate version of that macro just for testing with fontification? I have no idea what the performance impact would be, so any guidance is appreciated. diff --git a/testing/org-test.el b/testing/org-test.el index c3e21eb30..e97e2eaa4 100644 --- a/testing/org-test.el +++ b/testing/org-test.el @@ -198,7 +198,8 @@ otherwise place the point at the beginning of the inserted text." (insert (replace-match "" nil nil inside-text)) (goto-char (1+ (match-beginning 0)))) (insert inside-text) - (goto-char (point-min)))) + (goto-char (point-min))) + (font-lock-ensure (point-min) (point-max))) ,@body))) (def-edebug-spec org-test-with-temp-text (form body))