Gnus development mailing list
 help / color / mirror / Atom feed
* Re: `mm-replace-in-string' doesn't like taking things literally
       [not found] <87abaviox9.fsf@daedalus.localdomain>
@ 2008-12-17  7:45 ` Katsumi Yamaoka
  0 siblings, 0 replies; only message in thread
From: Katsumi Yamaoka @ 2008-12-17  7:45 UTC (permalink / raw)
  To: Ivy Foster; +Cc: bugs, ding

>>>>> Ivy Foster wrote:
> Gnus v5.13
> GNU Emacs 23.0.60.13 (i686-pc-linux-gnu, GTK+ Version 2.14.5)
>  of 2008-12-15 on daedalus

> Okay...you asked for verbosity, you're gonna get verbosity.

> The alias `mm-replace-in-string', defined in lisp/gnus/mm-util.el (lines 78-81)
> has an optional argument, `literal'. However, being called with that argument
> causes a wrong-number-of-arguments error.

> This can be reproduced in a couple of ways, as far as I can tell. One is set
> `mm-verify-option' to "known" and try to verify a gpg-signed, non-encrypted
> message in GNUS (I'm not sure whether this happens with people whose keys you
> don't already have). I have conveniently provided one of these for you,
> regardless. This is how I encountered the bug in the wild; interestingly, with a
> signed and encrypted message, there is no problem.

> The other way to reproduce it is to try to call the function directly. Here's an
> example based on line 1136 of lisp/gnus/mml2015.el:

> Original:
> (mm-replace-in-string part "\n" "\r\n" t)

> Working:
> (mm-replace-in-string "\n" "\n" "\r\n")

> Not Working:
> (mm-replace-in-string "\n" "\n" "\r\n" t)
> (mm-replace-in-string "\n" "\n" "\r\n" nil)

What does the doc-string of `mm-replace-in-string' say in your
system (try `C-h f mm-replace-in-string RET')?  Mine is:

--8<---------------cut here---------------start------------->8---
mm-replace-in-string is a Lisp function in `mm-util.el'.

(mm-replace-in-string string regexp rep &optional literal)

See `replace-regexp-in-string', only the order of args differs.
--8<---------------cut here---------------end--------------->8---

`mm-replace-in-string' is provided as an interface to the Emacs
function `replace-regexp-in-string' if and only if there is not
the function named `replace-in-string'.

--8<---------------cut here---------------start------------->8---
replace-regexp-in-string is a compiled Lisp function in `subr.el'.

(replace-regexp-in-string regexp rep string &optional fixedcase
literal subexp start)

Replace all matches for regexp with rep in string.

[...]
--8<---------------cut here---------------end--------------->8---

XEmacs provides `replace-in-string' natively, and some packages
provide it in Emacs for keeping the compatibility with XEmacs.
In those cases, `mm-replace-in-string' is made an alias to just
that `replace-in-string'.  So I guess you use such a package that
provides `replace-in-string' for Emacs.  If so, an easy way to
solve it will be to put the following line in the beginning of
the ~/.emacs file:

(require 'mm-util)

If you modify the value of `load-path', put it just after that
section.

> As far as I could tell, there are only a couple of places that actually use the
> literal option. I've omitted uses of `mm-replace-in-string' that don't include
> the literal option from the following list:

> File              Lines
> ----              -----
> mml-smime.el      530
> mml2015.el        1136*

> The later is used in the function `mml2015-epg-verify', which is how I encountered
> this bug in the wild.

> Anyway, I tried making the `literal' option non-`&optional', but that didn't
> seem to help. I can say, though, that as far as I can tell simply removing the
> `literal' option from the invocation `mml2015-epg-verify' causes GPG signature
> verification to work properly, at any rate. I have not tested the other
> invocation.

> Thanks, developers!

> Ivy

Regards,



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-17  7:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <87abaviox9.fsf@daedalus.localdomain>
2008-12-17  7:45 ` `mm-replace-in-string' doesn't like taking things literally 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).