From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gabriele Nicolardi Newsgroups: gmane.emacs.bugs Subject: bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";" Date: Wed, 26 Jun 2024 22:40:17 +0200 Message-ID: References: <86v81v98u0.fsf@gnu.org> <52e6657e-3cc4-4671-8676-86e9959d9bc1@medialab.sissa.it> <3ef0543b-8380-40b5-9bd1-949e24ca3c77@medialab.sissa.it> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------0oBxY7aB7kveqQJq0M3oO19k" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20907"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Eli Zaretskii , 71777@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jun 26 22:41:09 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sMZS1-0005CK-Ms for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 26 Jun 2024 22:41:09 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sMZRu-0001yg-Op; Wed, 26 Jun 2024 16:41:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sMZRs-0001yE-11 for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2024 16:41:00 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMZRr-0003Gt-PY for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2024 16:40:59 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sMZRu-0000az-2U for bug-gnu-emacs@gnu.org; Wed, 26 Jun 2024 16:41:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gabriele Nicolardi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 26 Jun 2024 20:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 71777 X-GNU-PR-Package: emacs Original-Received: via spool by 71777-submit@debbugs.gnu.org id=B71777.17194344292233 (code B ref 71777); Wed, 26 Jun 2024 20:41:02 +0000 Original-Received: (at 71777) by debbugs.gnu.org; 26 Jun 2024 20:40:29 +0000 Original-Received: from localhost ([127.0.0.1]:40422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMZRM-0000Zx-TR for submit@debbugs.gnu.org; Wed, 26 Jun 2024 16:40:29 -0400 Original-Received: from smtp01.cbsolt.net ([185.97.217.40]:35028) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sMZRL-0000Zj-AD for 71777@debbugs.gnu.org; Wed, 26 Jun 2024 16:40:28 -0400 Original-Received: from [10.0.2.15] (host-79-44-242-88.retail.telecomitalia.it [79.44.242.88]) by smtp01.cbsolt.net (Postfix) with ESMTPSA id 4W8YVT6J4mz3wcP; Wed, 26 Jun 2024 22:40:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cbsolt.net; s=201504-di4k2w; t=1719434418; bh=AUBck7iqXVjq7KmE84prolN/GO0Bq0eCGUwkLOZR8DA=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=CxR0FCh8fVmujAOXzwrRtSk40eNc7cq8PF4ixFpEQY4+4csssMeNJA8jPy3rLJTd6 jmRjfwHdjLA/mTcCgV9RXE2wFJmdZ/gv0e3831SgbLQIjVBljZUi0uDw7/gsrFRvsv bq2roAjgbHstxSErPRGxGc5pITKtX3RkZ2mixkCs= Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:287966 Archived-At: This is a multi-part message in MIME format. --------------0oBxY7aB7kveqQJq0M3oO19k Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Il 26/06/24 22:25, Stefan Monnier ha scritto: > Note that "test if a parenthesis in LaTeX (latex-mode) starts a balanced > expression" is a kind of weird request, because it will only return nil > if there's a missing close-paren but not if there are too many > close-parens, i.e. it only detects one half of the imbalances. > > > Stefan For my purposes it is enough. I need to write a function to interactively resize mathematical parentheses based on their content, such as "\left( ... \right)". So far, I have successfully used `sexp-at-point`, but this function does not recognize balanced expressions that contain ";" and only works with "(" and "[" but not with < etc.. The `forward-sexp` function does not necessarily give an error if the parenthesis does not start a balanced expression. E.g. $( x + y ]$ here "(" does not start a balanced expression but `forward-sexp` does not return an error. Gabriele --------------0oBxY7aB7kveqQJq0M3oO19k Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit Il 26/06/24 22:25, Stefan Monnier ha scritto:
Note that "test if a parenthesis in LaTeX (latex-mode) starts a balanced
expression" is a kind of weird request, because it will only return nil
if there's a missing close-paren but not if there are too many
close-parens, i.e. it only detects one half of the imbalances.


        Stefan
For my purposes it is enough.

I need to write a function to interactively resize mathematical parentheses based on their content, such as "\left( ... \right)". So far, I have successfully used `sexp-at-point`, but this function does not recognize balanced expressions that contain ";" and only works with "(" and "[" but not with < etc..

The `forward-sexp` function does not necessarily give an error if the parenthesis does not start a balanced expression. E.g.

$( x + y ]$

here "(" does not start a balanced expression but `forward-sexp` does not return an error.

Gabriele
--------------0oBxY7aB7kveqQJq0M3oO19k--