emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Timothy <tecosaur@gmail.com>
Cc: org-mode-email <emacs-orgmode@gnu.org>
Subject: Re: [PATCH] Fontification for inline src blocks
Date: Mon, 22 Nov 2021 22:35:20 +0800	[thread overview]
Message-ID: <87k0h0b6mv.fsf@localhost> (raw)
In-Reply-To: <87zgpw5lt9.fsf@gmail.com>

Timothy <tecosaur@gmail.com> writes:

>> I have some comments. See below.
>
> Thanks for going through this, and for all your help previously.
> I appreciate it :)

Welcome.

>>> (org-inline-src-fontify-max-length): Create a variable to limit the
>>> maximum length of an inline-src block fontified, to protect from lag
>>> spikes (e.g. when typing out src_lang{ and half of the buffer is
>>> fontified).
>>
>> I do not like this. Even with this variable, some part of buffer may be
>> spuriously fontified. Maybe you just verify that you are at actual
>> inline-src block by examining org-element-context?
>
> The description may need updating, as that’s a tad inaccurate. That value
> actually limits how far forwards a paired paren is searched for. There’s no
> spurious fontification.

I can see the purpose. However, it still looks like overcomplication.
org-element-context takes care about this issue simply by narrowing to
current element (inline src block is an object and hence must end within
current element).

>>> +        (font-lock-append-text-property lang-beg lang-end ’face ’org-meta-line)
>>> +        (font-lock-append-text-property beg lang-beg ’face ’shadow)
>>> +        (font-lock-append-text-property beg lang-end ’face ’org-inline-src-block)
>>
>> Is there some special reason why you apply both ’shadow and
>> ’org-inline-src-block? What about ’org-meta-line face? Maybe
>> ’org-meta-line should not be hard-coded?
>
> I think there’s an argument for more faces that can be made because of element
> like this, but it comes down to the idea that in a `src_lang[options]{content}'
> construct `src_' is effectively visual noise, particularly once fortification
> occurs and it’s obvious that it’s inline code even without it. So, I find it
> nicest if it’s faded, which `shadow' does. Also applying `org-inline-src-block'
> allows for a consistent background colour across the whole construct.

Makes sense. 

>> It looks like you are repeating the job of org-element-context here. Why
>> don’t you just get the proper object?
>
> IIRC `org-element-context' doesn’t separate out the `src_', `lang', `[options]', and
> `{content}' of an inline source code block (which we want).

Sounds like an omission in org-element-context. At least, the parser
could return :contents-begin and :contents-end. Then, you would also not
need to re-implement the parser.

Best,
Ihor


  reply	other threads:[~2021-11-22 14:34 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-31 15:00 [PATCH] Fontification for inline src blocks Timothy
2021-04-28  7:14 ` Timothy
2021-05-02 20:17   ` Timothy
2021-05-02 20:57     ` Tom Gillespie
2021-05-02 21:03       ` Timothy
2021-05-02 21:13         ` Tom Gillespie
2021-05-02 23:54           ` Tom Gillespie
2021-05-03  3:29       ` Timothy
2021-05-12 11:15         ` Timothy
2021-05-12 14:24           ` Ihor Radchenko
2021-05-12 14:47             ` Timothy
2021-05-12 15:53               ` Ihor Radchenko
2021-05-12 16:39                 ` Timothy
2021-05-13  2:38                   ` Tim Cross
2021-05-13  5:31                   ` Ihor Radchenko
2021-05-18 12:06                   ` Sébastien Miquel
2021-05-18 13:34                     ` Timothy
2021-05-18 14:36                       ` Sébastien Miquel
2021-04-29 22:59 ` TRS-80
2021-10-03  7:14 ` Ihor Radchenko
2021-10-03  7:16   ` Timothy
2021-10-03  9:09     ` Ihor Radchenko
2021-10-03  9:22       ` Timothy
2021-10-04 20:02       ` Protesilaos Stavrou
2021-11-21 14:09 ` Timothy
2021-11-22 11:52   ` Timothy
2021-11-22 12:23     ` Ihor Radchenko
2021-11-22 13:43       ` Timothy
2021-11-22 14:35         ` Ihor Radchenko [this message]
2021-11-22 14:37           ` Timothy
2021-11-23 13:30             ` Ihor Radchenko
2021-11-29 19:21               ` Timothy
2021-11-30 11:44                 ` Timothy
2021-11-30 12:45                   ` Sébastien Miquel
2021-11-30 12:46                     ` Timothy
2021-11-30 12:21                 ` Ihor Radchenko
2021-12-02 12:53     ` Eric S Fraga
2021-12-02 13:57       ` Faces for inline src blocks (was: [PATCH] Fontification for inline src blocks) Timothy
2021-12-02 15:52         ` Faces for inline src blocks Eric S Fraga
2021-12-02 15:56           ` Timothy
2021-12-02 16:15             ` Eric S Fraga
2021-11-23 10:45   ` [PATCH] Fontification " Vitaly Ankh
2021-11-23 13:45     ` Vitaly Ankh

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=87k0h0b6mv.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=tecosaur@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).