From: Michael Olson <mwolson@member.fsf.org>
Subject: Re: gnus-replace-in-string: Avoid inf-loop in XEmacs
Date: Thu, 20 Apr 2006 10:18:19 -0400 [thread overview]
Message-ID: <87y7y0wct0.fsf@tuxtanker.mwolson.org> (raw)
In-Reply-To: <v9bquwe6pf.fsf_-_@marauder.physik.uni-ulm.de> (Reiner Steib's message of "Thu, 20 Apr 2006 15:07:24 +0200")
[-- Attachment #1: Type: text/plain, Size: 1442 bytes --]
Reiner Steib <reinersteib+gmane@imap.cc> writes:
> Is it just a wrapper around `replace-in-string' or is it Emacs
> implementation of `replace-regexp-in-string'? Hm...
Whatever it is, it doesn't seem to work properly.
After a bug report from an XEmacs user, I now use the following
function to provide this functionality for Emacs Muse.
(defun muse-replace-regexp-in-string (regexp replacement text &optional fixedcase literal)
"Replace REGEXP with REPLACEMENT in TEXT.
If fourth arg FIXEDCASE is non-nil, do not alter case of replacement text.
If fifth arg LITERAL is non-nil, insert REPLACEMENT literally."
(cond
((fboundp 'replace-in-string)
(replace-in-string text regexp replacement literal))
((fboundp 'replace-regexp-in-string)
(replace-regexp-in-string regexp replacement text fixedcase literal))
(t (let ((repl-len (length replacement))
start)
(while (setq start (string-match regexp text start))
(setq start (+ start repl-len)
text (replace-match replacement fixedcase literal text))))
text)))
This prefers `replace-in-string' to `replace-regexp-in-string'.
--
Michael Olson -- FSF Associate Member #652 -- http://www.mwolson.org/
Interests: Emacs Lisp, text markup, protocols -- Muse, Planner, ERC, EMMS
/` |\ | | | IRC: mwolson on freenode.net: #hcoop, #muse, #PurdueLUG
|_] | \| |_| Jabber: mwolson_at_hcoop.net
[-- Attachment #2: Type: application/pgp-signature, Size: 190 bytes --]
next prev parent reply other threads:[~2006-04-20 14:18 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-11 10:30 New completion mode Lars Magne Ingebrigtsen
2006-04-11 15:40 ` Sam Steingold
2006-04-11 15:52 ` Lars Magne Ingebrigtsen
2006-04-11 16:02 ` Sam Steingold
2006-04-12 6:21 ` Lars Magne Ingebrigtsen
2006-04-12 7:55 ` Lars Magne Ingebrigtsen
2006-04-12 11:13 ` Reiner Steib
2006-04-12 11:35 ` Lars Magne Ingebrigtsen
2006-04-12 13:25 ` Lars Magne Ingebrigtsen
2006-04-12 14:41 ` Lars Magne Ingebrigtsen
2006-04-13 2:29 ` Wolfram Fenske
2006-04-13 5:42 ` Lars Magne Ingebrigtsen
2006-04-13 16:19 ` Wolfram Fenske
[not found] ` <m3bqv6av4t.fsf-qBEgNjfYAPolG3ThADb//ti2O/JbrIOy@public.gmane.org>
2006-04-13 17:31 ` Jochen Küpper
2006-04-14 10:27 ` Lars Magne Ingebrigtsen
2006-04-16 19:50 ` Use of ecomplete.el in message.el (was: New completion mode) Reiner Steib
2006-04-16 20:30 ` Use of ecomplete.el in message.el Lars Magne Ingebrigtsen
2006-04-17 11:40 ` Reiner Steib
2006-04-17 13:04 ` Lars Magne Ingebrigtsen
2006-04-17 0:23 ` Steve Youngs
2006-04-17 9:01 ` Lars Magne Ingebrigtsen
2006-04-18 11:17 ` New completion mode Simon Josefsson
2006-04-18 13:04 ` Reiner Steib
2006-04-18 13:46 ` Simon Josefsson
2006-04-18 15:24 ` Lars Magne Ingebrigtsen
2006-04-18 21:07 ` Simon Josefsson
2006-04-21 23:51 ` Lars Magne Ingebrigtsen
2006-04-14 19:26 ` Miles Bader
2006-04-15 5:46 ` Lars Magne Ingebrigtsen
2006-04-18 22:22 ` Wolfram Fenske
2006-04-19 7:26 ` Katsumi Yamaoka
2006-04-20 12:14 ` Steve Youngs
2006-04-20 13:07 ` gnus-replace-in-string: Avoid inf-loop in XEmacs (was: New completion mode) Reiner Steib
2006-04-20 14:18 ` Michael Olson [this message]
2006-04-20 15:23 ` gnus-replace-in-string: Avoid inf-loop in XEmacs Reiner Steib
2006-04-22 4:36 ` Michael Olson
2006-04-20 16:06 ` Steve Youngs
2006-04-20 17:06 ` Reiner Steib
2006-04-21 6:32 ` New completion mode Steve Youngs
2006-04-22 0:01 ` Lars Magne Ingebrigtsen
2006-04-24 8:55 ` Katsumi Yamaoka
2006-04-30 9:32 ` Lars Magne Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y7y0wct0.fsf@tuxtanker.mwolson.org \
--to=mwolson@member.fsf.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 NNTP newsgroup(s).