[Mew-dist 11514] Re: Emacs でモードラインに Mail の表示

Harumitsu YOSHITAKE yositake at example.com
1999年 11月 29日 (月) 12:29:21 JST


西南学院大学 の 吉武 です。

 |From: nara at example.com
 |Subject: [Mew-dist 11510] Re: Emacs でモードラインに Mail の表示
 |>   新着なメールをチェックする機構としては利用出来ないですよね?
 |そこで、なんか良い方法ないでしょうか?

新着メールの到着を知るだけでしたら,私は,昔から,次の 
notify-mail.el を愛用しています。尚,telnet の時だけ使えば十
分なので下記を ~/.emacs (本当は...default.el)に入れています。

;;; setting for RS-232C terminal
(cond ((or (string= (getenv "TERM") "vt100")
           (string= (getenv "TERM") "screen"))
       (autoload 'notify-mail-filter "notify-mail" "" t)
       (autoload 'notify-mail "notify-mail" "" t)
       (notify-mail nil)
))



;;---------------------------------------------------------------------
;; notify-mail.el  A funtion to notify the user when new mail arrives.
;; Notification consists of a beep and a minibuffer message.
;;; Copyright (C) 1991 Jeff Norden, JSN3287 at example.com, Tenn Tech Univ,
;;; Cookeville, TN, 38501.
;;; This code free software; you can redistribute it and/or modify
;;; it under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 1, or (at your option)
;;; any later version.
;;; This code is distributed in the hope that it will be useful,
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.

(defun notify-mail-filter (&rest dummies)
  " A fake filter; should be called periodically to notify user of new
   mail when it arrives"
  (let* (
	 (file-att
               (file-attributes (concat rmail-spool-directory
                                        (or (getenv "LOGNAME")
                                            (getenv "USER")
                                            (user-login-name)))))
         (new-time  (nth 5 file-att))
         (file-size (nth 7 file-att))
         (new0 (nth 0 new-time))
         (new1 (nth 1 new-time))
         (old0 (nth 0 mailbox-file-time))
         (old1 (nth 1 mailbox-file-time)))
    (if (and
         new0 new1 old0 old1  ;Make sure none of these are nil
         (or
          (> new0 old0)
          (and
           (= new0 old0)
           (> new1 old1)))
	 (/= file-size 0))
        (progn
          (beep)
          (message "New mail seems to have arrived")))
    ;; Set mailbox-file-time to current time, or (0 0) if mailbox doesn't exist
    (if (null new-time)
        (setq mailbox-file-time '(0 0))
      (setq mailbox-file-time new-time))))

(defun notify-mail (arg)
  "Arrange to periodically check for new mail and beep if it arrives
   If called with an argument, mail notification is turned off"
  (interactive "P")
  ;; Delete current process if any
  (and
   (boundp 'notify-mail-process)
   (processp notify-mail-process)
   (delete-process notify-mail-process))
  (if (null arg)
      (progn
        (setq mailbox-file-time nil)
        (notify-mail-filter) ;Initialize value of notify mail time
        (setq notify-mail-process
              ;; Change the argument to sleep below to adjust how often new
              ;; mail is checked for.
              (start-process "notify-mail" nil
                             "sh" "-c"
                             "while true; do  sleep 20; echo x; done"))
        (set-process-filter notify-mail-process 'notify-mail-filter))))
;;---------------------------------------------------------------------

---
吉武 春光



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