]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/rmailsum.el
(makeinfo-compile): Use `compilation-start'. Set `next-error-function'
[gnu-emacs] / lisp / mail / rmailsum.el
index 3affdf88bb528666d3025458142723d094af90d7..129f3f485289ebd9c1637764ffcf624134af2492 100644 (file)
@@ -1,7 +1,7 @@
 ;;; rmailsum.el --- make summary buffers for the mail reader
 
-;; Copyright (C) 1985, 1993, 1994, 1995, 1996, 2000, 2001
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1993, 1994, 1995, 1996, 2000, 2001, 2002, 2003,
+;;   2004, 2005 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
 ;; Keywords: mail
@@ -20,8 +20,8 @@
 
 ;; 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., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
     ("^.....-.*" . font-lock-type-face)                                ; Unread.
     ;; Neither of the below will be highlighted if either of the above are:
     ("^.....[^D-] \\(......\\)" 1 font-lock-keyword-face)      ; Date.
-    ("{ \\([^\n}]+\\),}" 1 font-lock-comment-face))            ; Labels.
+    ("{ \\([^\n}]+\\) }" 1 font-lock-comment-face))            ; Labels.
   "Additional expressions to highlight in Rmail Summary mode.")
 
+(defvar rmail-summary-redo
+  "(FUNCTION . ARGS) to regenerate this Rmail summary buffer.")
+
+(defvar rmail-summary-overlay nil)
+(put 'rmail-summary-overlay 'permanent-local t)
+
+(defvar rmail-summary-mode-map nil)
+
 ;; Entry points for making a summary buffer.
 
 ;; Regenerate the contents of the summary
@@ -165,6 +173,8 @@ SENDERS is a string of names separated by commas."
 
 (defvar rmail-summary-symbol-number 0)
 
+(defvar rmail-new-summary-line-count)
+
 (defun rmail-new-summary (description redo-form function &rest args)
   "Create a summary of selected messages.
 DESCRIPTION makes part of the mode line of the summary buffer.
@@ -187,7 +197,7 @@ nil for FUNCTION means all messages."
       (setq mesg rmail-current-message)
       ;; Filter the messages; make or get their summary lines.
       (let ((summary-msgs ())
-           (new-summary-line-count 0))
+           (rmail-new-summary-line-count 0))
        (let ((msgnum 1)
              (buffer-read-only nil)
              (old-min (point-min-marker))
@@ -263,11 +273,11 @@ nil for FUNCTION means all messages."
 (defun rmail-make-summary-line (msg)
   (let ((line (or (aref rmail-summary-vector (1- msg))
                  (progn
-                   (setq new-summary-line-count
-                         (1+ new-summary-line-count))
-                   (if (zerop (% new-summary-line-count 10))
+                   (setq rmail-new-summary-line-count
+                         (1+ rmail-new-summary-line-count))
+                   (if (zerop (% rmail-new-summary-line-count 10))
                        (message "Computing summary lines...%d"
-                                new-summary-line-count))
+                                rmail-new-summary-line-count))
                    (rmail-make-summary-line-1 msg)))))
     ;; Fix up the part of the summary that says "deleted" or "unseen".
     (aset line 5
@@ -300,8 +310,12 @@ By default, `identity' is set."
                 ""
               (concat "{"
                       (buffer-substring (point)
-                                        (progn (end-of-line) (point)))
-                      "} ")))))
+                                        (progn (end-of-line)
+                                               (backward-char)
+                                               (if (looking-at ",")
+                                                   (point)
+                                                 (1+ (point)))))
+                      " } ")))))
         (line
          (progn
            (forward-line 1)
@@ -371,17 +385,17 @@ Setting this variable has an effect only before reading a mail."
              (cond ((re-search-forward "\\([^0-9:]\\)\\([0-3]?[0-9]\\)\\([- \t_]+\\)\\([adfjmnos][aceopu][bcglnprtvy]\\)"
                      (save-excursion (end-of-line) (point)) t)
                     (format "%2d-%3s"
-                            (string-to-int (buffer-substring
-                                            (match-beginning 2)
-                                            (match-end 2)))
+                            (string-to-number (buffer-substring
+                                                (match-beginning 2)
+                                                (match-end 2)))
                             (buffer-substring
                              (match-beginning 4) (match-end 4))))
                    ((re-search-forward "\\([^a-z]\\)\\([adfjmnos][acepou][bcglnprtvy]\\)\\([-a-z \t_]*\\)\\([0-9][0-9]?\\)"
                      (save-excursion (end-of-line) (point)) t)
                     (format "%2d-%3s"
-                            (string-to-int (buffer-substring
-                                            (match-beginning 4)
-                                            (match-end 4)))
+                            (string-to-number (buffer-substring
+                                                (match-beginning 4)
+                                                (match-end 4)))
                             (buffer-substring
                              (match-beginning 2) (match-end 2))))
                    ((re-search-forward "\\(19\\|20\\)\\([0-9][0-9]\\)-\\([01][0-9]\\)-\\([0-3][0-9]\\)"
@@ -576,7 +590,7 @@ If N is negative, go backwards."
            ;; Advance thru summary.
            (forward-line (if forward 1 -1))
            ;; Get msg number of this line.
-           (setq i (string-to-int
+           (setq i (string-to-number
                     (buffer-substring (point)
                                       (min (point-max) (+ 6 (point))))))
            ;; See if that msg has desired subject.
@@ -756,7 +770,7 @@ Commands for sorting the summary:
   (make-local-variable 'font-lock-defaults)
   (setq font-lock-defaults '(rmail-summary-font-lock-keywords t))
   (rmail-summary-enable)
-  (run-hooks 'rmail-summary-mode-hook))
+  (run-mode-hooks 'rmail-summary-mode-hook))
 
 ;; Summary features need to be disabled during edit mode.
 (defun rmail-summary-disable ()
@@ -787,10 +801,10 @@ Search, the `unseen' attribute is restored.")
          (forward-line -1))
       (beginning-of-line)
       (skip-chars-forward " ")
-      (let ((msg-num (string-to-int (buffer-substring
-                                    (point)
-                                    (progn (skip-chars-forward "0-9")
-                                           (point))))))
+      (let ((msg-num (string-to-number (buffer-substring
+                                        (point)
+                                        (progn (skip-chars-forward "0-9")
+                                               (point))))))
        ;; Always leave `unseen' removed
        ;; if we get out of isearch mode.
        ;; Don't let a subsequent isearch restore that `unseen'.
@@ -838,8 +852,6 @@ Search, the `unseen' attribute is restored.")
                      (rmail-show-message msg-num t))))))
        (rmail-summary-update-highlight nil)))))
 \f
-(defvar rmail-summary-mode-map nil)
-
 (if rmail-summary-mode-map
     nil
   (setq rmail-summary-mode-map (make-keymap))
@@ -886,6 +898,7 @@ Search, the `unseen' attribute is restored.")
   (define-key rmail-summary-mode-map "x"      'rmail-summary-expunge)
   (define-key rmail-summary-mode-map "w"      'rmail-summary-output-body)
   (define-key rmail-summary-mode-map "."      'rmail-summary-beginning-of-message)
+  (define-key rmail-summary-mode-map "/"      'rmail-summary-end-of-message)
   (define-key rmail-summary-mode-map "<"      'rmail-summary-first-message)
   (define-key rmail-summary-mode-map ">"      'rmail-summary-last-message)
   (define-key rmail-summary-mode-map " "      'rmail-summary-scroll-msg-up)
@@ -1033,9 +1046,6 @@ Search, the `unseen' attribute is restored.")
 (define-key rmail-summary-mode-map [menu-bar move next]
   '("Next" . rmail-summary-next-all))
 \f
-(defvar rmail-summary-overlay nil)
-(put 'rmail-summary-overlay 'permanent-local t)
-
 (defun rmail-summary-mouse-goto-message (event)
   "Select the message whose summary line you click on."
   (interactive "@e")
@@ -1057,7 +1067,7 @@ If SKIP-RMAIL, don't do anything to the Rmail buffer."
         (buf rmail-buffer)
         (cur (point))
         message-not-found
-        (curmsg (string-to-int
+        (curmsg (string-to-number
                  (buffer-substring (point)
                                    (min (point-max) (+ 6 (point))))))
         (total (save-excursion (set-buffer buf) rmail-total-messages)))
@@ -1070,7 +1080,8 @@ If SKIP-RMAIL, don't do anything to the Rmail buffer."
       (if (< n 1)
          (progn (message "No preceding message")
                 (setq n 1)))
-      (if (> n total)
+      (if (and (> n total)
+              (> total 0))
          (progn (message "No following message")
                 (goto-char (point-max))
                 (rmail-summary-goto-msg nil nowarn skip-rmail)))
@@ -1175,6 +1186,16 @@ move to the previous message."
 (defun rmail-summary-beginning-of-message ()
   "Show current message from the beginning."
   (interactive)
+  (rmail-summary-show-message 'BEG))
+
+(defun rmail-summary-end-of-message ()
+  "Show bottom of current message."
+  (interactive)
+  (rmail-summary-show-message 'END))
+
+(defun rmail-summary-show-message (where)
+  "Show current mail message.
+Position it according to WHERE which can be BEG or END"
   (if (and (one-window-p) (not pop-up-frames))
       ;; If there is just one window, put the summary on the top.
       (let ((buffer rmail-view-buffer))
@@ -1186,7 +1207,14 @@ move to the previous message."
        (or (eq buffer (window-buffer (next-window (frame-first-window))))
            (delete-other-windows)))
     (pop-to-buffer rmail-view-buffer))
-  (beginning-of-buffer)
+  (cond
+   ((eq where 'BEG)
+       (goto-char (point-min))
+       (search-forward "\n\n"))
+   ((eq where 'END)
+       (goto-char (point-max))
+       (recenter (1- (window-height))))
+   )
   (pop-to-buffer rmail-summary-buffer))
 
 (defun rmail-summary-bury ()
@@ -1270,12 +1298,14 @@ argument says to read a file name and use that file as the inbox."
 (defun rmail-summary-first-message ()
   "Show first message in Rmail file from summary buffer."
   (interactive)
-  (beginning-of-buffer))
+  (with-no-warnings
+    (beginning-of-buffer)))
 
 (defun rmail-summary-last-message ()
   "Show last message in Rmail file from summary buffer."
   (interactive)
-  (end-of-buffer)
+  (with-no-warnings
+    (end-of-buffer))
   (forward-line -1))
 
 (defvar rmail-summary-edit-map nil)