unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Evans Winner <thorne@timbral.net>
To: help-gnu-emacs@gnu.org
Subject: Re: Stop a macro from terminating on beep
Date: Thu, 02 Apr 2009 00:43:13 -0600	[thread overview]
Message-ID: <864ox7r1xa.fsf@timbral.net> (raw)
In-Reply-To: mailman.4426.1238645012.31690.help-gnu-emacs@gnu.org

kazza765 <lowe.john@gmail.com> writes:

    So, basically I'm trying to do what the title
    suggests. I have a macro that searches through a file,
    finds an instance of the text I'm looking for, and
    deletes the next three lines. I then have another macro
    that runs \C-u10000000\C-[xname-of-macro
    \C-x\C-s\C-x\C-c , so I want it to exit after tha macro
    is finished. This works fine in macros that don't cause
    a beep, and I can run them using emacs -f name-of-macro,
    but the system beep that occurs when this macro can't
    find any more matching patterns causes the macro to
    abort, and doesn't execute the save and quit
    commands. Is there any way around this? Or is there any
    better way to execute a search macro an unknown number
    of times and still have emacs exit afterwards?

This may not be helpful, because I am not sure I understand
what you are asking.  When you say ``macro'' I think you are
talking about an interactive search-and-replace text
function of some kind.  Is this a function you are writing?
If so, it might be helpful to note that some of the search
functions take arguments like a limit, or what to do on
error.  For instance:

,----[ C-h f search-forward RET ]
| search-forward is an interactive built-in function in `C source code'.
| 
| It is bound to <find>.
| 
| (search-forward STRING &optional BOUND NOERROR COUNT)
| 
| Search forward from point for STRING.
| Set point to the end of the occurrence found, and return point.
| An optional second argument bounds the search; it is a buffer position.
| The match found must not extend after that position.  A value of nil is
|   equivalent to (point-max).
| Optional third argument, if t, means if fail just return nil (no error).
|   If not nil and not t, move to limit of search and return nil.
| Optional fourth argument is repeat count--search for successive occurrences.
| 
| Search case-sensitivity is determined by the value of the variable
| `case-fold-search', which see.
| 
| See also the functions `match-beginning', `match-end' and `replace-match'.
`----

So something like--

,----
| (search-forward "nonexistent string" (point-max) t)
`----

--won't signal a "beep," as I understand it.  

Anyway if you're using lisp, you might post your code; as
for keyboard macros, I don't know much about them, if that's
what you're using, but someone might.  You could post more
specific details.


       reply	other threads:[~2009-04-02  6:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.4426.1238645012.31690.help-gnu-emacs@gnu.org>
2009-04-02  6:43 ` Evans Winner [this message]
2009-04-02  9:28 ` Stop a macro from terminating on beep harven
2009-04-01 22:51 kazza765

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=864ox7r1xa.fsf@timbral.net \
    --to=thorne@timbral.net \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).