emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parens matching errors in org-babel code blocks


From: Tim Cross
Subject: Re: Parens matching errors in org-babel code blocks
Date: Wed, 22 Dec 2021 05:20:54 +1100
User-agent: mu4e 1.7.5; emacs 28.0.90

I think this is a known problem (Org probably needs a PROBLEMS or
KNOWN_PROBLEMS file in addition to a NEWS file).

Problem is that org treats things like <> as special paren syntax
because they are used by org. Unfortunately, this causes problems with
things like paren matching in org files if you also have code which uses
these characters 'unmatched' e.g. (< 1 2) or (> 2 1). This is partly due
to things like check-parens, which doens't really know about babel code
blocks and so just uses the syntax table to find all characters marked
as parenthesis type syntax characters and generates an error when they
are not matched/closed.

Issue is, there is no universal and clean way to fix this which
doesn't have unwanted side effects in some use cases or has an impact on
speed/performance.

There was one solution proposed a couple of months ago which looked
promising, but it didn't seem to gain any traction. Not sure why. You
can probably find it in the archives. 

One solution which can work is to modify the syntax table for org
buffers to not mark things like < and > as syntax parens. However, this
can have other side effects, depending on how you use org.

What I do is not have paren matching or run check-parens in org buffers.
I also use org-edit-special (C-c ') to edit babel blocks as this gives
me the 'normal' language setup and things like check-parens or parens
matching work correctly.

Eddie Drury <eddie.drury@gmail.com> writes:

> Inside org-babel code blocks, emacs matches parens incorrectly whenever 
> different bracket types (eg <> {} []) are used. 
>
> For example the following in an .org file will cause check-parens to throw an 
> error:
>
> #+BEGIN_SRC emacs-lisp 
>
>   (> 1 0)
>
> #+END_SRC 
>
> Where in an .el it will interpret the parens correctly. This error also 
> occurs with show-paren-mode and evil-jump-item. 
>
> Thanks very much. 
>
> Emacs  : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, 
> cairo version 1.17.4)
>  of 2021-03-27
> Package: Org mode version 9.4.4 (release_9.4.4 @ 
> /usr/share/emacs/27.2/lisp/org/)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]