From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Espen Newsgroups: gmane.emacs.help Subject: Re: Macro aborts even though regexp instance exists - Serious Bug Date: Fri, 30 Nov 2012 17:55:13 -0500 Organization: A noiseless patient Spider Message-ID: References: <08df09b8-18cc-4d23-9f2e-b1187f4cfdec__5446.52010216868$1350938726$gmane$org@g8g2000yqp.googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1354317019 9810 80.91.229.3 (30 Nov 2012 23:10:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 Nov 2012 23:10:19 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Dec 01 00:10:31 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TeZiz-0001OS-2U for geh-help-gnu-emacs@m.gmane.org; Sat, 01 Dec 2012 00:10:25 +0100 Original-Received: from localhost ([::1]:38765 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TeZin-0003A6-5R for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Nov 2012 18:10:13 -0500 Original-Received: by 10.180.74.74 with SMTP id r10mr27323wiv.3.1354316859263; Fri, 30 Nov 2012 15:07:39 -0800 (PST) Original-Path: usenet.stanford.edu!m3no85117wim.1!news-out.google.com!ha8ni97430wib.1!nntp.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!ecngs!feeder2.ecngs.de!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 80 Injection-Info: mx04.eternal-september.org; posting-host="960b39603e44c0554faedf0065e3beaf"; logging-data="1536"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/RXnM4roNbAyfcJBo8H/cBKDQ4ky8jS7Y=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.3 (gnu/linux) Cancel-Lock: sha1:+Gq15FifKYHSFjD89IV0oox0Y4g= sha1:gVKhYJADgtynYqrvjiyXW3K6JJ8= Original-Xref: usenet.stanford.edu gnu.emacs.help:195663 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87984 Archived-At: dkcombs@panix.com (David Combs) writes: > In article , > Kevin Rodgers wrote: >>On 10/22/12 2:40 PM, Swami Tota Ram Shankar wrote: >>> 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. >> >>It is not a bug: when ONE fails to match the buffer, C-s (which is designed >>for interactive use, obviously) signals an error, which terminates the macro >>execution. >> >>That's because there is no way for C-s to know that you _might_ type \|TWO >>after ONE. >> >>So the solution is to make sure that the regexp is not complete after ONE: >>C-s \(ONE\|TWO\) >> >>> 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. >> >>Yes, there is a lot of confusion and wasted time when a user is not aware >>of how to use a program. >> >>> I include more newsgroups because of the seriousness of this bug. >> >>Whatever :-) > > (1) THANKS FOR THAT HINT/WARNING/INFO! > > (2) "when a user is not aware of how to use a program": I don't know > that this thread really falls under that. Although your solution > and especially the reason for it "obvious" -- but only once you've > seen it. It's actually a little subtle. > > AND I believe it's so important (and easy to get wrong) that > it should be added to the emacs manual (in macros) AND to > any much-used cheat-sheets -- plus the wiki, of course. > > Perhaps you (as one of the real gurus around here) could write > a paragraph and example and ask the developers to put it into > the right places. A keyboard macro is terminated by anything that rings the bell. I can't seem to find that in the emacs help though. I would have expected to see it in "^h k M-x (". Also, my bell hasn't rung in a long time, looking around, I have the built in speaker disabled. So: (setq ring-bell-function (lambda () (play-sound-file "/home/dan/audio/tap2.au"))) -- Dan Espen