From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id KH7EA1DgM2EIEwEAgWs5BA (envelope-from ) for ; Sat, 04 Sep 2021 23:08:32 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id kGsUO0/gM2ErXgAA1q6Kng (envelope-from ) for ; Sat, 04 Sep 2021 21:08:31 +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 56FC8142A7 for ; Sat, 4 Sep 2021 23:08:31 +0200 (CEST) Received: from localhost ([::1]:49882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mMcto-0004J5-JG for larch@yhetil.org; Sat, 04 Sep 2021 17:08:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mMctL-0004Io-I4 for emacs-orgmode@gnu.org; Sat, 04 Sep 2021 17:07:59 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:52896) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mMctJ-0007Xz-QZ for emacs-orgmode@gnu.org; Sat, 04 Sep 2021 17:07:59 -0400 Received: by mail-pj1-x102b.google.com with SMTP id d5so1877076pjx.2 for ; Sat, 04 Sep 2021 14:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version; bh=YElyKF7HKHtyNsrK+pkNSqnoDMDOGlqZzOVLYpolTIk=; b=LmgaEZTbUgjKzBc6vMQIWBvifc4RpW+/GydnJojzKWYq4o1HWYyl6yiKspTAGn7rq2 BDeoUNTbhnIfo+QpNRpyYgyrf50j5kp+YKfzRiUixE6mKkG6JvoUICtSq82x37rXqLVc MCvgW6x7ANknTmQm0D6KW50Col1hXwUZjMNXm7zHPjI5I9cqcnkTCIHA1VYLYSVMaua2 Lw3DB3oVpAjY2SxMJBiGi57XjcJoklDTipzEr3bOZNrbLA7LP4+h8nw4fVaRpqVISTS9 RA80QLXkDBoqIPzmSewSvFLvc8YbU54s4E0LLnANmweO1cKAProWQX83TGGY3JMzYNmZ iUsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version; bh=YElyKF7HKHtyNsrK+pkNSqnoDMDOGlqZzOVLYpolTIk=; b=Gy8cNLGHeZ8RA9kjHlhhNqnJclEwcy7KI3rD0ayQb6qtNBHo7j7VEGyMl3eNSb3eny x+piw54B86LYQfPCRgk6HuOqtwDhCusRuQw/XCeqM1+mlHPb7Y7P4TymPLCklGKY9YeB qQ2LD/8WLdJ4rHh4T5OVg4hZCPx/O9nl41/ZTjNEH7HLKb88C7u3VqM4a3mOipZAFT0e o3bVvKeu7qewnB4z2r4H5JgC7W1IsRTf7r9Wcd3j45L140WkERLncisrIZHfoNmrQFzR NvKLJIDgzL8XqIL9MLtVEOIyQgYdDCkMZCAfPYVok3stWavsTnxK6GnZu8wKlL3yB0Uk 5Mqg== X-Gm-Message-State: AOAM532Gllx4yE8vVVE7bMUGoMn4a91OvyAk5/Bx1BkA9k0DaNA+DZEA zSbAi6AgXdOiix95gibbsBzbl/Bl+zw= X-Google-Smtp-Source: ABdhPJyvjlIl5rk8sP2kZc0UlDhIt4q5FTs2yQYU7TbYKBEkryIFuwhtBbTKknIVnxkPBlmt7moHQw== X-Received: by 2002:a17:90a:a389:: with SMTP id x9mr5817199pjp.167.1630789676086; Sat, 04 Sep 2021 14:07:56 -0700 (PDT) Received: from tim-desktop (220-235-1-77.dyn.iinet.net.au. [220.235.1.77]) by smtp.gmail.com with ESMTPSA id c133sm3076956pfb.39.2021.09.04.14.07.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Sep 2021 14:07:55 -0700 (PDT) References: <3b398cbe-19d5-7006-d854-4a8693d217bb@verizon.net> <87pmtpojq8.fsf@gmail.com> User-agent: mu4e 1.7.0; emacs 27.2.50 From: Tim Cross To: John Kitchin Subject: Re: Bug Re: Greater than, less than bug in emacs-lisp source block Date: Sun, 05 Sep 2021 07:05:43 +1000 In-reply-to: Message-ID: <87eea4nj6f.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=theophilusx@gmail.com; helo=mail-pj1-x102b.google.com 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, 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-email Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1630789711; 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=YElyKF7HKHtyNsrK+pkNSqnoDMDOGlqZzOVLYpolTIk=; b=ASzNOfqlkjPPmEpHb/SPmtCGHrS0hcDo/QVn+VMS0TgcbSy8ltz/69vlhlEqo3VEQqpxYu Jj3REzBoZmQWs/6vumScpfS8881X7/Mq8prMWczZ3BwyghCmBlNNeMB4AvQR8YMC3JKppK zHnaHP0gHQ+VaIABvAuRlyP36X0K2i/lHaEn74BTll+MaAIE4Ur2L+vVq2DNc/qup4GpJR 4h9BeakbaoLaAXMKLE5FL0HbNyFXew5n3Cd7VyK54CssFJrgmSp27mDcCe/NydbnbmEZff 0wLKfeqQw46icO6/hXP6ujY1z2XrR+uU3+0nQCJK0vEvXUjYrd7NRkYS4Z9v3g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1630789711; a=rsa-sha256; cv=none; b=odUUoscBzqiOov7YcM2sYHrOYtZIKX6YUNqe37XYPd0Xafj8WkHMFnBoC6bMvLM0efufI9 R61Lp3G6lX4mVwgZ1V1K6ao+8UHsWjdYulA8nLRrs56ONndsWRTR1PFrHgICgKL5CtAiFU RwZHTcHUTx26nRjaG+iMnmas7qcAI6rFRa8e8VU+6HnL3S86Kk0MAB6pgm0kQHE64eK3qK BvGfPbqJpZH814PWV2Tl98l3tPHhIkS5VOVtUW8p5kZYICP3BZ2pQJXl5LfLetmfYTAehL 7DK2Uq6e0LZPuP23MqG9ulPfnP6LCrdwWfAaZvKuaItPcOhDdwdS6OqEqJmF7Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LmgaEZTb; 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-Migadu-Spam-Score: -1.62 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=LmgaEZTb; 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-Migadu-Queue-Id: 56FC8142A7 X-Spam-Score: -1.62 X-Migadu-Scanner: scn0.migadu.com X-TUID: e0uLIAVMHuMB 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 have to wonder why it hasn't given how long this issue has been known about?