Steven Allen <[email protected]> writes: > 1. Inline source code: The original patch broke > org-element--parse-paired-brackets because that function relies on > syntax tables to find the pair of surrounding curly braces.
In the long term, the parser should move away from relying on in-buffer settings, including syntax table. So, I think that making things less dependent on local syntax tables is the right direction. This is because many people desire Org parser to work outside Org buffers. Unexpected tables is one of the reasons why it is not possible as of now. > 2. Source blocks: The original patch broke some regular expression (I > think?) that matches the beginning of source blocks, causing it to > include the first word of the source-code in the language name. E.g., > in one test: > > #+BEGIN_SRC eshell > echo 2 > #+END_SRC > > Parsed the language as "eshell\necho" I am wondering if this was inside the parser or in one of the ad-hoc regexp searches. If the former, it is a good idea to shield that part of the parser. >> What about inline src blocks? > > I restricted the previous version to JUST blocks because I figured it'd > be safer (I assume org-mode skips over all the lines between begin/end > when fontifying). Considering the above-state goal, I am willing to sacrifice short-term stability in favor of revealing more bottlenecks in the parser where we rely on defaults/major mode setup. > I've dug into this a bit more now and, I can fix the tests by binding > parse-sexp-lookup-properties to nil inside > org-element--parse-paired-brackets (patch attached). However, I'm not > sure there aren't other cases lurking untested. > > One option here is to replace calls to with-syntax-table with an > org-with-syntax-table that binds parse-sexp-lookup-properties to nil but > that may be overkill. I think that will be exactly right kill of kill :) > (setq pos next))) > + (put-text-property start end 'syntax-table (syntax-table) > org-buffer) > (set-buffer-modified-p nil))) What if src block's major mode itself sets 'syntax-table property? -- Ihor Radchenko // yantar92, Org mode maintainer, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>
