From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id iPQvJod9oV+yZgAA0tVLHw (envelope-from ) for ; Tue, 03 Nov 2020 15:55:51 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id eAABIod9oV+rVQAAbx9fmQ (envelope-from ) for ; Tue, 03 Nov 2020 15:55:51 +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 B410D9403A6 for ; Tue, 3 Nov 2020 15:55:50 +0000 (UTC) Received: from localhost ([::1]:33982 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZyez-0006yd-HM for larch@yhetil.org; Tue, 03 Nov 2020 10:55:49 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:59074) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZyeU-0006xJ-Vb for emacs-orgmode@gnu.org; Tue, 03 Nov 2020 10:55:18 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:38803) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kZyeS-0000k5-BA for emacs-orgmode@gnu.org; Tue, 03 Nov 2020 10:55:18 -0500 Received: by mail-wm1-x336.google.com with SMTP id h62so8457728wme.3 for ; Tue, 03 Nov 2020 07:55:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=andrew-cmu-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NbwKoAuZy7pyybCqE9TX7oTdfbgrw8v8NWFoi31fZ+s=; b=ZzaC6DyJZnncJTyhOWDob9XGBEndvFJIwnvt/YpPLyCkEJgaPaBTUFlXa30UN0rg0L 8HpnnKpWBHlZN5HiJMgKEGpyXxUAxStFSqnOd9y3/LkbUI5hQWymil7IWCtH838Uaym8 o6TcMyJ6KFo17RlOy/ImhnK9lUBQD6RcUrPUnjYobYTVsQNClJwMtF5i9sOj1jbpbET8 YMRdiwqN6J2DPrNBMYHHZ0SH8qQ+u/u7lPeqD7T3BJXUsP+NJxMMJX/CHGocMH6mwqLM seze39SDcSXEzOZoZNUnqn+ycHya5ToiaXeocahISr5bhBMj/RB3xm0b5PdrXwXOyanj pi0w== 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=NbwKoAuZy7pyybCqE9TX7oTdfbgrw8v8NWFoi31fZ+s=; b=l3loCrb16o+2xGHhRo0ZYQhclKg9NqgDdMT4M0PLTYiEYkVAjnIpFtM0B/oylpfGl8 Ya1i96fhzSXqAG3JaWXsTot6w1e9GvaIvu+vP/nnJW9ClfBjtcr46pTWKBTz6dxr50b7 1F0rHovdEN+j4c27nCARCdkw2WuTcSOCfQjPXuszoGctEVUBmpR7wUpemxMlrqElHw42 bC0rX56JC2pGfeHK3dvLq2cioCjkppjU5J3y/YXVFVGKYx/sUfxbbrAach+mxBI1cuv8 FbhjlOrXP6wBpdKpR4tK06MPuRcNUPW2kXMB4wjENGAm1tJ6tm9sRUTFRSRJHhd+OMed XwHw== X-Gm-Message-State: AOAM5306c9cRWqpn8qWgkJPW3COmK+R6Ffp92IAMRtpNFvM0Zl5/komR /IN64EfQnhjB6a7c0ryZPPPl7h98igvCu0Dy2SA= X-Google-Smtp-Source: ABdhPJwxY4ViX+K/bpVCkYT+z1qaMD6xSfortT7p7+7OOEP6XzE8DD+75O9B+lKMc8pKagx+fpIju9RJEHnP+/mHrOM= X-Received: by 2002:a7b:c089:: with SMTP id r9mr398130wmh.45.1604418914317; Tue, 03 Nov 2020 07:55:14 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: John Kitchin Date: Tue, 3 Nov 2020 10:55:03 -0500 Message-ID: Subject: Re: Org mode fontification error in # in python and ipython source blocks To: Sebastian Gimeno Content-Type: multipart/alternative; boundary="000000000000757cda05b335e3d2" Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=johnrkitchin@gmail.com; helo=mail-wm1-x336.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: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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=fail (headers rsa verify failed) header.d=andrew-cmu-edu.20150623.gappssmtp.com header.s=20150623 header.b=ZzaC6DyJ; dmarc=fail reason="SPF not aligned (relaxed)" header.from=andrew.cmu.edu (policy=none); 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: 0.09 X-TUID: tv95hk33UKEo --000000000000757cda05b335e3d2 Content-Type: text/plain; charset="UTF-8" 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! John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu On Tue, Nov 3, 2020 at 4:55 AM 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! >>> >> --000000000000757cda05b335e3d2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Does anyone see anything wrong with that snippet? All it s= hould 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!
John
-----------------------------------
Professor John Kitchin=C2=A0Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mello= n University
Pittsburgh, PA 15213
412-268-7803
<= /div>

On Tue, Nov 3, 2020 at 4:55 AM Sebastian Gimeno <changimeno@gmail.com> wrote:
Dear Stardiviner,

I used the &quo= t;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":
<= 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 p= roblem sometimes in different babel languages.
I would lik= e to know what caused this problem too.
Can you send me a = message after you solved problem? Thanks 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 G= PG key ID: 47C32433
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 3B36=C2=A0 CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Mon, Nov 2, 2020 at 2:26 AM Sebastia= n Gimeno <chan= gimeno@gmail.com> wrote:
Hi,

I a= m 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!

--000000000000757cda05b335e3d2--