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: Thu, 12 Dec 2019 02:27:00 -0800 Message-ID: References: <87y2viq6lw.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:35318) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ifLgf-0000Z6-R9 for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 05:27:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ifLge-00083J-O8 for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 05:27:13 -0500 Received: from mail-lf1-x141.google.com ([2a00:1450:4864:20::141]:40923) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ifLge-00081X-Gc for emacs-orgmode@gnu.org; Thu, 12 Dec 2019 05:27:12 -0500 Received: by mail-lf1-x141.google.com with SMTP id i23so1278077lfo.7 for ; Thu, 12 Dec 2019 02:27:12 -0800 (PST) In-Reply-To: <87y2viq6lw.fsf@nicolasgoaziou.fr> 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: Tom Gillespie , emacs-orgmode@gnu.org Thank you very much for the feedback. I will make the additional fixes against maint along with the changes for clarity and send them along tomorrow. Additional replies in line. Best, Tom On Thu, Dec 12, 2019 at 12:40 AM Nicolas Goaziou wrote: > > Hello, > > Tom Gillespie writes: > > > This patch is a change to how org fontifies verbatim source blocks re: [1]. > > Hopefully it answers Nicolas's question from that thread. Best! > > OK. Now I see what you meant. Thank you. > > > (when (re-search-forward > > - (concat "^[ \t]*#\\+end" (match-string 4) "\\>.*") > > + (concat "\\(^\\*\\|^[ \t]*#\\+end" (match-string 4) "\\>.*\\)") > > I haven't tested it, but I think this will not produce the expected > result: > > #+begin_example > *bold* > #+end_example > > I.e., headlines are asterisks at column 0 /followed by a space/. Yep, you are exactly right. > > > nil t) ;; on purpose, we look further than LIMIT > > ;; We do have a matching #+end line > > (setq beg-of-endline (match-beginning 0) > > @@ -5326,10 +5326,11 @@ by a #." > > (add-text-properties > > beg (if whole-blockline bol-after-beginline end-of-beginline) > > '(face org-block-begin-line)) > > - (add-text-properties > > - beg-of-endline > > - (min (point-max) (if whole-blockline (min (point-max) (1+ end-of-endline)) end-of-endline)) > > - '(face org-block-end-line)) > > + (when (not (string= (match-string 1) "*")) > > `when' + `not' -> `unless' > > > + (add-text-properties > > + beg-of-endline > > + (min (point-max) (if whole-blockline (min (point-max) (1+ end-of-endline)) end-of-endline)) > > + '(face org-block-end-line))) > > Arguably, I think > > (min (point-max) (1+ end-of-endline)) > > could be replaced, for clarity, by > > (let (... (beg-of-next-line (line-beginning-position 2)) ...) > ... > (add-text-properties > beg-of-endline > (min (point-max) (if whole-blockline beg-of-next-line end-of-endline)))) Probably right. I will review since I didn't look carefully at that code, but it is a good opportunity to make some improvements while we are looking at it. > > I'm also not convinced that the (min (point-max) ...) left is necessary. > > Could you send an updated patch (on top of maint)? > > Regards, > > -- > Nicolas Goaziou