all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Using interactive functions in functions
@ 2002-12-06 21:24 Bill Wohler
  0 siblings, 0 replies; 3+ messages in thread
From: Bill Wohler @ 2002-12-06 21:24 UTC (permalink / raw)


  Consider the following fragment which runs tags-query-replace on a
  number of strings:

    (let ((strings '("foo" "bar")))
      (while strings
	(tags-query-replace (car strings) "newstring")
	(setq strings (cdr strings)))

  However, this loop ends when tags-query-replace returns the first time
  so "bar" is never replaced.

  What magic do I need to wrap tags-query-replace in to continue with
  the rest of the strings?

--
Bill Wohler <wohler@newt.com>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.

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

* Re: Using interactive functions in functions
       [not found] <mailman.1039209908.7595.help-gnu-emacs@gnu.org>
@ 2002-12-06 21:49 ` Michael Slass
  2002-12-06 23:18 ` Stefan Monnier <foo@acm.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Slass @ 2002-12-06 21:49 UTC (permalink / raw)


Bill Wohler <wohler@newt.com> writes:

>  Consider the following fragment which runs tags-query-replace on a
>  number of strings:
>
>    (let ((strings '("foo" "bar")))
>      (while strings
>	(tags-query-replace (car strings) "newstring")
>	(setq strings (cdr strings)))
>
>  However, this loop ends when tags-query-replace returns the first time
>  so "bar" is never replaced.
>

What happens if you use query-replace (which see) instead?
-- 
Mike Slass

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

* Re: Using interactive functions in functions
       [not found] <mailman.1039209908.7595.help-gnu-emacs@gnu.org>
  2002-12-06 21:49 ` Michael Slass
@ 2002-12-06 23:18 ` Stefan Monnier <foo@acm.com>
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier <foo@acm.com> @ 2002-12-06 23:18 UTC (permalink / raw)


>>>>> "Bill" == Bill Wohler <wohler@newt.com> writes:
>   Consider the following fragment which runs tags-query-replace on a
>   number of strings:
>     (let ((strings '("foo" "bar")))
>       (while strings
> 	(tags-query-replace (car strings) "newstring")
> 	(setq strings (cdr strings)))
>   However, this loop ends when tags-query-replace returns the first time
>   so "bar" is never replaced.
>   What magic do I need to wrap tags-query-replace in to continue with
>   the rest of the strings?

I'm not sure exactly how tags-query-replace terminates, but if
it ends up short-circuiting the loop above, then it's either through
`signal' or `throw'.  A quick investigation shows it's probably not
`throw', so try something like

         (condition-case err
             (tags-query-replace ...)
           (error
            (if (examine err if you feel like it)
                (do something)
              (do something else))))


-- Stefan

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

end of thread, other threads:[~2002-12-06 23:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-12-06 21:24 Using interactive functions in functions Bill Wohler
     [not found] <mailman.1039209908.7595.help-gnu-emacs@gnu.org>
2002-12-06 21:49 ` Michael Slass
2002-12-06 23:18 ` Stefan Monnier <foo@acm.com>

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.