[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#69239: 30.0.50; number-at-point and bounds-of-thing-at-point disagre
From: |
Eli Zaretskii |
Subject: |
bug#69239: 30.0.50; number-at-point and bounds-of-thing-at-point disagree |
Date: |
Sat, 24 Feb 2024 11:17:20 +0200 |
> From: Visuwesh <visuweshm@gmail.com>
> Date: Fri, 16 Feb 2024 17:56:20 +0530
>
>
> The bounds returned by (bounds-of-thing-at-point 'number) does not match
> the bounds of the number returned by number-at-point. To demonstrate:
>
> 1. emacs -Q
> 2. Write any number in the scratch buffer, say 14.6.
> 3. With point on the number, say M-: (number-at-point) RET and
> observe 14.6 being returned.
> 4. Now say,
>
> M-: (let ((x (bounds-of-thing-at-point 'number))) (buffer-substring
> (car x) (cdr x))) RET
>
> and observe the incorrect value of 14 being returned.
>
> This is because the 'forward-op' property for 'number' thing is
> forward-word which fails in certain modes (not just in Elisp buffers,
> but also in LaTeX buffers). What do you think about a patch like below
> that adds an explicit bounds-of-thing-at-point property to 'number'
> thing?
We could perhaps add something like this, but I don't think
bounds-of-thing-at-point can call THING-at-point for some THING,
because thing-at-point will cal bounds-of-thing-at-point, so this
could lead to an infinite recursion, right? So the implementation
will need to change not to call number-at-point.