Org-mode mailing list
 help / color / mirror / 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
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 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://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

Org-mode mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://orgmode.org/list/0 list/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 list list/ https://orgmode.org/list \
		emacs-orgmode@gnu.org
	public-inbox-index list

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.orgmode
	nntp://news.gmane.io/gmane.emacs.orgmode


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git