[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Macro aborts even though regexp instance exists

From: Stefan Monnier
Subject: Re: Macro aborts even though regexp instance exists
Date: Wed, 24 Oct 2012 11:23:56 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux)

> Hi emacs users,
> I write a simple macro which works, however, it fails in a particular case.
> C-s M-r
> to get into isearch-forward-regexp
> and give a regexp like ONE\|TWO
> It works for every TWO and ONE as long as there is a ONE ahead of TWO.
> In the last instance, no ONE exists after TWO and it fails.
> to the original position when OR is entered and proceeds forward from
> there, but perhaps, the macro aborts.

Indeed, that's a problem: the macro aborts because macros abort not only
on error but also when `ding' is called.

> Any solutions?

You can work around the problem in this particular case as follows:
first do C-s M-r ONE\|TWO RET, and then record your macro using C-u C-s
C-s to recall the last regexp used, so it gets inserted "all at once"
without going through the problematic intermediate state (which is not
when it gets to \ but rather when it gets to ON or ONE and it doesn't
match anything).  Maybe isearch-search shouldn't call ding when the
match fails and we're matching regexps (and the match failed because of
a new char being added to search regexp, rather than because the user
hit C-s to jump to the next match).

Please M-x report-emacs-bug,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]