Gnus development mailing list
 help / color / mirror / Atom feed
* gnus-replace-in-string does not honor 'literal
@ 2010-10-29  2:49 nyc4bos
  2010-10-29  4:47 ` Katsumi Yamaoka
  0 siblings, 1 reply; 2+ messages in thread
From: nyc4bos @ 2010-10-29  2:49 UTC (permalink / raw)
  To: ding

Hi,

It appears that `gnus-replace-in-string' is not honoring the
optional parameter 'literal:

gnus-replace-in-string is a Lisp function in `gnus-util.el'.

(gnus-replace-in-string STRING REGEXP NEWTEXT &optional LITERAL)

Replace all matches for REGEXP with NEWTEXT in STRING.
If LITERAL is non-nil, insert NEWTEXT literally.  Return a new
string containing the replacements.


When I use it, I get the following results:

(gnus-replace-in-string
  gnus-newsgroup-name "INBOX" "Sent Items" 'literal)

"nnimap+aol:SENT ITEMS"


This value, however, is honored when using the similiar
`replace-regexp-in-string':

(replace-regexp-in-string
  "INBOX" "Sent Items" gnus-newsgroup-name 'literal)

"nnimap+aol:Sent Items"

I have also tried t (non-nil) in place of 'literal which
gives the same unexpected effect.

Thanks.




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

* Re: gnus-replace-in-string does not honor 'literal
  2010-10-29  2:49 gnus-replace-in-string does not honor 'literal nyc4bos
@ 2010-10-29  4:47 ` Katsumi Yamaoka
  0 siblings, 0 replies; 2+ messages in thread
From: Katsumi Yamaoka @ 2010-10-29  4:47 UTC (permalink / raw)
  To: ding

nyc4bos@aol.com wrote:
> It appears that `gnus-replace-in-string' is not honoring the
> optional parameter 'literal:

> gnus-replace-in-string is a Lisp function in `gnus-util.el'.

> (gnus-replace-in-string STRING REGEXP NEWTEXT &optional LITERAL)

> Replace all matches for REGEXP with NEWTEXT in STRING.
> If LITERAL is non-nil, insert NEWTEXT literally.  Return a new
> string containing the replacements.

`gnus-replace-in-string' is an imitation of `replace-in-string'
that is an XEmacs function:

(replace-in-string STR REGEXP NEWTEXT &optional LITERAL)

IIUC, `literal' means that `\'s in NEWTEXT are not treated
specially:

(gnus-replace-in-string "foo bar" "\\(bar\\)" "\\1 baz")
 => "foo bar baz"

(gnus-replace-in-string "foo bar" "\\(bar\\)" "\\1 baz" t)
 => "foo \\1 baz"

> When I use it, I get the following results:

> (gnus-replace-in-string
>   gnus-newsgroup-name "INBOX" "Sent Items" 'literal)

> "nnimap+aol:SENT ITEMS"

> This value, however, is honored when using the similiar
> `replace-regexp-in-string':

> (replace-regexp-in-string
>   "INBOX" "Sent Items" gnus-newsgroup-name 'literal)

> "nnimap+aol:Sent Items"

The 4th arg of `replace-regexp-in-string' is not LITERAL. ;-p



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

end of thread, other threads:[~2010-10-29  4:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-29  2:49 gnus-replace-in-string does not honor 'literal nyc4bos
2010-10-29  4:47 ` Katsumi Yamaoka

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).