all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* (match-end 0) returns 1 instead of the actual position
@ 2022-12-22 23:18 Yuan Fu
  2022-12-22 23:24 ` Emanuel Berg
  2022-12-23  0:04 ` Stefan Monnier via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 5+ messages in thread
From: Yuan Fu @ 2022-12-22 23:18 UTC (permalink / raw)
  To: help-gnu-emacs

Hi,

This doesn’t happen with vanilla Emacs, but I couldn’t tell which part of my config is causing it. Basically if I run

(looking-at "xxx")
(match-end 0)

It returns 1 instead of the end of xxx after point.

Is there any user option that would affect this that I’m not aware of?

I tried bisecting but the issue doesn’t always reproduce. (It reproduce reliably when I enable all configuration, but not when I comment out parts of the config…)

Thanks,
Yuan


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

* Re: (match-end 0) returns 1 instead of the actual position
  2022-12-22 23:18 (match-end 0) returns 1 instead of the actual position Yuan Fu
@ 2022-12-22 23:24 ` Emanuel Berg
  2022-12-24  0:51   ` Yuan Fu
  2022-12-23  0:04 ` Stefan Monnier via Users list for the GNU Emacs text editor
  1 sibling, 1 reply; 5+ messages in thread
From: Emanuel Berg @ 2022-12-22 23:24 UTC (permalink / raw)
  To: help-gnu-emacs

Yuan Fu wrote:

> This doesn’t happen with vanilla Emacs, but I couldn’t tell
> which part of my config is causing it. Basically if I run
>
> (looking-at "xxx")
> (match-end 0)
>
> It returns 1 instead of the end of xxx after point.
>
> Is there any user option that would affect this that I’m not aware of?
>
> I tried bisecting but the issue doesn’t always reproduce.
> (It reproduce reliably when I enable all configuration, but
> not when I comment out parts of the config ...)

... we'll consider this a "slip", eh :)

Do the binary search algorithm of your code, Google that if
you don't know what it refers to in this contex, when you
understand it you'll see that you can pinpoint the bug or
misconfiguration very easily and quickly.

You can then tell us what it was, also!

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: (match-end 0) returns 1 instead of the actual position
  2022-12-22 23:18 (match-end 0) returns 1 instead of the actual position Yuan Fu
  2022-12-22 23:24 ` Emanuel Berg
@ 2022-12-23  0:04 ` Stefan Monnier via Users list for the GNU Emacs text editor
  2022-12-24  0:50   ` Yuan Fu
  1 sibling, 1 reply; 5+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-12-23  0:04 UTC (permalink / raw)
  To: help-gnu-emacs

> This doesn’t happen with vanilla Emacs, but I couldn’t tell which part of my
> config is causing it. Basically if I run
>
> (looking-at "xxx")
> (match-end 0)

Define "run".

These are 2 expressions and the result will depend on how you combine
them (more specifically it depends on what code might be run in-between).

> It returns 1 instead of the end of xxx after point.

Any chance you used `C-x C-e` or `M-C-x` twice, meaning that a whole lot
of things like timers, `post-command-hook`s and whatnot can/will run
between the two?


        Stefan




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

* Re: (match-end 0) returns 1 instead of the actual position
  2022-12-23  0:04 ` Stefan Monnier via Users list for the GNU Emacs text editor
@ 2022-12-24  0:50   ` Yuan Fu
  0 siblings, 0 replies; 5+ messages in thread
From: Yuan Fu @ 2022-12-24  0:50 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: help-gnu-emacs



> On Dec 22, 2022, at 4:04 PM, Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> wrote:
> 
>> This doesn’t happen with vanilla Emacs, but I couldn’t tell which part of my
>> config is causing it. Basically if I run
>> 
>> (looking-at "xxx")
>> (match-end 0)
> 
> Define "run".
> 
> These are 2 expressions and the result will depend on how you combine
> them (more specifically it depends on what code might be run in-between).
> 
>> It returns 1 instead of the end of xxx after point.
> 
> Any chance you used `C-x C-e` or `M-C-x` twice, meaning that a whole lot
> of things like timers, `post-command-hook`s and whatnot can/will run
> between the two?

Ah that’s exactly it, I used M-; twice. That’s why I can’t bisect out anything meaningful. Thanks!

Yuan


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

* Re: (match-end 0) returns 1 instead of the actual position
  2022-12-22 23:24 ` Emanuel Berg
@ 2022-12-24  0:51   ` Yuan Fu
  0 siblings, 0 replies; 5+ messages in thread
From: Yuan Fu @ 2022-12-24  0:51 UTC (permalink / raw)
  To: Emanuel Berg; +Cc: help-gnu-emacs



> On Dec 22, 2022, at 3:24 PM, Emanuel Berg <incal@dataswamp.org> wrote:
> 
> Yuan Fu wrote:
> 
>> This doesn’t happen with vanilla Emacs, but I couldn’t tell
>> which part of my config is causing it. Basically if I run
>> 
>> (looking-at "xxx")
>> (match-end 0)
>> 
>> It returns 1 instead of the end of xxx after point.
>> 
>> Is there any user option that would affect this that I’m not aware of?
>> 
>> I tried bisecting but the issue doesn’t always reproduce.
>> (It reproduce reliably when I enable all configuration, but
>> not when I comment out parts of the config ...)
> 
> ... we'll consider this a "slip", eh :)
> 
> Do the binary search algorithm of your code, Google that if
> you don't know what it refers to in this contex, when you
> understand it you'll see that you can pinpoint the bug or
> misconfiguration very easily and quickly.
> 
> You can then tell us what it was, also!

As Stefan pointed it out, it was my slip in how I ran the test. I did try bisecting but that didn’t turn up anything because I ran the code in the wrong way.

Yuan


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

end of thread, other threads:[~2022-12-24  0:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-22 23:18 (match-end 0) returns 1 instead of the actual position Yuan Fu
2022-12-22 23:24 ` Emanuel Berg
2022-12-24  0:51   ` Yuan Fu
2022-12-23  0:04 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-12-24  0:50   ` Yuan Fu

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.