all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
@ 2024-06-25 17:53 Gabriele Nicolardi
  2024-06-25 21:52 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-26 12:39 ` bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains "; " Eli Zaretskii
  0 siblings, 2 replies; 17+ messages in thread
From: Gabriele Nicolardi @ 2024-06-25 17:53 UTC (permalink / raw)
  To: 71777

Hi,

I have this string expression in latex-mode:

$K(U_1, V_1, x_1; t_2, x_2)$

If the pointer is located on the opened "(" and I run "forward-sexp" it 
works and the
pointer goes after the closed ")".

But if, again, the pointer is located on the opened "(" and I evaluate
"(sexp-at-point)" it returns nil.

If I remove the ";" symbol from the expression it works and returns the 
sexp-at-point:

$K(U_1, V_1, x_1 t_2, x_2)$

Is it a bug?

Best regards,

Gabriele


In GNU Emacs 29.4 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20,
cairo version 1.16.0) of 2024-06-24 built on lcy02-amd64-050
Repository revision: 176061eb965cf945e7627ce87bb16ec5a03f8a4d
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
System Description: Ubuntu 20.04.6 LTS

Configured using:
'configure --prefix=/snap/emacs/current/usr --with-x-toolkit=gtk3
--without-xaw3d --with-modules --with-cairo
--with-native-compilation=aot --without-pgtk --with-xinput2
--with-tree-sitter --with-json
'CFLAGS=-isystem/build/emacs/parts/emacs/install/usr/include
-isystem/build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu
-isystem/build/emacs/stage/usr/include -O2'
'CPPFLAGS=-isystem/build/emacs/parts/emacs/install/usr/include
-isystem/build/emacs/parts/emacs/install/usr/include/x86_64-linux-gnu
-isystem/build/emacs/stage/usr/include'
'LDFLAGS=-L/build/emacs/parts/emacs/install/lib
-L/build/emacs/parts/emacs/install/usr/lib
-L/build/emacs/parts/emacs/install/lib/x86_64-linux-gnu
-L/build/emacs/parts/emacs/install/usr/lib/x86_64-linux-gnu
-L/build/emacs/stage/usr/lib''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER X11 XDBE XIM XINPUT2 XPM
GTK3 ZLIB

Important settings:
value of $LANG: it_IT.UTF-8
locale-coding-system: utf-8-unix

Major mode: LaTeX

Minor modes in effect:
shell-dirtrack-mode: t
tooltip-mode: t
global-eldoc-mode: t
show-paren-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
line-number-mode: t
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils tex-mode compile text-property-search
shell pcomplete comint ansi-osc ansi-color ring time-date cl-loaddefs
comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra
help-mode bytecomp byte-compile cl-lib rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 94745 6994)
(symbols 48 8180 0)
(strings 32 23981 1842)
(string-bytes 1 748444)
(vectors 16 18526)
(vector-slots 8 362068 6080)
(floats 8 40 162)
(intervals 56 343 0)
(buffers 984 12))






^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-25 17:53 bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";" Gabriele Nicolardi
@ 2024-06-25 21:52 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-25 22:51   ` Gabriele Nicolardi
  2024-06-26 12:39 ` bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains "; " Eli Zaretskii
  1 sibling, 1 reply; 17+ messages in thread
From: Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-25 21:52 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: 71777

Gabriele Nicolardi <gabriele@medialab.sissa.it> writes:

> Hi,
>
> I have this string expression in latex-mode:
>
> $K(U_1, V_1, x_1; t_2, x_2)$
>
> If the pointer is located on the opened "(" and I run "forward-sexp"
> it works and the
> pointer goes after the closed ")".
>
> But if, again, the pointer is located on the opened "(" and I evaluate
> "(sexp-at-point)" it returns nil.
>
> If I remove the ";" symbol from the expression it works and returns
> the sexp-at-point:
>
> $K(U_1, V_1, x_1 t_2, x_2)$
>
> Is it a bug?
>
> Best regards,
>
> Gabriele
>
>
> In GNU Emacs 29.4 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20,
> cairo version 1.16.0) of 2024-06-24 built on lcy02-amd64-050
> Repository revision: 176061eb965cf945e7627ce87bb16ec5a03f8a4d
> Repository branch: master
> Windowing system distributor 'The X.Org Foundation', version 11.0.12013000
> System Description: Ubuntu 20.04.6 LTS
>

> Important settings:
> value of $LANG: it_IT.UTF-8
> locale-coding-system: utf-8-unix
>
> Major mode: LaTeX

This suggests you are using the major mode from AUCTeX, rather than the
built-in latex-mode?  Is this right?





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-25 21:52 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-25 22:51   ` Gabriele Nicolardi
  0 siblings, 0 replies; 17+ messages in thread
From: Gabriele Nicolardi @ 2024-06-25 22:51 UTC (permalink / raw)
  To: Jeremy Bryant; +Cc: 71777

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

Il 25/06/24 23:52, Jeremy Bryant ha scritto:
>> Important settings:
>> value of $LANG: it_IT.UTF-8
>> locale-coding-system: utf-8-unix
>>
>> Major mode: LaTeX
> This suggests you are using the major mode from AUCTeX, rather than the
> built-in latex-mode?  Is this right?
No, I'm using the built-in latex-mode. AUCTeX is not installed on my 
machine.

[-- Attachment #2: Type: text/html, Size: 750 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains "; "
  2024-06-25 17:53 bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";" Gabriele Nicolardi
  2024-06-25 21:52 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-26 12:39 ` Eli Zaretskii
  2024-06-26 13:46   ` bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";" Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-26 12:39 UTC (permalink / raw)
  To: Gabriele Nicolardi, Stefan Monnier; +Cc: 71777

> Date: Tue, 25 Jun 2024 19:53:59 +0200
> From: Gabriele Nicolardi <gabriele@medialab.sissa.it>
> 
> I have this string expression in latex-mode:
> 
> $K(U_1, V_1, x_1; t_2, x_2)$
> 
> If the pointer is located on the opened "(" and I run "forward-sexp" it 
> works and the
> pointer goes after the closed ")".
> 
> But if, again, the pointer is located on the opened "(" and I evaluate
> "(sexp-at-point)" it returns nil.
> 
> If I remove the ";" symbol from the expression it works and returns the 
> sexp-at-point:
> 
> $K(U_1, V_1, x_1 t_2, x_2)$
> 
> Is it a bug?

I don't think it's a bug.  forward-sexp moves across balanced
expressions, so it is not specific to Lisp.  By contrast,
sexp-at-point is specific to Lisp and Lisp-like syntax, and so it uses
the buffer's syntax.  Which is why ';' affects the result.

Adding Stefan in case he has comments for this.





^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-26 12:39 ` bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains "; " Eli Zaretskii
@ 2024-06-26 13:46   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-26 15:52     ` Gabriele Nicolardi
  2024-06-26 19:43     ` Gabriele Nicolardi
  0 siblings, 2 replies; 17+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-26 13:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Gabriele Nicolardi, 71777

>> $K(U_1, V_1, x_1; t_2, x_2)$
>> 
>> If the pointer is located on the opened "(" and I run "forward-sexp" it 
>> works and the
>> pointer goes after the closed ")".
>> 
>> But if, again, the pointer is located on the opened "(" and I evaluate
>> "(sexp-at-point)" it returns nil.
>> 
>> If I remove the ";" symbol from the expression it works and returns the 
>> sexp-at-point:
>> 
>> $K(U_1, V_1, x_1 t_2, x_2)$
>> 
>> Is it a bug?
>
> I don't think it's a bug.  forward-sexp moves across balanced
> expressions, so it is not specific to Lisp.  By contrast,
> sexp-at-point is specific to Lisp and Lisp-like syntax, and so it uses
> the buffer's syntax.  Which is why ';' affects the result.
>
> Adding Stefan in case he has comments for this.

AFAICT, `sexp-at-point` correctly finds the parenthesized thingy, but it
is asked to return the Lisp object it represents rather than a string,
so it `read`s, which inevitably obeys the ELisp syntax.

IOW, I suspect you want (thing-at-point 'sexp) rather than
(sexp-at-point).


        Stefan






^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-26 13:46   ` bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";" Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-26 15:52     ` Gabriele Nicolardi
  2024-06-26 20:11       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-26 19:43     ` Gabriele Nicolardi
  1 sibling, 1 reply; 17+ messages in thread
From: Gabriele Nicolardi @ 2024-06-26 15:52 UTC (permalink / raw)
  To: Stefan Monnier, Eli Zaretskii; +Cc: 71777



Il 26/06/24 15:46, Stefan Monnier ha scritto:
>>> $K(U_1, V_1, x_1; t_2, x_2)$
>>>
>>> If the pointer is located on the opened "(" and I run "forward-sexp" it
>>> works and the
>>> pointer goes after the closed ")".
>>>
>>> But if, again, the pointer is located on the opened "(" and I evaluate
>>> "(sexp-at-point)" it returns nil.
>>>
>>> If I remove the ";" symbol from the expression it works and returns the
>>> sexp-at-point:
>>>
>>> $K(U_1, V_1, x_1 t_2, x_2)$
>>>
>>> Is it a bug?
>> I don't think it's a bug.  forward-sexp moves across balanced
>> expressions, so it is not specific to Lisp.  By contrast,
>> sexp-at-point is specific to Lisp and Lisp-like syntax, and so it uses
>> the buffer's syntax.  Which is why ';' affects the result.
>>
>> Adding Stefan in case he has comments for this.
> AFAICT, `sexp-at-point` correctly finds the parenthesized thingy, but it
> is asked to return the Lisp object it represents rather than a string,
> so it `read`s, which inevitably obeys the ELisp syntax.
>
> IOW, I suspect you want (thing-at-point 'sexp) rather than
> (sexp-at-point).
>
>
>          Stefan
I need to test if a parenthesis in LaTeX (latex-mode) starts a balanced 
expression.

sexp-at-point: Return the sexp at point, or nil if none is found.

This is not possible with (thing-at-point 'sexp) because it does no return nil in the case, e.g.:

$K(U_1, V_1, x_1 t_2, x_2$

Gabriele








^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-26 13:46   ` bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";" Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-26 15:52     ` Gabriele Nicolardi
@ 2024-06-26 19:43     ` Gabriele Nicolardi
  1 sibling, 0 replies; 17+ messages in thread
From: Gabriele Nicolardi @ 2024-06-26 19:43 UTC (permalink / raw)
  To: Stefan Monnier, Eli Zaretskii; +Cc: 71777

 From the previous responses, I have understood that the sexp-at-point 
function is not suitable for my purpose.
However, I suggest updating the documentation because the explanations 
you provided are not trivial, and the similarity in names with other 
functions (forward-sexp, etc.) creates misunderstandings.

Lastly, I would like to point out an issue on Stack Exchange:

https://emacs.stackexchange.com/q/81603/15606

where I asked for help with a function that fits my needs.

Thank you!

Gabriele

Il 26/06/24 15:46, Stefan Monnier ha scritto:
>>> $K(U_1, V_1, x_1; t_2, x_2)$
>>>
>>> If the pointer is located on the opened "(" and I run "forward-sexp" it
>>> works and the
>>> pointer goes after the closed ")".
>>>
>>> But if, again, the pointer is located on the opened "(" and I evaluate
>>> "(sexp-at-point)" it returns nil.
>>>
>>> If I remove the ";" symbol from the expression it works and returns the
>>> sexp-at-point:
>>>
>>> $K(U_1, V_1, x_1 t_2, x_2)$
>>>
>>> Is it a bug?
>> I don't think it's a bug.  forward-sexp moves across balanced
>> expressions, so it is not specific to Lisp.  By contrast,
>> sexp-at-point is specific to Lisp and Lisp-like syntax, and so it uses
>> the buffer's syntax.  Which is why ';' affects the result.
>>
>> Adding Stefan in case he has comments for this.
> AFAICT, `sexp-at-point` correctly finds the parenthesized thingy, but it
> is asked to return the Lisp object it represents rather than a string,
> so it `read`s, which inevitably obeys the ELisp syntax.
>
> IOW, I suspect you want (thing-at-point 'sexp) rather than
> (sexp-at-point).
>
>
>          Stefan
>






^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-26 15:52     ` Gabriele Nicolardi
@ 2024-06-26 20:11       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-26 20:18         ` Gabriele Nicolardi
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-26 20:11 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: Eli Zaretskii, 71777

> I need to test if a parenthesis in LaTeX (latex-mode) starts
> a balanced expression.

You mentioned `forward-sexp` which should do the trick, so what made you
try `sexp-at-point`?

> sexp-at-point: Return the sexp at point, or nil if none is found.
>
> This is not possible with (thing-at-point 'sexp) because it does no return nil in the case, e.g.:
>
> $K(U_1, V_1, x_1; t_2, x_2$

The "<foo>-at-point" functions (by the very nature of the concept of
"foo at point") are DWIMish functions.
They're usually not appropriate for use from ELisp code unless that
ELisp code itself wants to be DWIMish.


        Stefan






^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-26 20:11       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-26 20:18         ` Gabriele Nicolardi
  2024-06-26 20:25           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 17+ messages in thread
From: Gabriele Nicolardi @ 2024-06-26 20:18 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, 71777

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

Il 26/06/24 22:11, Stefan Monnier ha scritto:
>> I need to test if a parenthesis in LaTeX (latex-mode) starts
>> a balanced expression.
> You mentioned `forward-sexp` which should do the trick, so what made you
> try `sexp-at-point`?
Because `forward-sexp` does not return nil if the parenthesis does not 
start a balanced expression.

Gabriele

[-- Attachment #2: Type: text/html, Size: 780 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-26 20:18         ` Gabriele Nicolardi
@ 2024-06-26 20:25           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-26 20:40             ` Gabriele Nicolardi
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-26 20:25 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: Eli Zaretskii, 71777

>>> I need to test if a parenthesis in LaTeX (latex-mode) starts
>>> a balanced expression.
>> You mentioned `forward-sexp` which should do the trick, so what made you
>> try `sexp-at-point`?
> Because `forward-sexp` does not return nil if the parenthesis does not start
> a balanced expression.

There is no function that does just what you want; you need to make them
do what you want.  E.g.

    (save-excursion
      (condition-case nil
          (progn (forward-sexp 1) t)
        (scan-error nil)))

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






^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-26 20:25           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-26 20:40             ` Gabriele Nicolardi
  2024-06-26 21:04               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 17+ messages in thread
From: Gabriele Nicolardi @ 2024-06-26 20:40 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, 71777

[-- Attachment #1: Type: text/plain, Size: 932 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1297 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-26 20:40             ` Gabriele Nicolardi
@ 2024-06-26 21:04               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-26 21:14                 ` Gabriele Nicolardi
  2024-06-26 21:26                 ` Gabriele Nicolardi
  0 siblings, 2 replies; 17+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-26 21:04 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: Eli Zaretskii, 71777

> The `forward-sexp` function does not necessarily give an error if the
> parenthesis does not start a balanced expression. E.g.
>
> $( x + y ]$

Yup.  Most of the functions that are meant to be used to parse code
while it's being edited don't check validity.  Basically they try to
find "what is the meaning of this text" rather than "does this text have
meaning".  That's on purpose, because it makes them more usable even
when the text is not 100% valid.

`read` (which parses an ELisp s-exp and is used in `sexp-at-point` to
try and turn the string "( x + y ]" (found by `forward-sexp) into a Lisp
value) is one of the rare exceptions because that one is not meant to
parse text as you type it but rather to parse text in order to process
it (typically, to execute it).

But it obeys the ELisp syntax rather than the LaTeX syntax.

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

I don't think there's code in Emacs which does what you want, so if you
really need to check proper pairing you're going to have to write the code.


        Stefan






^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-26 21:04               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-26 21:14                 ` Gabriele Nicolardi
  2024-06-26 21:26                 ` Gabriele Nicolardi
  1 sibling, 0 replies; 17+ messages in thread
From: Gabriele Nicolardi @ 2024-06-26 21:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, 71777

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]


> I don't think there's code in Emacs which does what you want, so if you
> really need to check proper pairing you're going to have to write the code.
>
>
>          Stefan
Thank you very much!

Gabriele

[-- Attachment #2: Type: text/html, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-26 21:04               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-26 21:14                 ` Gabriele Nicolardi
@ 2024-06-26 21:26                 ` Gabriele Nicolardi
  2024-06-26 22:19                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 17+ messages in thread
From: Gabriele Nicolardi @ 2024-06-26 21:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, 71777

[-- Attachment #1: Type: text/plain, Size: 379 bytes --]


> I don't think there's code in Emacs which does what you want, so if you
> really need to check proper pairing you're going to have to write the code.
>
>
>          Stefan
FYI. NickD offers me this code 
https://emacs.stackexchange.com/a/81604/15606:

|(defun ndk/paren-match-p () (let ((mismatch (nth 4 
(show-paren--default)))) (not mismatch))) It seems working. Gabriele |

[-- Attachment #2: Type: text/html, Size: 1229 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-26 21:26                 ` Gabriele Nicolardi
@ 2024-06-26 22:19                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-06-27  6:01                     ` Gabriele Nicolardi
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-06-26 22:19 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: Eli Zaretskii, 71777

> |(defun ndk/paren-match-p () (let ((mismatch (nth 4 (show-paren--default))))
>  (not mismatch))) It seems working. Gabriele |

AFAIK It only checks the outside pair of parens.
E.g. it won't detect the problem in

    ((a + b])


- Stefan






^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-26 22:19                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-06-27  6:01                     ` Gabriele Nicolardi
  2024-06-29 12:25                       ` Eli Zaretskii
  0 siblings, 1 reply; 17+ messages in thread
From: Gabriele Nicolardi @ 2024-06-27  6:01 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Eli Zaretskii, 71777

[-- Attachment #1: Type: text/plain, Size: 334 bytes --]


>> |(defun ndk/paren-match-p () (let ((mismatch (nth 4 (show-paren--default))))
>>   (not mismatch))) It seems working. Gabriele |
> AFAIK It only checks the outside pair of parens.
> E.g. it won't detect the problem in
>
>      ((a + b])
>
>
> - Stefan
it is good for me because it cover the case, e.g.:

B=((1,3)∪(2,5])

Gabriele

[-- Attachment #2: Type: text/html, Size: 2060 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread

* bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";"
  2024-06-27  6:01                     ` Gabriele Nicolardi
@ 2024-06-29 12:25                       ` Eli Zaretskii
  0 siblings, 0 replies; 17+ messages in thread
From: Eli Zaretskii @ 2024-06-29 12:25 UTC (permalink / raw)
  To: Gabriele Nicolardi; +Cc: 71777-done, monnier

> Date: Thu, 27 Jun 2024 08:01:13 +0200
> Cc: Eli Zaretskii <eliz@gnu.org>, 71777@debbugs.gnu.org
> From: Gabriele Nicolardi <gabriele@medialab.sissa.it>
> 
> it is good for me because it cover the case, e.g.:
> 
> B=((1,3)∪(2,5])

Thanks, I've now made clear in the doc string that sexp-at-point is
for returning Lisp objects, and I'm therefore closing this bug.





^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2024-06-29 12:25 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-25 17:53 bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";" Gabriele Nicolardi
2024-06-25 21:52 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-25 22:51   ` Gabriele Nicolardi
2024-06-26 12:39 ` bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains "; " Eli Zaretskii
2024-06-26 13:46   ` bug#71777: 29.4; sexp-at-point in latex-mode when sexp contains ";" Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-26 15:52     ` Gabriele Nicolardi
2024-06-26 20:11       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-26 20:18         ` Gabriele Nicolardi
2024-06-26 20:25           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-26 20:40             ` Gabriele Nicolardi
2024-06-26 21:04               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-26 21:14                 ` Gabriele Nicolardi
2024-06-26 21:26                 ` Gabriele Nicolardi
2024-06-26 22:19                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-27  6:01                     ` Gabriele Nicolardi
2024-06-29 12:25                       ` Eli Zaretskii
2024-06-26 19:43     ` Gabriele Nicolardi

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.