Tuesday, September 22, 2026

Re: No error with ]s when nowrapscan?

On Tue, 22 Sept 2026 at 22:42, Tim Chase <vim@tim.thechases.com> wrote:
On 2026-09-22 22:06, Doug Kearns wrote:
> >   $ vim one.txt two.txt three.txt
> >   :set hidden nowrapscan
> >
> > I then repeatedly issued
> >
> >   :try | exec 'norm ]s' | catch | n | endtry
> >
> > (using @: then subsequently @@ makes this easy) which worked for
> > finding all the misspelled words in the *first* file, but after
> > finding the last one in that file, the ]s *should* fail because
> > there is no "next" bad-spelling in the current file and wrapscan is
> > off.  So it seems like the ]s *should* have thrown an exception, get
> > caught, and then go to the :next file instead where the process can
> > repeat.  But it seems to silently swallow the "no more bad spellings
> > in the current file" without letting me catch the condition.
[snip]
> You could leverage temporary use of `:set debug=beep`.

A promising proposition, but I'm not sure that's working for me?

I tried the your suggestion with each of

  debug=beep
  debug=throw
  debug=throw,beep

but none of them change the behavior of the ]s (not) throwing an error
to get caught.  I do see "Beep!" text at the bottom of my screen when I
expect the exception/catch, but no catchable error seems to happen.

Yes, I was thinking you could test for that text calling execute().  I also forgot there's an assert_beeps() but you'd probably want to save restore v:errors.

Perhaps just checking for a change in cursor position is good enough?

Regards,
Doug [not in a dev environment]

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/vim_use/CAJ1uvoBK3VZrh-FM1qBEtMnCcAdXGKnBK%2B1QKJLsteZgy_FmZw%40mail.gmail.com.

No comments: