From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id oEdxOJoeol9rdwAA0tVLHw (envelope-from ) for ; Wed, 04 Nov 2020 03:23:06 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 8GgnNJoeol/3YQAAB5/wlQ (envelope-from ) for ; Wed, 04 Nov 2020 03:23:06 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 323A29402C8 for ; Wed, 4 Nov 2020 03:23:06 +0000 (UTC) Received: from localhost ([::1]:41296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ka9O4-00008m-II for larch@yhetil.org; Tue, 03 Nov 2020 22:23:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ka9NZ-00008f-O3 for emacs-orgmode@gnu.org; Tue, 03 Nov 2020 22:22:33 -0500 Received: from mail-ua1-x92b.google.com ([2607:f8b0:4864:20::92b]:40196) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ka9NX-0000WK-KG for emacs-orgmode@gnu.org; Tue, 03 Nov 2020 22:22:33 -0500 Received: by mail-ua1-x92b.google.com with SMTP id q20so5663193uar.7 for ; Tue, 03 Nov 2020 19:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZZcssNzwahIhxGnFWkbPzre367JcIMI3FabNfzXmEiw=; b=SLH6EJv4sT1XL42k36/+jUw7Dn4vj+Rq8U9l+1vk1gS8wy2jCviopX7dSjNI1oYf51 vbh2SipvI9l/r9CINsti8DZQ0CCs3UpKOdPoJqJkYaJGJ6um9hwFS2p7rkTRz1dcDqQH vqaEN6mpZ6Tge7EfuO6rrnRdjFveAXfUmhEkgGgqdTVRclWYZbmbxfzaHi6ji3q7svRP dmGkLalybwr6Wt7PCTrTPSCsHvMXCcarwhMQXDb/HeuUrWrUwOwpszL6LfVX1WeV2mT6 t+XZCL5Sgx7ipl0bhX5qw8o2bzxrj8SETVhTmzYOGiYh9rsJP1Byc41t9hRQOyLFRW0Q wiKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ZZcssNzwahIhxGnFWkbPzre367JcIMI3FabNfzXmEiw=; b=KiHMrO6s7kePu8nwIfC5nrHaFcrieH6SF6Ve+C69kJqfewxNXPwtiVOPkHUMiGUGo/ vjJ1952fd6pQELmRKiYEbd/imJuGLbmfFX22DoxBTzWC9tIvcsPg8mUQaTXR40rfJK8e cisrfOvgD/DJR24eyYBLxKSEFtCd8ufkk8tXEJkt3T3DU2J5CYteQrUYSo2cQBxL17e8 rigm7rGwfYHJBgNDVSBWGfkSD8p5+QPo+ixhqaNSvACIiUBKkOxxVGg3OhTmSKcdu0vg Nft8nE8AMuwydoXIA53UvbpYcQck2qHOOQzqoTiy0tO6evC2QyKbS328p7nGehaFoUy6 UWkw== X-Gm-Message-State: AOAM531/7gzXZAa+THo1McrPh6+gVT0/7QNdZhcxt/AACSJ3S3vB7cdH 5Y6X86gNxNrUqWf7cJb7vqUbT7l7MquUa1qiSg== X-Google-Smtp-Source: ABdhPJzLveKF+bURRBmVel16p8RzRvMMYqOxNZMCMRLrHrsEoQmCSCBItCBRgCCq70cr3WOYYrZxMcOl3FHb7cLEHKA= X-Received: by 2002:ab0:31c3:: with SMTP id e3mr12182003uan.142.1604460150640; Tue, 03 Nov 2020 19:22:30 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: stardiviner Date: Wed, 4 Nov 2020 11:22:03 +0800 Message-ID: Subject: Re: Org mode fontification error in # in python and ipython source blocks To: Sebastian Gimeno Content-Type: multipart/alternative; boundary="00000000000055d3de05b33f7d22" Received-SPF: pass client-ip=2607:f8b0:4864:20::92b; envelope-from=numbchild@gmail.com; helo=mail-ua1-x92b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Org-mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=SLH6EJv4; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -1.71 X-TUID: pUVz4FfjHcix --00000000000055d3de05b33f7d22 Content-Type: text/plain; charset="UTF-8" Thanks for noting. :) I added that in my Emacs config now. [stardiviner] GPG key ID: 47C32433 IRC(freeenode): stardiviner Twitter: @numbchild Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 Blog: http://stardiviner.github.io/ On Tue, Nov 3, 2020 at 5:53 PM Sebastian Gimeno wrote: > Dear Stardiviner, > > I used the "scimax" configuration. Scimax's maintainer, John Kitchin, > helped me out to find the root cause of the problem, i.e. the following > addition to " python-font-lock-keywords": > > (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)))))) > > Commenting out this code snippet, the fontfying / HTML-export problem goes > away. > > Cheers, > sebastian > > > > > On Tue, Nov 3, 2020 at 6:50 AM stardiviner wrote: > >> I have same problem sometimes in different babel languages. >> I would like to know what caused this problem too. >> Can you send me a message after you solved problem? Thanks in advance. :) >> smile >> >> [stardiviner] GPG key ID: 47C32433 >> IRC(freeenode): stardiviner Twitter: @numbchild >> Key fingerprint = 9BAA 92BC CDDD B9EF 3B36 CB99 B8C4 B8E5 47C3 2433 >> Blog: http://stardiviner.github.io/ >> >> >> On Mon, Nov 2, 2020 at 2:26 AM Sebastian Gimeno >> wrote: >> >>> Hi, >>> >>> I am using emacs 27.1 and org-plus-contrib 20201026. >>> >>> I am having problems with the fontification of python and ipython >>> source blocks when the code contains curly brackets "{}" (other course >>> blocks are ok). For instance, the following snippet >>> >>> #+BEGIN_SRC python :results drawer >>> import matplotlib.pyplot as plt >>> plt.plot([1,2,3]) >>> plt.show() >>> a=1 >>> print("a={}".format{a}) >>> #+END_SRC >>> >>> does not fontify correctly in either python or ipython source blocks. >>> >>> As a consequence, when exporting the org file to HTML (C-c C-e h h), it >>> fails with the following message: >>> >>> font-lock-fontify-keywords-region: Invalid function: # >>> >>> If changing the code snippet to: >>> >>> #+BEGIN_SRC python :results drawer >>> import matplotlib.pyplot as plt >>> plt.plot([1,2,3]) >>> plt.show() >>> a=1 >>> print("a=%s" % a) >>> #+END_SRC >>> >>> the block fontifies and the file is exported to HTML correctly. >>> >>> Can you reproduce this behaviour? >>> >>> Many thanks in advance! >>> >> --00000000000055d3de05b33f7d22 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks for noting. :) I added that in my Emacs config now.=

[stardiviner]=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 <Hack this world!>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 GPG key ID: 4= 7C32433
IRC(freeenode): stardiviner =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0 Twitter:=C2=A0 @numbchild
Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B= 36=C2=A0 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Tue, Nov 3, 2020 at 5:53 PM Sebastian Gimeno <= ;changimeno@gmail.com> wrote= :
Dear Stardiviner,

I used = the "scimax" configuration. Scimax's maintainer, John Kitchin= , helped me out to find the root cause of the problem, i.e. the following a= ddition to " python-font-lock-keywords":
<= br>
(setq python-font-lock-keywords=C2=A0 =C2=A0 =C2=A0 (append python-font-lock-keywords
=C2=A0 =C2=A0 = =C2=A0'(;; this is the full string.
;; group 1 is the quote type a= nd a closing quote is matched
;; group 2 is the string part
(
= ;; "f\\(['\"]\\{1,3\\}\\)\\([^\\1]+?\\)\\1"
&qu= ot;f\\(['\"]\\{1,3\\}\\)\\(.+?\\)\\1"
;; these are the = {keywords}
("{[^}]*?}"
=C2=A0;; Pre-match form
= =C2=A0(progn (goto-char (match-beginning 0)) (match-end 0))
=C2=A0;; = Post-match form
=C2=A0(goto-char (match-end 0))
=C2=A0;; face f= or this match
=C2=A0(0 font-lock-variable-name-face t))))))
=

Commenting out this code snippet, the fontfying / HTML-= export problem goes away.

Cheers,
sebast= ian




On Tue, Nov 3, = 2020 at 6:50 AM stardiviner <numbchild@gmail.com> wrote:
I have same problem somet= imes in different babel languages.
I would like to know what caused t= his problem too.
Can you send me a message after you solved problem? T= hanks in advance. :) smile

[stardiviner]=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 <Hack this world!>= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 GPG key ID: 47C32433
IRC(freeenode): star= diviner =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 Twitter:=C2=A0 @numbchild<= br>Key fingerprint =3D 9BAA 92BC CDDD B9EF 3B36=C2=A0 CB99 B8C4 B8E5 47C3 2= 433
Blog: ht= tp://stardiviner.github.io/

=
On Mon= , Nov 2, 2020 at 2:26 AM Sebastian Gimeno <changimeno@gmail.com> wrote:
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">
Hi, =

I am using emacs 27.1 and=20 org-plus-contrib 20201026.

I am having problems with the fontification o= f python and ipython source blocks when the code = contains curly brackets "{}" (other course blocks are ok). For in= stance, the following snippet
#+BEGIN_SRC python :results drawer
import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.show()
a=3D1
print("a=3D{}".format{a})
#+END_SRC

does not fontify correctly in either python or ipytho= n source blocks.

As a consequence, when exporting the org file to HTML (C-c C-e h h), it = fails with the following message:

font-lock-fontify-keywords-region: Invalid function: #<subr p=
rogn>

If changing the code snippet to:

#+BEGIN_SRC python :results drawer
import matplotlib.pyplot as plt
plt.plot([1,2,3])
plt.show()
a=3D1
print("a=3D%s" % a)
#+END_SRC

the block fontifies and the file is exported to HTML correctly.

Can you reproduce this behaviour?

Many thanks in advance!

--00000000000055d3de05b33f7d22--