emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: Sebastian Gimeno <changimeno@gmail.com>,
	Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Org mode fontification error in #<buffer myfile.org> in python and ipython source blocks
Date: Tue, 03 Nov 2020 22:10:03 -0500	[thread overview]
Message-ID: <87sg9pom0k.fsf@kyleam.com> (raw)
In-Reply-To: <CAJ51ETpCToO8Y-JY0k4ekQNd-EJMrmXUf9OYZ9eJ_JTHbascHQ@mail.gmail.com>

John Kitchin writes:

>> (setq python-font-lock-keywords
>>       (append python-font-lock-keywords
>>      '(;; this is the full string.
>> ;; group 1 is the quote type and a closing quote is matched
>> ;; group 2 is the string part
>> (
>> ;; "f\\(['\"]\\{1,3\\}\\)\\([^\\1]+?\\)\\1"
>> "f\\(['\"]\\{1,3\\}\\)\\(.+?\\)\\1"
>> ;; these are the {keywords}
>> ("{[^}]*?}"
>>  ;; Pre-match form
>>  (progn (goto-char (match-beginning 0)) (match-end 0))
>>  ;; Post-match form
>>  (goto-char (match-end 0))
>>  ;; face for this match
>>  (0 font-lock-variable-name-face t))))))

> Does anyone see anything wrong with that snippet? All it should do is
> improve font-lock on Python f-strings, and it used to work fine, but now it
> doesn't. It isn't real critical for me, so I don't mind commenting it out,
> but I neither understand why it stopped working!

I haven't tested to confirm, but I'd guess that is due to the
restructuring of python-font-lock-keywords in 36b64e087e (Add
'font-lock-maximum-decoration' levels for Python, 2018-07-19), which was
included in Emacs 27.

In case it's helpful, here's the compatibility kludge I used in
snakemake-mode:
https://git.kyleam.com/snakemake-mode/commit/snakemake-mode.el?id=5d5bb0109f6a84c0c191559ab71670fae4650e6a


  reply	other threads:[~2020-11-04  3:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-31  2:01 Org mode fontification error in #<buffer myfile.org> in python and ipython source blocks Sebastian Gimeno
2020-11-01 20:19 ` Jack Kamm
2020-11-01 23:43   ` Sebastian Gimeno
2020-11-02  0:41     ` Sebastian Gimeno
2020-11-03  5:49 ` stardiviner
2020-11-03  9:53   ` Sebastian Gimeno
2020-11-03 15:55     ` John Kitchin
2020-11-04  3:10       ` Kyle Meyer [this message]
2020-11-04  3:22     ` stardiviner

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=87sg9pom0k.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=changimeno@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    /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).