GNU bug report logs - #58029
28.2; Struct boundaries ignored by bounds-of-thing-at-point

Previous Next

Package: emacs;

Reported by: Richard Hopkins <emacs <at> unbit.co.uk>

Date: Fri, 23 Sep 2022 16:29:01 UTC

Severity: normal

Found in version 28.2

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 58029 in the body.
You can then email your comments to 58029 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#58029; Package emacs. (Fri, 23 Sep 2022 16:29:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Richard Hopkins <emacs <at> unbit.co.uk>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 23 Sep 2022 16:29:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Richard Hopkins <emacs <at> unbit.co.uk>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.2; Struct boundaries ignored by bounds-of-thing-at-point
Date: Fri, 23 Sep 2022 16:14:31 +0100
I think this is a bug - any thoughts on the following?

The initial "#s" as part of printed structures are ignored by
`bounds-of-thing-at-point' which means it will

a) pick up the wrong expression when inside the printed struct; and
b) ignore the struct even when point is on the initial "#"

The following `emacs -Q` recipe should help show the interaction
between the struct representation and whether it's picked up by
`bounds-of-thing-at-point'.

(require 'cl-lib)
(cl-defstruct foo a)
(make-foo :a 1)
;; => #s(foo 1)

;; Bounds should be found starting from 1, but is nil
(with-temp-buffer
  (insert (prin1-to-string (make-foo :a 1)))
  (goto-char (point-min))
  (list
   (buffer-string)
   (bounds-of-thing-at-point 'sexp)
   (prin1-to-string (read (current-buffer)))))
;; => ("#s(foo 1)" nil "#s(foo 1)")

;; Whilst there is a list from point, the boundary should be
;; adjusted backwards as it's part of a struct.
(with-temp-buffer
  (insert (prin1-to-string (make-foo :a 1)))
  (goto-char (point-min))
  (forward-char 2)
  (list
   (buffer-string)
   (bounds-of-thing-at-point 'sexp)
   (prin1-to-string (read (current-buffer)))))
;; => ("#s(foo 1)" (3 . 10) "(foo 1)")

In GNU Emacs 28.2 (build 1, x86_64-pc-cygwin)
 of 2022-09-15 built on fv-az140-985
Repository revision: 70134aa8264ded36d80248204b2ba43ae3d8f599
Repository branch: master
Windowing system distributor 'Microsoft Corp.', version 10.0.19044
Configured using:
 'configure
 
--srcdir=/cygdrive/d/a/scallywag/emacs/emacs-28.2-1.x86_64/src/emacs-28.2
 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc
 --docdir=/usr/share/doc/emacs --htmldir=/usr/share/doc/emacs/html -C
 --with-w32 'CFLAGS=-ggdb -O2 -pipe -Wall -Werror=format-security
 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector-strong
 --param=ssp-buffer-size=4
 
-fdebug-prefix-map=/cygdrive/d/a/scallywag/emacs/emacs-28.2-1.x86_64/build=/usr/src/debug/emacs-28.2-1
 
-fdebug-prefix-map=/cygdrive/d/a/scallywag/emacs/emacs-28.2-1.x86_64/src/emacs-28.2=/usr/src/debug/emacs-28.2-1'
 CPPFLAGS= LDFLAGS='

Configured features:
ACL DBUS GIF GLIB GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES
NOTIFY GFILENOTIFY PDUMPER PNG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS
XIM XPM ZLIB

Important settings:
  value of $LC_CTYPE: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  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
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util rmail
rmail-loaddefs auth-source eieio eieio-core eieio-loaddefs
password-cache json map text-property-search seq byte-opt bytecomp
byte-compile cconv mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils thingatpt cl-seq cl-macs gv time-date
subr-x cl-loaddefs cl-lib iso-transl tooltip eldoc paren electric
uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
disp-table term/w32-win w32-win w32-vars term/common-win 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 cl-generic 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 simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
gfilenotify w32 lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 53485 7761)
 (symbols 48 6799 1)
 (strings 32 19933 2170)
 (string-bytes 1 623050)
 (vectors 16 13667)
 (vector-slots 8 177937 11466)
 (floats 8 28 287)
 (intervals 56 293 24)
 (buffers 992 11))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58029; Package emacs. (Sat, 24 Sep 2022 12:15:02 GMT) Full text and rfc822 format available.

Message #8 received at 58029 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Richard Hopkins <emacs <at> unbit.co.uk>
Cc: 58029 <at> debbugs.gnu.org
Subject: Re: bug#58029: 28.2; Struct boundaries ignored by
 bounds-of-thing-at-point
Date: Sat, 24 Sep 2022 14:14:26 +0200
Richard Hopkins <emacs <at> unbit.co.uk> writes:

> The initial "#s" as part of printed structures are ignored by
> `bounds-of-thing-at-point' which means it will

I can reproduce this in Emacs 28.2, but not in Emacs 29, so it looks
like this has been fixed already.




bug marked as fixed in version 29.1, send any further explanations to 58029 <at> debbugs.gnu.org and Richard Hopkins <emacs <at> unbit.co.uk> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sat, 24 Sep 2022 12:15:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58029; Package emacs. (Sat, 24 Sep 2022 13:34:02 GMT) Full text and rfc822 format available.

Message #13 received at 58029 <at> debbugs.gnu.org (full text, mbox):

From: Richard Hopkins <emacs <at> unbit.co.uk>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 58029 <at> debbugs.gnu.org
Subject: Re: bug#58029: 28.2; Struct boundaries ignored by
 bounds-of-thing-at-point
Date: Sat, 24 Sep 2022 14:33:41 +0100
On 2022-09-24 13:14, Lars Ingebrigtsen wrote:
> I can reproduce this in Emacs 28.2, but not in Emacs 29, so it looks
> like this has been fixed already.

Thanks for checking, however, I still get the same issue on what I
believe is Emacs 29...

$ src/emacs --version
GNU Emacs 29.0.50
Development version 1556b4376457 on master branch; build date 
2022-09-24.

As this also affects `backward-sexp' etc I was looking into a general
patch, but as it works for you I wonder if I'm running the wrong
version?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58029; Package emacs. (Sat, 24 Sep 2022 13:43:02 GMT) Full text and rfc822 format available.

Message #16 received at 58029 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Richard Hopkins <emacs <at> unbit.co.uk>
Cc: 58029 <at> debbugs.gnu.org
Subject: Re: bug#58029: 28.2; Struct boundaries ignored by
 bounds-of-thing-at-point
Date: Sat, 24 Sep 2022 15:42:40 +0200
Richard Hopkins <emacs <at> unbit.co.uk> writes:

> Thanks for checking, however, I still get the same issue on what I
> believe is Emacs 29...

It only recognises these constructs if you're in a buffer where the
syntax rules say so.  So try:

(with-temp-buffer
  (insert (prin1-to-string (make-foo :a 1)))
  (emacs-lisp-mode)
  (goto-char (point-min))
  (list
   (buffer-string)
   (bounds-of-thing-at-point 'sexp)
   (prin1-to-string (read (current-buffer)))))

=> ("#s(foo 1)" (1 . 10) "#s(foo 1)")




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#58029; Package emacs. (Sat, 24 Sep 2022 14:03:02 GMT) Full text and rfc822 format available.

Message #19 received at 58029 <at> debbugs.gnu.org (full text, mbox):

From: Richard Hopkins <emacs <at> unbit.co.uk>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 58029 <at> debbugs.gnu.org
Subject: Re: bug#58029: 28.2; Struct boundaries ignored by
 bounds-of-thing-at-point
Date: Sat, 24 Sep 2022 15:02:18 +0100
On 2022-09-24 14:42, Lars Ingebrigtsen wrote:
> It only recognises these constructs if you're in a buffer where the
> syntax rules say so.  So try:
> 
> (with-temp-buffer
>   (insert (prin1-to-string (make-foo :a 1)))
>   (emacs-lisp-mode)
>   (goto-char (point-min))
>   (list
>    (buffer-string)
>    (bounds-of-thing-at-point 'sexp)
>    (prin1-to-string (read (current-buffer)))))
> 
> => ("#s(foo 1)" (1 . 10) "#s(foo 1)")

Ah, thanks for the pointer.  It works for me too (and `backward-sexp')
starting from Emacs 29 when the relevant mode is set, including the
scratch buffer with `lisp-interaction-mode'.

Please close, thanks.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 23 Oct 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 182 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.