[Mew-dist 09353] Re: Can you "xcite"?

Hideyuki SHIRAI ( 白井秀行 ) shirai at example.com
1999年 6月 16日 (水) 10:59:24 JST


白井です。

From: Shun-ichi GOTO (後藤 俊一) <gotoh at example.com> さん曰く
Subject: [Mew-dist 09351] Re: Can you "xcite"?
Message-ID: <19990616102713J.GOTOH at example.com>
Date: Wed, 16 Jun 1999 10:27:23 +0900

後藤> 私の方法は自分の判断で切り替える方法なので、白井さんの自動判定の方法
後藤> のほうが期待できますね。(^^;

うぅ、結構いい加減だから黙っていようと思ったのに。。。

半自動判定と mew-cite-prefix-function で xcite を使うところです。
やってみたら、あぁ動いたという代物なのでお気をつけください。(^^)

(autoload 'xcite "xcite" "Exciting cite" t)
(autoload 'xcite-yank-cur-msg "xcite" "Exciting cite" t)
(autoload 'xcite/id2prefix "xcite" nil t)

(setq mew-use-nickname nil)
(setq mew-cite-prefix-function 'mew-cite-prefix-xcite)
(setq xcite:insert-header-function 'xcite-header-shirai)

(global-set-key "\C-c\M-y" 'xcite-yank-cur-msg)
(add-hook 'mew-init-hook
	  (function
	   (lambda ()
	     (define-key mew-summary-mode-map "A" 'mew-cite-xcite))))

(defvar mew-cite-xcite-check-num 3)

(defun mew-cite-xcite (&optional arg)
  (interactive "P")
  (if (mew-cite-xcite-check)
      (mew-summary-reply-with-citation arg)
    (mew-summary-reply arg)
    (xcite-yank-cur-msg)))

(defun mew-cite-xcite-check ()
  (let ((i mew-cite-xcite-check-num)
	beg end)
    (save-excursion
      (if (eq major-mode 'mew-summary-mode)
	  (mew-summary-display nil))
      (set-buffer (mew-buffer-message))
      (goto-char (point-min))
      (save-restriction
	(widen)
	(cond
	 ((mew-mark)
	  (setq beg (region-beginning) end (region-end)))
	 ((mew-header-p)
	  (mew-header-goto-body)
	  (setq beg (point) end (point-max)))
	 (t
	  (setq beg (point-min) end (point-max))))
	(goto-char beg)
	(while (and (not (eobp))
		    (> i 0)
		    (re-search-forward "^ *>+[ >]*" end t))
	  (beginning-of-line)
	  (if (not (looking-at mew-cite-color-non-body-regexp))
	      (setq i (1- i)))
	  (forward-line)))
      (cond
       ((= i 0) t)
       ((< i mew-cite-xcite-check-num)
	(y-or-n-p "Use Mew-cite (y) or Xcite (n) "))
       (t nil)))))

(defun xcite-header-shirai ()
  (if (string-match "[Ss]hirai at example.com" id)
      (format "From: %s %s 曰く\nSubject: %s\nMessage-ID: %s\nDate: %s\n"
	      (if handle handle id) (concat "<" id ">") subject msgid date)
    (format "From: %s %s さん曰く\nSubject: %s\nMessage-ID: %s\nDate: %s\n"
	    (if handle handle id) (concat "<" id ">") subject msgid date)))

(defun mew-cite-prefix-xcite ()
  (let ((from (mew-header-parse-address mew-from:))
	(xcite-me (mew-header-get-value "x-cite-me:"))
	prefix)
    (setq prefix (or (and mew-use-nickname (mew-addrbook-nickname-get from))
		     (and (functionp 'xcite/id2prefix)
			  (xcite/id2prefix from nil t xcite-me))
		     (read-string "Citation prefix: "
				  (mew-addrstr-extract-user from))))
    (format "%s> " prefix)))

;; read-string には来ないような気もするし。。。
;; mew-cite-color の変数も使っているし。。。



Mew-dist メーリングリストの案内