From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id eAgpKRlcNGHoWQAAgWs5BA (envelope-from ) for ; Sun, 05 Sep 2021 07:56:41 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id WLjtJBlcNGGsSAAA1q6Kng (envelope-from ) for ; Sun, 05 Sep 2021 05:56:41 +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 BBEF91ED79 for ; Sun, 5 Sep 2021 07:56:39 +0200 (CEST) Received: from localhost ([::1]:34166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMl8w-00081F-T9 for larch@yhetil.org; Sun, 05 Sep 2021 01:56:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48212) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMl8R-00080z-CF for emacs-orgmode@gnu.org; Sun, 05 Sep 2021 01:56:08 -0400 Received: from mail-db8eur06olkn2014.outbound.protection.outlook.com ([40.92.51.14]:8481 helo=EUR06-DB8-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMl8K-0007HF-Bc for emacs-orgmode@gnu.org; Sun, 05 Sep 2021 01:56:06 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ci7ajwiQHbkWcbnsehUtO3LYWpx437FGBrEbq+nwu5NQqHyeBC08DC9nx9eTxxxwA+5buWHSyI8SunoVSjyutSrBnNWWl034qoMVR4oPpC69qwY2s5r+DU5cGwSGjigRLNvqrj7y7yVNRGxaKNCEjcL549uBmLdvSdDAu4Ql8YygqDfaf6c5oJHy+FPPz7kNG9YTt/eRz2KWf4pkrpLPvgDQxHKCBwJ68y9QNCCvgi/Mx5p6AVi+XDmfmWrwAPr6iM4kAF1aXmBwX+NjDngriAu7aH5vOARjMDLM6WmvD5d/4oc8PQgtKBtcw+Sq9lppZhO6MacFg5gLbnRpSGvveQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=VxkfxXk34TEnoDqk2JoS8HLRoKH7Le54tpElmQSTyLc=; b=TRicKyYX/k2n7DYEaCAHv3tMCpZLm44B1dP76CLY/+G+N6Za8+IDV0VHVjPeDo0rNgHNDTq91IAp9vuJ//TDgVapuNdFAfXXzmMouCcEln8QFN9fiOxQqhO9x89Q24e6kbOAK4fsRFggFwuqv5q2py3kwBZagmzFi7BFFFp04hmjKv/GOJfoAu38NpV0r6Zf75E+NkknkRGgd/1P5NpJ4pU6NS31ZE8qhb1QC5a2/8Qq566Hh/rQnlCaa+QT3/InkmsojNWOA0jM6wwc5N2n65Qn9AltKynU2oFxRnMnAoPZCFJbXbkdZMLsPoVXTx9hzTbBKb/8TbsD1kmRhWEJtQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VxkfxXk34TEnoDqk2JoS8HLRoKH7Le54tpElmQSTyLc=; b=ub82jN/oBG0U/gPfhjPCs8+lWbaywByPgps0xFq7ZN16/PqOJj3ebVgrsDaKnc4YHHi/aTetg+saAEWS1moRUOI/M83Bpdn8/mwDFSrKUm6055Z4b3O/VP2c1OhrKCx7NZY/A81spx4v4Zlh/Xwihzvs00yhO1lEVeT8JuO95DNEcV6ylN9U+Ii9fOd9mW08FhlFtce2+cnsjaf9hP6tWh/BXAqUeSabvIi9tQd74EQiofsJ0ImOIi8VZD/m/C5iay64a8KAzekBL/JJnFAM/Lqf12JP1lp8tLXm369kMP7zgFuEb0eFP5DuRrMRSWZOyU/vEy8Cb0aZrSaAhfyONA== Received: from DB8EUR06FT063.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc35::45) by DB8EUR06HT154.eop-eur06.prod.protection.outlook.com (2a01:111:e400:fc35::118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19; Sun, 5 Sep 2021 05:55:57 +0000 Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2a01:111:e400:fc35::4e) by DB8EUR06FT063.mail.protection.outlook.com (2a01:111:e400:fc35::367) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.19 via Frontend Transport; Sun, 5 Sep 2021 05:55:57 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:94D72C1FBA5694E8B550398F9C8F2AB08ABCC2EF5BFE46575F86CE129554DE02; UpperCasedChecksum:4EBA5434AD2A2423E32D798134B5DA26707D6B7D842D51821CBEC641EC5B00D4; SizeAsReceived:7819; Count:46 Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::c55c:ece5:bed2:a9dc%8]) with mapi id 15.20.4478.025; Sun, 5 Sep 2021 05:55:57 +0000 From: Arthur Miller To: Tim Cross Subject: Re: Bug Re: Greater than, less than bug in emacs-lisp source block References: <3b398cbe-19d5-7006-d854-4a8693d217bb@verizon.net> <87pmtpojq8.fsf@gmail.com> <87eea4nj6f.fsf@gmail.com> Date: Sun, 05 Sep 2021 07:55:56 +0200 In-Reply-To: <87eea4nj6f.fsf@gmail.com> (Tim Cross's message of "Sun, 05 Sep 2021 07:05:43 +1000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Content-Type: text/plain X-TMN: [RUidtU12dEa0CABNjrmP9j8kTWTxt7LG] X-ClientProxiedBy: AS8PR04CA0002.eurprd04.prod.outlook.com (2603:10a6:20b:310::7) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <875yvfbm6r.fsf@live.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from pascal.homepc (81.232.177.30) by AS8PR04CA0002.eurprd04.prod.outlook.com (2603:10a6:20b:310::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.20 via Frontend Transport; Sun, 5 Sep 2021 05:55:56 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 46 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: e33f2085-aacd-41bd-621a-08d97031d481 X-MS-TrafficTypeDiagnostic: DB8EUR06HT154: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tYxCMP9e7Kw0hsr5Xs902FsjouelBVhNrCtb16uYA3xH5oxXgEygt8/83ncFldtz0/GhcJFTQarEqRA+prAszd7jMs/iyBRmebXQmMuSYm/4x2crT7m+2r0fjtySFHNSEdj40FZqZCObxJbp+AMMzieftXsXQDAi1zuJFZpVfufDDyn7jY34Jus92R4LlsG0/RvjJppbUNEozpfRWNjQncUuynSHun1t2zW6a+wucnJKZp6UO7UCqiH7gMUl9lF4Dg0v65/CuilBsiT9cnB4PQEUsybPV426NVsC/yb3tzh5acF/FHn6DSnyPtv1HxoWdKl1uOf4bxJ/mvrtPMU4hwfPF1b+9j6IVVA3qr5R6+JEfUQY5VFPjiwwZnmVJKvOY6uDX+1rKvWfVKNp6imXL4cTD309yfU5i5dRsddU6riILUNoRkx2HKRLyA8A1EPl0qT7rPhMa+X+TWzXn+h4syQaZly13ePKfQqLuhl3d64= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: B5jjz9+KxwyQ/Gv/UOesck+xVEQoNbkuK+O5G53Gg3LGzvR7vj/X/4Hi1X9gCPpJBQqUHcRmCQkz7b3qclefJeCHeBK6O7LACJ14oIoEyLIEqhqT6CerO3b+AGXrJI5cDYiVO52Udam/1uP9MBDtfw== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: e33f2085-aacd-41bd-621a-08d97031d481 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2021 05:55:57.4735 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DB8EUR06FT063.eop-eur06.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8EUR06HT154 Received-SPF: pass client-ip=40.92.51.14; envelope-from=arthur.miller@live.com; helo=EUR06-DB8-obe.outbound.protection.outlook.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, FREEMAIL_FROM=0.001, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-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-email , John Kitchin Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630821401; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=VxkfxXk34TEnoDqk2JoS8HLRoKH7Le54tpElmQSTyLc=; b=XR9ZN/GE45dfTLGJqOoHUBaMy2BL3if1EIxF/6iBw/LVPWTmMUgbpvh6KqjwkZmxxM2bo4 ijNmslNFbmZ0ZpygLRYqvhId8sitPB5OdseM+fAcODyFsjMMasj7TepT0cNrl7isMUjseO /NGCOuxAI6MxGLexrwkgmazwNLJWfCfaVOXzHFPoi/Fso/Z+vyl1rl+nuNMZcL2Yk51jI2 HiE9Jl7aLSJ3mzskUf+7aunCPOTXqOTe+iKZqzjmXAEOLvxe1ajY2jGQZZQ4eEIAgq4SIO pB5a1HRiBEdHiAGl5qdN3Sv+GQnp30HqaWH4zMUa7anyE9+QaJa3C1bSREXyJA== ARC-Seal: i=2; s=key1; d=yhetil.org; t=1630821401; a=rsa-sha256; cv=pass; b=PC14rzUxtLBhTfe2xCrYfagCLwX41211E+NzPD0BG1ytSe5LHbAa+nYQrdEuFsnLT+SrWl rM6p7fYf0d3K4Pyiz7MeMgzguuSESn7utihl179qoyEsR9hruXmB4099a2QTZIh1LwLQ/D BSjfRTcPiDFkh4LxerUWoFGs7C/LXj1DkdH2lC8kC/ZPpBu3M85EqQyXRRJ28qJJ34B+xs jFpGMU4QSownaSKwJbrSwD20+ECHr7K2Rr/DXz1X7csnmxCodeBLWxlG9zgV5yICyg+szK XzarsxFaU1POco446Kn2L6SxgVgNw3C8UQl0jhiLOvj3Kegvi2+3FoUia/pJBw== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=live.com header.s=selector1 header.b="ub82jN/o"; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=live.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-Migadu-Spam-Score: -2.61 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=live.com header.s=selector1 header.b="ub82jN/o"; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=live.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-Migadu-Queue-Id: BBEF91ED79 X-Spam-Score: -2.61 X-Migadu-Scanner: scn1.migadu.com X-TUID: 3dOy0Ibpve4X Tim Cross writes: > John Kitchin writes: > >> My previous solution seems like it stopped working for some reason. Here is a new version that "should" only change syntax >> inside src-blocks, but not inside strings. >> >> It looks like this does not impact html blocks, or xml blocks. >> >> It is probably possible to make it mode specific if needed. >> >> (defun scimax-org-mode-<>-syntax-fix (start end) >> "Change syntax of characters ?< and ?> to symbol within source code blocks." >> ;; I think this gets run in a special edit buffer for src-blocks. For now I >> ;; only run this in the src blocks, so that outside the src-blocks these still >> ;; act like b=open/close brackets. >> (when (org-src-edit-buffer-p) >> (let ((case-fold-search t)) >> (goto-char start) >> ;; this "fixes" <>, {} and [] that fixes some issues in src blocks, but >> ;; makes some new issues, which is now you cannot use them as brackets. >> ;; this tries to be fancy and not change the syntax in strings. >> (while (re-search-forward "[[<{]\\|[]>}]" end t) >> (unless (ppss-string-terminator (syntax-ppss (point))) >> (put-text-property (point) (1- (point)) >> 'syntax-table (string-to-syntax "_"))))))) >> >> (defun scimax-fix-<>-syntax () >> "Fix syntax of <> in code blocks. >> This function should be added to `org-mode-hook' to make it work." >> (setq syntax-propertize-function 'scimax-org-mode-<>-syntax-fix) >> (syntax-propertize (point-max))) >> >> (add-hook 'org-mode-hook >> #'scimax-fix-<>-syntax) >> >> John >> >> ----------------------------------- >> Professor John Kitchin (he/him/his) >> Doherty Hall A207F >> Department of Chemical Engineering >> Carnegie Mellon University >> Pittsburgh, PA 15213 >> 412-268-7803 >> @johnkitchin >> http://kitchingroup.cheme.cmu.edu >> >> On Fri, Sep 3, 2021 at 9:47 AM Tim Cross wrote: >> >> I think what is happening here is that org is bumping up against >> fundamental design limitations of Emacs. In basic terms, much of Emacs' >> underlying design is based on an assumption that a file only has a >> single major mode. Org works hard to get around this limitation, but it >> comes with cost - usually either performance or complexity. >> >> I think this could probably be characterised as a bug without a workable >> solution. While there are things youc an do, they all seem to have >> unwanted side effects. To what extent those side effect impact you >> depends on your use case (as John points out, if you have blocks of HTML >> or XML or JSX etc, changing the syntax table to make < and > 'normal' >> characters would fix the elisp issue, but break things in those source >> blocks. >> >> So really, what we have is an issue without a clean solution. Best >> anyone can do is select one of the proposed work-arounds which has >> minimal impact on the user. Personally, I never edit source blocks >> except in the special edit mode, so don't really notice the problem with >> mismatched parens. >> > > If this does work without unwanted side effects or negative performance > impact, then it probably should be considered for inclusion in org as it > seem pretty clean and straight-forward. I haven't tested the updated version of JK's proposal, but looking at the source it seems to be a tad bit resource heavy. If it isn't a hassle for the OP to use aliases like lt, gt or similar, I would suggest that either using macros or simple defalias to rename those few functions, <,<=,> and >= is more resource effective way. If code is tangled and byte compiled, macros will be expanded in byte code, so effectively the runtime cost is almost none. > I have to wonder why it hasn't > given how long this issue has been known about? That is a good question, maybe proper solution is very hard if not impossible? Like you said, Emacs is really not meant to be used with several major modes active as once. Seems like this is one of those places where it shows off.