emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [DISCUSSION] Refactoring fontification system


From: Tim Cross
Subject: Re: [DISCUSSION] Refactoring fontification system
Date: Sat, 04 Jun 2022 07:38:09 +1000
User-agent: mu4e 1.7.25; emacs 28.1.50

Ihor Radchenko <yantar92@gmail.com> writes:

> Ihor Radchenko <yantar92@gmail.com> writes:
>
>> Instead of fontifying elements individually via regexps, we can leverage
>> org-element-map, org-element-parse-buffer, org-element-cache, and
>> jit-lock-mode. Each type of Org element/object can be assigned with a
>> fontification function accepting a single argument - the element datum.
>
> I have been working on the new fontification library for the last
> several months and I have noticed several confusing things in the
> current fontification settings.
>

Very pleased your working on this. I suspect this will, once combined
with the other fine work you have done, generate some very rewarding
results. 

> I'd like to hear if anyone has any idea on how to interpret the
> following:
>
> 1. org-protecting-blocks is an internal auxiliary variable used to
>    determine which blocks should be fontified using different major
>    mode.
>    It's value is ("src" "example" "export")
>    So, #+begin_src lang and #+begin_export lang are fontified according
>    to LANG. Makes sense.
>    However, what about #+begin_example?
>    org-element-example-block-parser does not appear to expect language
>    specification in the example blocks. Only switches seems to be
>    allowed. Am I missing something and Org actually allows example
>    blocks to specify language? Or was it the case in the distant past
>    versions of Org?
>

I don't recall ever being able to specify language type with source
blocks. The only benefit I can see for being able to would be to have
blocks which are not 'executed' (tangled), but you can already achieve
that just using source blocks. So, from my perspective, I would want
example blocks (which I view mainly as a type of verbatim block)
fontified in a distinct manner, but no need for language specific
font-locking - if I want that, I would just use a src block. 

> 2. org-script-display is an internal auxiliary variable used to display
>    sub/superscripts. Note that it's default value holds 4 possibilities.
>    Two for each type of script. For example, for superscripts we have
>    two options:
>    ((raise 0.3) (height 0.7)) and ((raise 0.5))
>    The first one looks more compact (does not change the line height)
>    and reduces size of the superscript.
>    The second one makes superscript have the same size with the main
>    text an increases the line height x1.5.
>
>    org-raise-scripts fontifies sub/superscripts differently inside and
>    outside the tables:
>    From org-raise-scripts:
>    (nth (if table-p 3 1) org-script-display)
>
>    However, it currently uses x1.5 line height for tables creating empty
>    space between vertical | separators. It looks like a typo for me. It
>    would make more sense to make table lines compact, not vice versa. Am
>    I missing something?
>

I need superscript/subscript so rarely I really don't have much of a
position. However, I do find it annoying when a superscript/subscript
character alters the line spacing for the line it happens to display in. 

> 3. org-fontify-meta-lines-and-blocks-1 creates a special face for
>    ("+title:" "+subtitle:" "+author:" "+email:" "+date:")
>    The face name is org-document-info.
>    But what about, say, +description: or +language:?
>    Would it make more sense to fontify all the keywords from
>    org-options-keywords instead?
> 

Yes, I think that would be the right approach. I suspect most people
won't really worry too much. Absent font locking is less of an issue
than incorrect font locking. Soemthing too often seen with regexp based
font-locking which I'm hoping will be avoided with a version based more
on parsed elements etc. 
   




reply via email to

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