emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: Tom Gillespie <tgbugs@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] Fix verbatim block fontification to end blocks on headlines
Date: Thu, 12 Dec 2019 09:40:43 +0100	[thread overview]
Message-ID: <87y2viq6lw.fsf@nicolasgoaziou.fr> (raw)
In-Reply-To: <CA+G3_PM443QMXyx=-0P-G70CnRJGEyn5TO9SOHwkVFVRDgbx1w@mail.gmail.com> (Tom Gillespie's message of "Wed, 11 Dec 2019 19:35:50 -0800")

Hello,

Tom Gillespie <tgbugs@gmail.com> 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/.
  
>  		 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))))

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

  reply	other threads:[~2019-12-12  8:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12  3:35 [PATCH] Fix verbatim block fontification to end blocks on headlines Tom Gillespie
2019-12-12  8:40 ` Nicolas Goaziou [this message]
2019-12-12 10:27   ` Tom Gillespie
2019-12-12 12:20     ` Adam Porter
2019-12-18  4:38     ` Tom Gillespie
2019-12-19 13:09       ` Nicolas Goaziou
2019-12-26 18:47       ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2019-12-13 23:25 Tom Gillespie
2019-12-14 14:45 ` Nicolas Goaziou
2020-02-12  8:38 ` Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2viq6lw.fsf@nicolasgoaziou.fr \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=tgbugs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).