[Mew-dist 14818] Re: mew-x-mailer
Takayoshi KAWATE
taka at example.com
2000年 10月 30日 (月) 21:47:48 JST
こんにちは。かわてです。
In the message "[Mew-dist 14808] Re: mew-x-mailer",
On Mon, 30 Oct 2000 18:07:12 +0900,
Shun-ichi TAHARA (田原 俊一) <jado at example.com> wrote:
> XEmacsだと、emacs-versionが長くて嫌ですね。Meadowだとどうなんでしょう
> か。
私は,いろんなところから掻い摘んで(ありがとうございます!),
添付のような関数を作って(というかパクって),Mewの設定↓でこ
のメールのようなUser-Agentを吐き出すようにしています。
--ここから--
;;
;; generate User-Agent
;;
(defun tk-generate-user-agent ()
(setq mew-x-mailer: "User-Agent:")
(setq mew-x-mailer
(concat "Mew/" mew-version-number " "
(tk-extended-emacs-version "/" t))
))
(add-hook 'mew-init-hook 'tk-generate-user-agent)
--ここまで--
じゃ,邪道かな・・・?(^^;)
-----
Takayoshi KAWATE <taka at example.com>
-------------- next part --------------
;; -*- emacs-lisp -*-
;;
;; ~/.emacs-init/.emacs-version : stringified extented emacs version
;;
;;
;; define macro
;;
(defmacro tk-match-string (pos string)
"Substring POSth matched string."
(` (substring (, string) (match-beginning (, pos)) (match-end (, pos)))))
;;
;; set system-version (maybe not required)
;;
(setq system-version
(progn
(setq system-version (emacs-version))
(string-match "\\((.*)\\)" system-version)
(setq system-version
(substring system-version (match-beginning 0) (match-end 0)))
(string-match "[^(].*[^)]" system-version)
(substring system-version (match-beginning 0) (match-end 0))
))
;;
;; extended emacs version
;;
(defun tk-extended-emacs-version (&optional delimiter with-codename)
"Stringified Emacs version"
(interactive)
(concat
(cond
;;
((string-match "^\\(\\([.0-9]+\\)*\\)\\.[0-9]+$" emacs-version)
(if (and (eq system-type 'windows-nt) (not (featurep 'meadow)))
(concat "NTEmacs"
(or delimiter " ")
(tk-match-string 1 emacs-version))
(concat "Emacs"
(or delimiter " ")
(tk-match-string 1 emacs-version))
))
;;
((string-match "\\([A-Z]*[Mm][Aa][Cc][Ss]\\)[^(]*\\(\\((beta.*)\\|'\\)\\)?"
emacs-version)
(concat (format "%s%s%d.%d"
(tk-match-string 1 emacs-version)
(or delimiter " ")
emacs-major-version
emacs-minor-version)
(if (match-beginning 3)
(tk-match-string 3 emacs-version))
; (if (and (boundp 'xemacs-betaname)
; ;; It does not exist
; ;; in XEmacs versions prior to 20.3.
; xemacs-betaname)
; (concat " " xemacs-betaname))
(if (boundp 'xemacs-codename)
(if with-codename
(concat " (" xemacs-codename ")")))
))
;;
((string-match "^\\(\\([.0-9]+\\)*\\)\\.[0-9]+$" emacs-version)
(if (boundp 'nemacs-version)
(let ((nemacs-codename-assoc '(("3.3.2" . " (FUJIMUSUME)")
("3.3.1" . " (HINAMATSURI)")
("3.2.3" . " (YUMENO-AWAYUKI)"))))
(format "Nemacs%s%s%s"
(or delimiter " ")
nemacs-version
(or (and with-codename
(cdr (assoc nemacs-version
nemacs-codename-assoc)))))
)
))
;;
(t emacs-version))
;;
(concat " (" system-configuration ")")
;;
(and (boundp 'mule-version)
(string-match "\\([0-9]+[.0-9]+\\)\\(.*$\\)" mule-version)
(cond ((featurep 'utf-2000)
(concat " UTF-2000-MULE"
(or delimiter " ")
utf-2000-version))
((featurep 'mule)
(concat " MULE"
(or delimiter " ")
(tk-match-string 1 mule-version)
(if with-codename
(tk-match-string 2 mule-version)))
)))
;;
(and (featurep 'meadow)
(setq meadow-version (Meadow-version))
(string-match "\\([0-9]+[.0-9]+.*\\)\\((.*)$\\)" meadow-version)
(concat " Meadow"
(or delimiter " ")
(tk-match-string 1 meadow-version)
(if with-codename
(tk-match-string 2 meadow-version))))
))
; (if (featurep 'xemacs)
; (concat (cond ((featurep 'utf-2000)
; (concat "UTF-2000-MULE/" utf-2000-version))
; ((featurep 'mule) "MULE"))
; " XEmacs"
; (if (string-match "^[0-9]+\\(\\.[0-9]+\\)" emacs-version)
; (concat "/"
; (substring emacs-version 0 (match-end 0))
; (if (and (boundp 'xemacs-betaname)
; ;; It does not exist in XEmacs
; ;; versions prior to 20.3.
; xemacs-betaname)
; (concat " " xemacs-betaname)
; "")
; " (" xemacs-codename ") ("
; system-configuration ")")
; " (" emacs-version ")"))
; (let ((ver (if (string-match "\\.[0-9]+$" emacs-version)
; (substring emacs-version 0 (match-beginning 0))
; emacs-version)))
; (if (featurep 'mule)
; (if (boundp 'enable-multibyte-characters)
; (concat "Emacs/" ver
; " (" system-configuration ")"
; (if enable-multibyte-characters
; (concat " MULE/" mule-version)
; " (with unibyte mode)")
; (if (featurep 'meadow)
; (let ((mver (Meadow-version)))
; (if (string-match "^Meadow-" mver)
; (concat " Meadow/"
; (substring mver
; (match-end 0)))
; ))))
; (concat "MULE/" mule-version
; " (based on Emacs " ver ")"))
; (concat "Emacs/" ver " (" system-configuration ")")))))
;;
;; end of ~/.emacs-init/.emacs-version
;;
Mew-dist メーリングリストの案内