emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Fix verbatim block fontification to end blocks on headlines


From: Nicolas Goaziou
Subject: Re: [PATCH] Fix verbatim block fontification to end blocks on headlines
Date: Thu, 12 Dec 2019 09:40:43 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux)

Hello,

Tom Gillespie <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]