[cmail 8531] Re: Date & Message-id header

Yuuichi Teranishi/寺西裕一 teranisi @ gohome.org
2000年 2月 10日 (木) 09:39:22 JST


At Wed,  9 Feb 2000 17:13:29 +0900,
Yuh Ohmura <yutopia @ t3.rim.or.jp> wrote:
> 
> > > APEL としては
> > > (replace-match NEWTEXT &optional FIXEDCASE LITERAL STRING)
> > > までにしとくべきかなあ...。
> 
> 共通部分でできるだけ多くの引数をサポートするということで
> しょうか。

はい。
めったにつかわれない optional 引数のために最新の X?Emacs の built-in を
再定義するのは気が引けますし、
共通部分の引数でたいてい事足りるなら、APEL 的には共通部分のみのサポートでも
いいかなという気がしています。

ところで、先に流れていた定義では FIXEDCASE が無視されてしまいますね。
こうでしょうか?

-------------- next part --------------
;; Emacs 19.28 and earlier
;;  (replace-match NEWTEXT &optional FIXEDCASE LITERAL)
;; Emacs 20.x (?) and later
;;  (replace-match NEWTEXT &optional FIXEDCASE LITERAL STRING SUBEXP)
;; XEmacs 21:
;;  (replace-match NEWTEXT &optional FIXEDCASE LITERAL STRING STRBUFFER)
;; We support following API.
;;  (replace-match NEWTEXT &optional FIXEDCASE LITERAL STRING)
(static-condition-case nil
    ;; compile-time check
    (progn
      (string-match "" "")
      (replace-match "" nil nil "")
      (if (get 'replace-match 'defun-maybe)
	  (error "`replace-match' is already defined")))
  (wrong-number-of-arguments ; Emacs 19.28 and earlier
   ;; load-time check.
   (or (fboundp 'si:replace-match)
       (progn
	 (fset 'si:replace-match (symbol-function 'replace-match))
	 (put 'replace-match 'defun-maybe t)
	 (defun replace-match (newtext &optional fixedcase literal string)
	   "Replace text matched by last search with NEWTEXT.
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.
If the replaced text has at least one word starting with a capital letter,
then 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 `\'.
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."
	   (if string
	       (with-temp-buffer
		(save-match-data
		  (insert string)
		  (store-match-data (mapcar '1+ (match-data)))
		  (si:replace-match newtext fixedcase literal)
		  (buffer-string)))
	     (si:replace-match newtext fixedcase literal)))))))
-------------- next part --------------
--
Yuuichi Teranishi (寺西裕一) <teranisi @ gohome.org>
PGP 5.0i Public Key: http://www.gohome.org/pgp5/teranisi.key
"The love you take is equal to the love you make..."


More information about the APEL-ja mailing list