[cmail 8526] Re: Date & Message-id header
Yuh Ohmura
yutopia @ t3.rim.or.jp
2000年 2月 9日 (水) 10:53:35 JST
おおむらです。
In message "[cmail 8526] Re: Date & Message-id header"
on 00/02/09, Yuh Ohmura <yutopia @ t3.rim.or.jp> writes:
> In message "Re: [cmail 8499] Re: Date & Message-id header"
> on 00/02/03, 中川 誠 <Makoto.Nakagawa @ jp.compaq.com> writes:
> > In message "Re: [cmail 8499] Re: Date & Message-id header"
> > on 00/02/02, Yuh Ohmura <yutopia @ t3.rim.or.jp> wrote:
> >
> > >> Meadow 1.12b1 (Emacs 20.5/Mule 4.1)
> > >> (replace-match NEWTEXT &optional FIXEDCASE LITERAL STRING SUBEXP)
> > >>
> > >> Mule for Windows (Emacs 19.28/Mule 2.3)
> > >> (replace-match NEWTEXT &optional FIXEDCASE LITERAL)
> apel の流儀でいくと、static-condition-case とか static-unless
> とか使って、バイトコンパイル中にバージョンを判断してしまうと
> いうことをしているみたいです。
見よう見まねでむりやりパッチ。
動作確認しておりません ^^;;;
意味がわかってコーディングしているわけではなくて
あちこちからの切り貼りですので ^^;
poe.el のどこかに適当にほうりこんでみてチェックしてみ
て下さい ^^;;;;
--------------- salve! -----------------
mailto:yutopia @ t3.rim.or.jp (Yuh Ohmura)
Uri: http://www.t3.rim.or.jp/%7Eyutopia/
----------------------------------------
;; Emacs 19.28 and earlier
;; (replace-match NEWTEXT &optional FIXEDCASE LITERAL)
;; Emacs 20.x (?) and later
;; (replace-match NEWTEXT &optional FIXEDCASE LITERAL STRING SUBEXP)
(static-condition-case nil
;; compile-time check
(progn
(setq nostring "")
(replace-match "-" nil nil nostring))
(error
;; 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 subexp)
"\
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.
The optional fifth argument SUBEXP 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."
(if string
(let* ((matched-data (match-data))
(len (length matched-data)))
(setq matched-data (append matched-data '(-2 -2)))
(with-temp-buffer
(insert string)
(if (and subexp (numberp subexp))
(if (>= (* subexp 2) len)
(setq subexp (/ len 2)))
(setq subexp 0))
(delete-region (+ (nth (* 2 subexp) matched-data) 1)
(+ (nth (+ (* 2 subexp) 1) matched-data) 1))
(goto-char (+ (nth (* 2 subexp) matched-data) 1))
(insert newtext)
(buffer-substring (point-min) (point-max))))
(replace-match-orig newtext fixedcase literal)))))))
More information about the APEL-ja
mailing list