;;; mspools.el --- show mail spools waiting to be read
-;; Copyright (C) 1997, 2001, 2002, 2003, 2004, 2005,
-;; 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2011 Free Software Foundation, Inc.
;; Author: Stephen Eglen <stephen@gnu.org>
;; Maintainer: Stephen Eglen <stephen@gnu.org>
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is 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 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Rather than showing size in bytes, could we see the number of msgs
;; waiting? (Could be more time demanding / system dependent).
;; Maybe just call a perl script to do all the hard work, and
-;; visualise the results in the buffer.
+;; visualize the results in the buffer.
;; Shrink wrap the buffer to remove excess white-space?
(defvar mspools-buffer "*spools*"
"Name of buffer for displaying spool info.")
-(defvar mspools-mode-map nil
+(defvar mspools-mode-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "\C-c\C-c" 'mspools-visit-spool)
+ (define-key map "\C-m" 'mspools-visit-spool)
+ (define-key map " " 'mspools-visit-spool)
+ (define-key map "?" 'mspools-help)
+ (define-key map "q" 'mspools-quit)
+ (define-key map "n" 'next-line)
+ (define-key map "p" 'previous-line)
+ (define-key map "g" 'revert-buffer)
+ map)
"Keymap for the *spools* buffer.")
;;; Code
;; Mailing list inboxes
;; must have VM already loaded to get vm-folder-directory.
- (mapcar '(lambda (s)
- "make the appropriate entry for vm-spool-files"
- (list
- (concat mspools-folder-directory s)
- (concat mspools-folder-directory s "." mspools-suffix)
- (concat mspools-folder-directory s ".crash")))
+ (mapcar (lambda (s)
+ "make the appropriate entry for vm-spool-files"
+ (list
+ (concat mspools-folder-directory s)
+ (concat mspools-folder-directory s "." mspools-suffix)
+ (concat mspools-folder-directory s ".crash")))
;; So I create a vm-spool-files entry for each of those mail drops
(mapcar 'file-name-sans-extension
(directory-files mspools-folder-directory nil
))
(message "folder %s spool %s" folder-name spool-name)
- (if (eq (count-lines (point-min)
- (save-excursion
- (end-of-line)
- (point)))
+ (if (eq (count-lines (point-min) (point-at-eol))
mspools-files-len)
(forward-line (- 1 mspools-files-len)) ;back to top of list
;; else just on to next line
(defun mspools-get-spool-name ()
"Return the name of the spool on the current line."
- (let ((line-num (1- (count-lines (point-min)
- (save-excursion
- (end-of-line)
- (point))
- ))))
+ (let ((line-num (1- (count-lines (point-min) (point-at-eol)))))
(car (nth line-num mspools-files))))
-;;; Keymap
-
-(if mspools-mode-map
- ()
- (setq mspools-mode-map (make-sparse-keymap))
-
- (define-key mspools-mode-map "\C-c\C-c" 'mspools-visit-spool)
- (define-key mspools-mode-map "\C-m" 'mspools-visit-spool)
- (define-key mspools-mode-map " " 'mspools-visit-spool)
- (define-key mspools-mode-map "?" 'mspools-help)
- (define-key mspools-mode-map "q" 'mspools-quit)
- (define-key mspools-mode-map "n" 'next-line)
- (define-key mspools-mode-map "p" 'previous-line)
- (define-key mspools-mode-map "g" 'revert-buffer))
-
;;; Spools mode functions
(defun mspools-revert-buffer (ignore noconfirm)
(provide 'mspools)
-;; arch-tag: 8990b3ee-68c8-4892-98f1-51a735c8bac6
;;; mspools.el ends here