unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Macro aborts even though regexp instance exists
@ 2012-10-22 20:39 Swami Tota Ram Shankar
  2012-10-24 15:23 ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Swami Tota Ram Shankar @ 2012-10-22 20:39 UTC (permalink / raw)
  To: bug-gnu-emacs

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.

\| <=> OR or disjunction.

Any solutions?

This is such a fundamental issue that I think its a bug. When the C-s
M-r  is used outside the macro definition, the cursor gladly returns
to the original position when OR is entered and proceeds forward from
there, but perhaps, the macro aborts.

I guess, this can lead to a lot of confusion and time wastage, if the
user is unaware of this and most likely to neglect it because its
contrary to normal usage.




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

* Re: Macro aborts even though regexp instance exists
  2012-10-22 20:39 Macro aborts even though regexp instance exists Swami Tota Ram Shankar
@ 2012-10-24 15:23 ` Stefan Monnier
  2012-10-24 16:00   ` bug#12722: " Andreas Schwab
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2012-10-24 15:23 UTC (permalink / raw)
  To: bug-gnu-emacs

> 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,


        Stefan


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

* bug#12722: Macro aborts even though regexp instance exists
  2012-10-24 15:23 ` Stefan Monnier
@ 2012-10-24 16:00   ` Andreas Schwab
  2012-10-24 16:17     ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Schwab @ 2012-10-24 16:00 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 12722

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> 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,

Another workaround is to put \( \) around it so that the regexp isn't
complete until the closing paren.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."





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

* bug#12722: Macro aborts even though regexp instance exists
  2012-10-24 16:00   ` bug#12722: " Andreas Schwab
@ 2012-10-24 16:17     ` Glenn Morris
  0 siblings, 0 replies; 4+ messages in thread
From: Glenn Morris @ 2012-10-24 16:17 UTC (permalink / raw)
  To: 12722


Here we see yet another instance why the newsgroup interface should not
be used for bug reports. None of the context is visible in

http://debbugs.gnu.org/12722

I'm not tidying it up.

Also, things should not be triple posted to gnu.emacs.help, comp.emacs,
and gnu.emacs.bug. From the help-gnu-emacs list description:
  "Please don't send bug reports here, or to the comp.emacs newsgroup;"





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

end of thread, other threads:[~2012-10-24 16:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-22 20:39 Macro aborts even though regexp instance exists Swami Tota Ram Shankar
2012-10-24 15:23 ` Stefan Monnier
2012-10-24 16:00   ` bug#12722: " Andreas Schwab
2012-10-24 16:17     ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).