2001-08-30 Andrew Innes <andrewi@gnu.org>
authorShengHuo ZHU <zsh@cs.rochester.edu>
Thu, 30 Aug 2001 18:40:40 +0000 (18:40 +0000)
committerShengHuo ZHU <zsh@cs.rochester.edu>
Thu, 30 Aug 2001 18:40:40 +0000 (18:40 +0000)
* nnml.el (nnml-request-article): Use nnml-article-to-file-alist.
(nnml-request-rename-group): Ditto.
(nnml-active-number): Ditto.
(nnml-request-create-group): Use nnml-directory-articles.
(nnml-request-expire-articles): Use nnml-directory-articles, which
gets list from nov database if available.
(nnml-get-nov-buffer): New function.
(nnml-open-nov): Use it.
(nnml-update-file-alist): Use nnml-article-to-file-alist, which
gets alist from nov database if available.
(nnml-directory-articles): New function.
(nnml-article-to-file-alist): New function.

2001-08-30  Andrew Innes  <andrewi@gnu.org>

* mm-decode.el (mm-display-external): Use `name' as filename, if
`filename' attribute is not present.

2001-08-30  Andrew Innes  <andrewi@gnu.org>

* mail-source.el (mail-source-flash): New defcustom.
(mail-source-new-mail-p): Ring visible bell if appropriate.
(mail-source-start-idle-timer): Use unwind-protect to ensure idle
timer is cleared even if mail check signals an error.

lisp/ChangeLog
lisp/mail-source.el
lisp/mm-decode.el
lisp/nnml.el

index 4c89cef..0402e1f 100644 (file)
@@ -1,3 +1,30 @@
+2001-08-30  Andrew Innes  <andrewi@gnu.org>
+
+       * nnml.el (nnml-request-article): Use nnml-article-to-file-alist.
+       (nnml-request-rename-group): Ditto.
+       (nnml-active-number): Ditto.
+       (nnml-request-create-group): Use nnml-directory-articles.
+       (nnml-request-expire-articles): Use nnml-directory-articles, which
+       gets list from nov database if available.
+       (nnml-get-nov-buffer): New function.
+       (nnml-open-nov): Use it.
+       (nnml-update-file-alist): Use nnml-article-to-file-alist, which
+       gets alist from nov database if available.
+       (nnml-directory-articles): New function.
+       (nnml-article-to-file-alist): New function.
+       
+2001-08-30  Andrew Innes  <andrewi@gnu.org>
+
+       * mm-decode.el (mm-display-external): Use `name' as filename, if
+       `filename' attribute is not present.
+       
+2001-08-30  Andrew Innes  <andrewi@gnu.org>
+
+       * mail-source.el (mail-source-flash): New defcustom.
+       (mail-source-new-mail-p): Ring visible bell if appropriate.
+       (mail-source-start-idle-timer): Use unwind-protect to ensure idle
+       timer is cleared even if mail check signals an error.
+       
 2001-08-29 10:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * gnus-sum.el (gnus-summary-move-article): Only update marks of
index 06f249a..94c3eef 100644 (file)
@@ -224,6 +224,11 @@ If non-nil, this maildrop will be checked periodically for new mail."
   :group 'mail-source
   :type 'sexp)
 
+(defcustom mail-source-flash t
+  "*If non-nil, flash periodically when mail is available."
+  :group 'mail-source
+  :type 'boolean)
+
 (defcustom mail-source-crash-box "~/.emacs-mail-crash-box"
   "File where mail will be stored while processing it."
   :group 'mail-source
@@ -744,6 +749,10 @@ If ARGS, PROMPT is used as an argument to `format'."
 
 (defun mail-source-new-mail-p ()
   "Handler for `display-time' to indicate when new mail is available."
+  ;; Flash (ie. ring the visible bell) if mail is available.
+  (if (and mail-source-flash mail-source-new-mail-available)
+      (let ((visible-bell t))
+       (ding)))
   ;; Only report flag setting; flag is updated on a different schedule.
   mail-source-new-mail-available)
 
@@ -766,8 +775,9 @@ If ARGS, PROMPT is used as an argument to `format'."
           mail-source-idle-time-delay
           nil
           (lambda ()
-            (mail-source-check-pop mail-source-primary-source)
-            (setq mail-source-report-new-mail-idle-timer nil))))
+            (unwind-protect
+                (mail-source-check-pop mail-source-primary-source)
+              (setq mail-source-report-new-mail-idle-timer nil)))))
     ;; Since idle timers created when Emacs is already in the idle
     ;; state don't get activated until Emacs _next_ becomes idle, we
     ;; need to force our timer to be considered active now.  We do
index 8bdf2ca..c44a663 100644 (file)
@@ -621,8 +621,11 @@ external if displayed external."
        (mm-insert-part handle)
        (let* ((dir (make-temp-name
                     (expand-file-name "emm." mm-tmp-directory)))
-              (filename (mail-content-type-get
-                         (mm-handle-disposition handle) 'filename))
+              (filename (or 
+                         (mail-content-type-get
+                          (mm-handle-disposition handle) 'filename)
+                         (mail-content-type-get
+                          (mm-handle-type handle) 'name)))
               (mime-info (mailcap-mime-info
                           (mm-handle-media-type handle) t))
               (needsterm (or (assoc "needsterm" mime-info)
index 123216d..d89967e 100644 (file)
@@ -208,7 +208,7 @@ check twice.")
        (when (and (setq group-num (nnml-find-group-number id))
                   (cdr
                    (assq (cdr group-num)
-                         (nnheader-article-to-file-alist
+                         (nnml-article-to-file-alist
                           (setq gpath
                                 (nnmail-group-pathname
                                  (car group-num)
@@ -281,7 +281,7 @@ check twice.")
            nnml-group-alist)
       (nnml-possibly-create-directory group)
       (nnml-possibly-change-directory group server)
-      (let ((articles (nnheader-directory-articles nnml-current-directory)))
+      (let ((articles (nnml-directory-articles nnml-current-directory)))
        (when articles
          (setcar active (apply 'min articles))
          (setcdr active (apply 'max articles))))
@@ -306,7 +306,7 @@ check twice.")
 (deffoo nnml-request-expire-articles (articles group &optional server force)
   (nnml-possibly-change-directory group server)
   (let ((active-articles
-        (nnheader-directory-articles nnml-current-directory))
+        (nnml-directory-articles nnml-current-directory))
        (is-old t)
        article rest mod-time number)
     (nnmail-activate 'nnml)
@@ -487,7 +487,7 @@ check twice.")
       ;; We move the articles file by file instead of renaming
       ;; the directory -- there may be subgroups in this group.
       ;; One might be more clever, I guess.
-      (let ((files (nnheader-article-to-file-alist old-dir)))
+      (let ((files (nnml-article-to-file-alist old-dir)))
        (while files
          (rename-file
           (concat old-dir (cdar files))
@@ -681,7 +681,7 @@ check twice.")
       (unless nnml-article-file-alist
        (setq nnml-article-file-alist
              (sort
-              (nnheader-article-to-file-alist nnml-current-directory)
+              (nnml-article-to-file-alist nnml-current-directory)
               'car-less-than-car)))
       (setq active
            (if nnml-article-file-alist
@@ -726,18 +726,22 @@ check twice.")
        (mail-header-set-number headers number)
        headers))))
 
+(defun nnml-get-nov-buffer (group)
+  (let ((buffer (get-buffer-create (format " *nnml overview %s*" group))))
+    (save-excursion
+      (set-buffer buffer)
+      (set (make-local-variable 'nnml-nov-buffer-file-name)
+          (expand-file-name
+           nnml-nov-file-name
+           (nnmail-group-pathname group nnml-directory)))
+      (erase-buffer)
+      (when (file-exists-p nnml-nov-buffer-file-name)
+       (nnheader-insert-file-contents nnml-nov-buffer-file-name)))
+    buffer))
+
 (defun nnml-open-nov (group)
   (or (cdr (assoc group nnml-nov-buffer-alist))
-      (let ((buffer (get-buffer-create (format " *nnml overview %s*" group))))
-       (save-excursion
-         (set-buffer buffer)
-         (set (make-local-variable 'nnml-nov-buffer-file-name)
-              (expand-file-name
-               nnml-nov-file-name
-               (nnmail-group-pathname group nnml-directory)))
-         (erase-buffer)
-         (when (file-exists-p nnml-nov-buffer-file-name)
-           (nnheader-insert-file-contents nnml-nov-buffer-file-name)))
+      (let ((buffer (nnml-get-nov-buffer group)))
        (push (cons group buffer) nnml-nov-buffer-alist)
        buffer)))
 
@@ -872,7 +876,51 @@ check twice.")
   (when (or (not nnml-article-file-alist)
            force)
     (setq nnml-article-file-alist
-         (nnheader-article-to-file-alist nnml-current-directory))))
+         (nnml-article-to-file-alist nnml-current-directory))))
+
+(defun nnml-directory-articles (dir)
+  "Return a list of all article files in a directory.
+Use the nov database for that directory if available."
+  (if (or gnus-nov-is-evil nnml-nov-is-evil
+         (not (file-exists-p
+               (expand-file-name nnml-nov-file-name dir))))
+      (nnheader-directory-articles dir)
+    ;; build list from .overview if available
+    ;; We would use nnml-open-nov, except that nnml-nov-buffer-alist is
+    ;; defvoo'd, and we might get called when it hasn't been swapped in.
+    (save-excursion
+      (let ((list nil)
+           art
+           (buffer (nnml-get-nov-buffer nnml-current-group)))
+       (set-buffer buffer)
+       (goto-char (point-min))
+       (while (not (eobp))
+         (setq art (read (current-buffer)))
+         (push art list)
+         (forward-line 1))
+       list))))
+
+(defun nnml-article-to-file-alist (dir)
+  "Return an alist of article/file pairs in DIR.
+Use the nov database for that directory if available."
+  (if (or gnus-nov-is-evil nnml-nov-is-evil
+         (not (file-exists-p
+               (expand-file-name nnml-nov-file-name
+                                 nnml-current-directory))))
+      (nnheader-article-to-file-alist nnml-current-directory)
+    ;; build list from .overview if available
+    (save-excursion
+      (let ((alist nil)
+           art
+           (buffer (nnml-get-nov-buffer nnml-current-group)))
+       (set-buffer buffer)
+       (goto-char (point-min))
+       (while (not (eobp))
+         (setq art (read (current-buffer)))
+         ;; assume file name is unadorned (ie. not compressed etc)
+         (push (cons art (int-to-string art)) alist)
+         (forward-line 1))
+       alist))))
 
 (deffoo nnml-request-set-mark (group actions &optional server)
   (nnml-possibly-change-directory group server)