[ Followups set to xemacs-beta(a)xemacs.org AND mh-e-devel(a)lists.sf.net ]
This is currently being discussed on the mh-e devel list. Given the
following sexp...
*******************************
*******************************
GNU/Emacs returns "test passed"
XEmacs returns "test failed"
It obviously has something to do with the two Emacsen's implementation
of 'replace-match' (doc strings of both included below). My question
is:
What is the best and easiest way to work around this so that XEmacs
behaves the same way as GNU/Emacs?
,----[ C-h f replace-match RET (XEmacs) ]
| `replace-match' is a built-in function
| (replace-match REPLACEMENT &optional FIXEDCASE LITERAL STRING STRBUFFER)
|
| Documentation:
| Replace text matched by last search with REPLACEMENT.
| If second arg FIXEDCASE is non-nil, do not alter case of replacement text.
| Otherwise maybe capitalize the whole text, or maybe just word initials,
| based on the replaced text.
| If the replaced text has only capital letters
| and has at least one multiletter word, convert REPLACEMENT to all caps.
| If the replaced text has at least one word starting with a capital letter,
| then capitalize each word in REPLACEMENT.
|
| If third arg LITERAL is non-nil, insert REPLACEMENT literally.
| Otherwise treat `\' as special:
| `\&' in REPLACEMENT means substitute original matched text.
| `\N' means substitute what matched the Nth `\(...\)'.
| If Nth parens didn't match, substitute nothing.
| `\\' means insert one `\'.
| `\u' means upcase the next character.
| `\l' means downcase the next character.
| `\U' means begin upcasing all following characters.
| `\L' means begin downcasing all following characters.
| `\E' means terminate the effect of any `\U' or `\L'.
| Case changes made with `\u', `\l', `\U', and `\L' override
| all other case changes that may be made in the replaced text.
| FIXEDCASE and LITERAL are optional arguments.
| Leaves point at end of replacement text.
|
| The optional fourth argument STRING can be a string to modify.
| In that case, this function creates and returns a new string
| which is made by replacing the part of STRING that was matched.
| When fourth argument is a string, fifth argument STRBUFFER specifies
| the buffer to be used for syntax-table and case-table lookup and
| defaults to the current buffer. When fourth argument is not a string,
| the buffer that the match occurred in has automatically been remembered
| and you do not need to specify it.
|
| When fourth argument is nil, STRBUFFER specifies a subexpression of
| the match. It says to replace just that subexpression instead of the
| whole match. This is useful only after a regular expression search or
| match since only regular expressions have distinguished subexpressions.
`----
,----[ C-h f replace-match RET (GNU/Emacs) ]
| replace-match is a built-in function.
| (replace-match NEWTEXT &optional FIXEDCASE LITERAL STRING SUBEXP)
|
| Replace text matched by last search with NEWTEXT.
| Leave point at the end of the replacement text.
|
| If second arg FIXEDCASE is non-nil, do not alter case of replacement text.
| Otherwise maybe capitalize the whole text, or maybe just word initials,
| based on the replaced text.
| If the replaced text has only capital letters
| and has at least one multiletter word, convert NEWTEXT to all caps.
| Otherwise if all words are capitalized in the replaced text,
| capitalize each word in NEWTEXT.
|
| If third arg LITERAL is non-nil, insert NEWTEXT literally.
| Otherwise treat `\' as special:
| `\&' in NEWTEXT means substitute original matched text.
| `\N' means substitute what matched the Nth `\(...\)'.
| If Nth parens didn't match, substitute nothing.
| `\\' means insert one `\'.
| Case conversion does not apply to these substitutions.
|
| FIXEDCASE and LITERAL are optional arguments.
|
| The optional fourth argument STRING can be a string to modify.
| This is meaningful when the previous match was done against STRING,
| using `string-match'. When used this way, `replace-match'
| creates and returns a new string made by copying STRING and replacing
| the part of STRING that was matched.
|
| The optional fifth argument SUBEXP specifies a subexpression;
| it says to replace just that subexpression with NEWTEXT,
| rather than replacing the entire matched text.
| This is, in a vague sense, the inverse of using `\N' in NEWTEXT;
| `\N' copies subexp N into NEWTEXT, but using N as SUBEXP puts
| NEWTEXT in place of subexp N.
| This is useful only after a regular expression search or match,
| since only regular expressions have distinguished subexpressions.
`----
--
|---<Steve Youngs>---------------<GnuPG KeyID: 10D5C9C5>---|
| XEmacs - It's not just an editor. |
| It's a way of life. |
|------------------------------------<youngs(a)xemacs.org>---|
Show replies by date
|--==> "SY" == Steve Youngs <youngs(a)xemacs.org> writes:
SY> [ Followups set to xemacs-beta(a)xemacs.org AND mh-e-devel(a)lists.sf.net ]
Of course it would help if I actually set MFT to the right addresses.
Sorry about that, lets try again...
Given the following sexp...
*****************************
*******************************
GNU/Emacs gives "test passed"
XEmacs gives "test failed"
It seems to be something to do with how the two Emacsen implement
'replace-match' (doc strings for both included below).
My question is: What would be the easiest and best way to make XEmacs
behave like GNU/Emacs in situations like this?
,----[ C-h f replace-match RET (XEmacs) ]
| `replace-match' is a built-in function
| (replace-match REPLACEMENT &optional FIXEDCASE LITERAL STRING STRBUFFER)
|
| Documentation:
| Replace text matched by last search with REPLACEMENT.
| If second arg FIXEDCASE is non-nil, do not alter case of replacement text.
| Otherwise maybe capitalize the whole text, or maybe just word initials,
| based on the replaced text.
| If the replaced text has only capital letters
| and has at least one multiletter word, convert REPLACEMENT to all caps.
| If the replaced text has at least one word starting with a capital letter,
| then capitalize each word in REPLACEMENT.
|
| If third arg LITERAL is non-nil, insert REPLACEMENT literally.
| Otherwise treat `\' as special:
| `\&' in REPLACEMENT means substitute original matched text.
| `\N' means substitute what matched the Nth `\(...\)'.
| If Nth parens didn't match, substitute nothing.
| `\\' means insert one `\'.
| `\u' means upcase the next character.
| `\l' means downcase the next character.
| `\U' means begin upcasing all following characters.
| `\L' means begin downcasing all following characters.
| `\E' means terminate the effect of any `\U' or `\L'.
| Case changes made with `\u', `\l', `\U', and `\L' override
| all other case changes that may be made in the replaced text.
| FIXEDCASE and LITERAL are optional arguments.
| Leaves point at end of replacement text.
|
| The optional fourth argument STRING can be a string to modify.
| In that case, this function creates and returns a new string
| which is made by replacing the part of STRING that was matched.
| When fourth argument is a string, fifth argument STRBUFFER specifies
| the buffer to be used for syntax-table and case-table lookup and
| defaults to the current buffer. When fourth argument is not a string,
| the buffer that the match occurred in has automatically been remembered
| and you do not need to specify it.
|
| When fourth argument is nil, STRBUFFER specifies a subexpression of
| the match. It says to replace just that subexpression instead of the
| whole match. This is useful only after a regular expression search or
| match since only regular expressions have distinguished subexpressions.
`----
,----[ C-h f replace-match RET (GNU/Emacs) ]
| replace-match is a built-in function.
| (replace-match NEWTEXT &optional FIXEDCASE LITERAL STRING SUBEXP)
|
| Replace text matched by last search with NEWTEXT.
| Leave point at the end of the replacement text.
|
| If second arg FIXEDCASE is non-nil, do not alter case of replacement text.
| Otherwise maybe capitalize the whole text, or maybe just word initials,
| based on the replaced text.
| If the replaced text has only capital letters
| and has at least one multiletter word, convert NEWTEXT to all caps.
| Otherwise if all words are capitalized in the replaced text,
| capitalize each word in NEWTEXT.
|
| If third arg LITERAL is non-nil, insert NEWTEXT literally.
| Otherwise treat `\' as special:
| `\&' in NEWTEXT means substitute original matched text.
| `\N' means substitute what matched the Nth `\(...\)'.
| If Nth parens didn't match, substitute nothing.
| `\\' means insert one `\'.
| Case conversion does not apply to these substitutions.
|
| FIXEDCASE and LITERAL are optional arguments.
|
| The optional fourth argument STRING can be a string to modify.
| This is meaningful when the previous match was done against STRING,
| using `string-match'. When used this way, `replace-match'
| creates and returns a new string made by copying STRING and replacing
| the part of STRING that was matched.
|
| The optional fifth argument SUBEXP specifies a subexpression;
| it says to replace just that subexpression with NEWTEXT,
| rather than replacing the entire matched text.
| This is, in a vague sense, the inverse of using `\N' in NEWTEXT;
| `\N' copies subexp N into NEWTEXT, but using N as SUBEXP puts
| NEWTEXT in place of subexp N.
| This is useful only after a regular expression search or match,
| since only regular expressions have distinguished subexpressions.
`----
--
|---<Steve Youngs>---------------<GnuPG KeyID: 10D5C9C5>---|
| XEmacs - It's not just an editor. |
| It's a way of life. |
|------------------------------------<youngs(a)xemacs.org>---|
>>>> "SY" == Steve Youngs
<youngs(a)xemacs.org> writes:
SY> What is the best
Fix GNU Emacs. We had the 5th argument first. ;-)
SY> and easiest way to work around this so that XEmacs behaves the
SY> same way as GNU/Emacs?
They'll never do that, so the best way isn't the easiest. As grotty
as it is, somebody is going to have to do a grep for uses of strbuffer
as a buffer in all XEmacs code.
--
Institute of Policy and Planning Sciences
http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
My nostalgia for Icon makes me forget about any of the bad things. I don't
have much nostalgia for Perl, so its faults I remember. Scott Gilbert c.l.py