diff lisp/vm/vm-startup.el @ 20:859a2309aef8 r19-15b93

Import from CVS: tag r19-15b93
author cvs
date Mon, 13 Aug 2007 08:50:05 +0200
parents 49a24b4fd526
children 4103f0995bd7
line wrap: on
line diff
--- a/lisp/vm/vm-startup.el	Mon Aug 13 08:49:44 2007 +0200
+++ b/lisp/vm/vm-startup.el	Mon Aug 13 08:50:05 2007 +0200
@@ -1,5 +1,5 @@
 ;;; Entry points for VM
-;;; Copyright (C) 1994, 1995 Kyle E. Jones
+;;; Copyright (C) 1994-1997 Kyle E. Jones
 ;;;
 ;;; This program is free software; you can redistribute it and/or modify
 ;;; it under the terms of the GNU General Public License as published by
@@ -72,6 +72,7 @@
 			  (vm-unsaved-message "Reading %s... done" file))))))))
       (set-buffer folder-buffer)
       (vm-check-for-killed-summary)
+      (vm-check-for-killed-presentation)
       ;; If the buffer's not modified then we know that there can be no
       ;; messages in the folder that are not on disk.
       (or (buffer-modified-p) (setq vm-messages-not-on-disk 0))
@@ -85,7 +86,7 @@
       ;; save file contains information the user might not
       ;; want overwritten, i.e. recover-file might be
       ;; desired.  What we want to avoid is an auto-save.
-      ;; Making the folder read only will keep it
+      ;; Making the folder read only will keep
       ;; subsequent actions from modifying the buffer in a
       ;; way that triggers an auto save.
       ;;
@@ -120,26 +121,20 @@
       ;; make a new frame if the user wants one.  reuse an
       ;; existing frame that is showing this folder.
       (if (and full-startup
-	       vm-frame-per-folder
-	       (vm-multiple-frames-possible-p)
 	       ;; this so that "emacs -f vm" doesn't create a frame.
 	       this-command)
-	  (let ((w (or (vm-get-buffer-window (current-buffer))
-		       ;; summary == folder for the purpose
-		       ;; of frame reuse.
-		       (and vm-summary-buffer
-			    (vm-get-buffer-window vm-summary-buffer)))))
-	    (if (null w)
-		(progn
-		  (if folder
-		      (vm-goto-new-frame 'folder)
-		    (vm-goto-new-frame 'primary-folder 'folder))
-		  (vm-set-hooks-for-frame-deletion))
-	      (save-excursion
-		(select-window w)
-		(and vm-warp-mouse-to-new-frame
-		     (vm-warp-mouse-to-frame-maybe (vm-window-frame w)))))))
-      
+	  (apply 'vm-goto-new-folder-frame-maybe
+		 (if folder '(folder) '(primary-folder folder))))
+
+      ;; raise frame if requested and apply startup window
+      ;; configuration.
+      (if full-startup
+	  (progn
+	    (if vm-raise-frame-at-startup
+		(vm-raise-frame))
+	    (vm-display nil nil (list this-command)
+			(list (or this-command 'vm) 'startup))))
+
       ;; say this NOW, before the non-previewers read a message,
       ;; alter the new message count and confuse themselves.
       (if full-startup
@@ -150,8 +145,6 @@
       (if vm-message-list
 	  (vm-preview-current-message)
 	(vm-update-summary-and-mode-line))
-      (if full-startup
-	  (vm-display (current-buffer) t nil nil))
       ;; need to do this after any frame creation because the
       ;; toolbar sets frame-specific height and width specifiers.
       (and (vm-toolbar-support-possible-p) vm-use-toolbar
@@ -163,23 +156,29 @@
 	   (vm-menu-install-visited-folders-menu))
 
       (if full-startup
-	  (save-excursion
-	    (vm-display (current-buffer) t nil nil)
-	    (if	(and (vm-should-generate-summary)
+	  (progn
+	    (if (and (vm-should-generate-summary)
 		     ;; don't generate a summary if recover-file is
 		     ;; likely to happen, since recover-file does
 		     ;; nothing useful in a summary buffer.
 		     (not preserve-auto-save-file))
-		(vm-summarize t))
-	    ;; People were confused that (vm) behaved differently
-	    ;; than M-x vm.  We used to list all the various VM
-	    ;; startup commands here, but now we just accept any
-	    ;; command and treat it as if it were VM.  It's
-	    ;; probably just as well, since any command that
-	    ;; calls VM probably does want the window
-	    ;; configuration to be setup.
-	    (vm-display nil nil (list this-command)
-			(list (or this-command 'vm) 'startup))))
+		(vm-summarize t nil))
+	    ;; raise the summary frame if the user wants frames
+	    ;; raised and if there is a summary frame.
+	    (if (and vm-summary-buffer
+		     vm-frame-per-summary
+		     vm-raise-frame-at-startup)
+		(vm-raise-frame))
+	    ;; if vm-mutable-windows is nil, the startup
+	    ;; configuration can't be applied, so do
+	    ;; something to get a VM buffer on the screen
+	    (if vm-mutable-windows
+		(vm-display nil nil (list this-command)
+			    (list (or this-command 'vm) 'startup))
+	      (save-excursion
+		(switch-to-buffer (or vm-summary-buffer
+				      vm-presentation-buffer
+				      (current-buffer)))))))
 
       (run-hooks 'vm-visit-folder-hook)
 
@@ -213,8 +212,7 @@
       ;; user says no.
       ;; Check this-command so we don't make the user wait if
       ;; they call vm non-interactively from some other program.
-      (if (and (not vm-inhibit-startup-message)
-	       (not vm-startup-message-displayed)
+      (if (and (not vm-startup-message-displayed)
 	       (or (memq this-command '(vm vm-visit-folder))
 		   ;; for emacs -f vm
 		   (null last-command)))
@@ -253,7 +251,7 @@
 (defun vm-mode (&optional read-only)
   "Major mode for reading mail.
 
-This is VM 5.96 (beta).
+This is VM 6.13.
 
 Commands:
    h - summarize folder contents
@@ -293,7 +291,7 @@
 
    @ - digestify and mail entire folder contents (the folder is not modified)
    * - burst a digest into individual messages, and append and assimilate these
-       message into the current folder.
+       messages into the current folder.
 
    G - sort messages by various keys
 
@@ -322,14 +320,16 @@
        M U - unmark the current message
        M m - mark all messages
        M u - unmark all messages
-       M C - mark messages matches by a virtual folder selector
-       M c - unmark messages matches by a virtual folder selector
+       M C - mark messages matched by a virtual folder selector
+       M c - unmark messages matched by a virtual folder selector
        M T - mark thread tree rooted at the current message
        M t - unmark thread tree rooted at the current message
        M S - mark messages with the same subject as the current message
        M s - unmark messages with the same subject as the current message
        M A - mark messages with the same author as the current message
        M a - unmark messages with the same author as the current message
+       M R - mark messages within the point/mark region in the summary
+       M r - unmark messages within the point/mark region in the summary
 
        M ? - partial help for mark commands
 
@@ -376,17 +376,21 @@
    vm-arrived-message-hook
    vm-arrived-messages-hook
    vm-auto-center-summary
+   vm-auto-decode-mime-messages
+   vm-auto-displayed-mime-content-types
    vm-auto-folder-alist
    vm-auto-folder-case-fold-search
    vm-auto-get-new-mail
    vm-auto-next-message
    vm-berkeley-mail-compatibility
+   vm-burst-digest-messages-inherit-labels
    vm-check-folder-types
-   vm-convert-folder-types
    vm-circular-folders
    vm-confirm-new-folders
    vm-confirm-quit
+   vm-convert-folder-types
    vm-crash-box
+   vm-crash-box-suffix
    vm-default-folder-type
    vm-delete-after-archiving
    vm-delete-after-bursting
@@ -397,6 +401,7 @@
    vm-digest-preamble-format
    vm-digest-send-type
    vm-display-buffer-hook
+   vm-display-using-mime
    vm-edit-message-hook
    vm-folder-directory
    vm-folder-read-only
@@ -406,8 +411,11 @@
    vm-forwarding-digest-type
    vm-forwarding-subject-format
    vm-frame-parameter-alist
+   vm-frame-per-completion
    vm-frame-per-composition
+   vm-frame-per-edit
    vm-frame-per-folder
+   vm-frame-per-summary
    vm-highlighted-header-face
    vm-highlighted-header-regexp
    vm-honor-page-delimiters
@@ -416,32 +424,52 @@
    vm-included-text-discard-header-regexp
    vm-included-text-headers
    vm-included-text-prefix
-   vm-inhibit-startup-message
    vm-invisible-header-regexp
    vm-jump-to-new-messages
    vm-jump-to-unread-messages
+   vm-keep-crash-boxes
    vm-keep-sent-messages
-   vm-keep-crash-boxes
    vm-mail-header-from
    vm-mail-mode-hook
+   vm-make-crash-box-name
+   vm-make-spool-file-name
+   vm-mime-8bit-composition-charset
+   vm-mime-8bit-text-transfer-encoding
+   vm-mime-alternative-select-method
+   vm-mime-attachment-auto-type-alist
+   vm-mime-attachment-save-directory
+   vm-mime-avoid-folding-content-type
+   vm-mime-base64-decoder-program
+   vm-mime-base64-decoder-switches
+   vm-mime-base64-encoder-program
+   vm-mime-base64-encoder-switches
+   vm-mime-button-face
+   vm-mime-digest-discard-header-regexp
+   vm-mime-digest-headers
+   vm-mime-display-function
+   vm-mime-external-content-types-alist
+   vm-mime-internal-content-types
+   vm-mime-max-message-size
    vm-mode-hook
    vm-mosaic-program
    vm-move-after-deleting
+   vm-move-after-killing
    vm-move-after-undeleting
    vm-move-messages-physically
+   vm-mutable-frames
    vm-mutable-windows
-   vm-mutable-frames
    vm-netscape-program
-   vm-options-file
    vm-pop-md5-program
+   vm-popup-menu-on-mouse-3
+   vm-preferences-file
    vm-preview-lines
    vm-preview-read-messages
    vm-primary-inbox
    vm-quit-hook
    vm-recognize-pop-maildrops
    vm-reply-hook
+   vm-reply-ignored-addresses
    vm-reply-ignored-reply-tos
-   vm-reply-ignored-addresses
    vm-reply-subject-prefix
    vm-resend-bounced-discard-header-regexp
    vm-resend-bounced-headers
@@ -459,9 +487,11 @@
    vm-select-new-message-hook
    vm-select-unread-message-hook
    vm-send-digest-hook
+   vm-send-using-mime
    vm-skip-deleted-messages
    vm-skip-read-messages
    vm-spool-files
+   vm-spool-file-suffixes
    vm-startup-with-summary
    vm-strip-reply-headers
    vm-summary-arrow
@@ -470,14 +500,16 @@
    vm-summary-mode-hook
    vm-summary-redo-hook
    vm-summary-show-threads
-   vm-summary-subject-no-newlines
    vm-summary-thread-indent-level
+   vm-temp-file-directory
+   vm-tale-is-an-idiot
    vm-trust-From_-with-Content-Length
    vm-undisplay-buffer-hook
    vm-unforwarded-header-regexp
    vm-url-browser
    vm-url-search-limit
    vm-use-menus
+   vm-use-toolbar
    vm-virtual-folder-alist
    vm-virtual-mirror
    vm-visible-headers
@@ -633,13 +665,15 @@
 	  (use-local-map vm-mode-map)
 	  (and (vm-menu-support-possible-p)
 	       (vm-menu-install-menus))
+	  (add-hook 'kill-buffer-hook 'vm-garbage-collect-folder)
+	  (add-hook 'kill-buffer-hook 'vm-garbage-collect-message)
 	  ;; save this for last in case the user interrupts.
 	  ;; an interrupt anywhere before this point will cause
 	  ;; everything to be redone next revisit.
 	  (setq major-mode 'vm-virtual-mode)
 	  (run-hooks 'vm-virtual-mode-hook)
 	  ;; must come after the setting of major-mode
-	  (setq mode-popup-menu (and vm-use-menus
+	  (setq mode-popup-menu (and vm-use-menus vm-popup-menu-on-mouse-3
 				     (vm-menu-support-possible-p)
 				     (vm-menu-mode-menu)))
 	  (setq blurb (vm-emit-totals-blurb))
@@ -651,35 +685,37 @@
 	  (message blurb)))
     ;; make a new frame if the user wants one.  reuse an
     ;; existing frame that is showing this folder.
-    (if (and vm-frame-per-folder (vm-multiple-frames-possible-p))
-	(let ((w (or (vm-get-buffer-window (current-buffer))
-		     ;; summary == folder for the purpose
-		     ;; of frame reuse.
-		     (and vm-summary-buffer
-			  (vm-get-buffer-window (current-buffer))))))
-	  (if (null w)
-	      (vm-goto-new-frame 'folder)
-	    (save-excursion
-	      (select-window w)
-	      (and vm-warp-mouse-to-new-frame
-		   (vm-warp-mouse-to-frame-maybe (vm-window-frame w)))))
-	  (vm-set-hooks-for-frame-deletion)))
-    (vm-display (current-buffer) t nil nil)
+    (vm-goto-new-folder-frame-maybe 'folder)
+    (if vm-raise-frame-at-startup
+	(vm-raise-frame))
+    (vm-display nil nil (list this-command) (list this-command 'startup))
     (and (vm-toolbar-support-possible-p) vm-use-toolbar
 	 (vm-toolbar-install-toolbar))
     (if first-time
-	(if (vm-should-generate-summary)
-	    (progn (vm-summarize t)
-		   (message blurb))))
-    (vm-display nil nil '(vm-visit-virtual-folder
-			  vm-visit-virtual-folder-other-frame
-			  vm-visit-virtual-folder-other-window
-			  vm-create-virtual-folder
-			  vm-apply-virtual-folder)
-		(list this-command 'startup))
+	(progn
+	  (if (vm-should-generate-summary)
+	      (progn (vm-summarize t nil)
+		     (message blurb)))
+	  ;; raise the summary frame if the user wants frames
+	  ;; raised and if there is a summary frame.
+	  (if (and vm-summary-buffer
+		   vm-frame-per-summary
+		   vm-raise-frame-at-startup)
+	      (vm-raise-frame))
+	  ;; if vm-mutable-windows is nil, the startup
+	  ;; configuration can't be applied, so do
+	  ;; something to get a VM buffer on the screen
+	  (if vm-mutable-windows
+	      (vm-display nil nil (list this-command)
+			  (list (or this-command 'vm) 'startup))
+	    (save-excursion
+	      (switch-to-buffer (or vm-summary-buffer
+				    vm-presentation-buffer
+				    (current-buffer)))))))
+
     ;; check interactive-p so as not to bog the user down if they
     ;; run this function from within another function.
-    (and (interactive-p) (not vm-inhibit-startup-message)
+    (and (interactive-p)
 	 (not vm-startup-message-displayed)
 	 (vm-display-startup-message)
 	 (message blurb))))
@@ -768,6 +804,8 @@
       'vm-arrived-message-hook
       'vm-arrived-messages-hook
       'vm-auto-center-summary
+      'vm-auto-decode-mime-messages
+      'vm-auto-displayed-mime-content-types
 ;; don't send this by default, might be personal stuff in here.
 ;;      'vm-auto-folder-alist
       'vm-auto-folder-case-fold-search
@@ -780,6 +818,7 @@
       'vm-confirm-quit
       'vm-convert-folder-types
       'vm-crash-box
+      'vm-crash-box-suffix
       'vm-default-folder-type
       'vm-delete-after-archiving
       'vm-delete-after-bursting
@@ -791,6 +830,7 @@
       'vm-digest-preamble-format
       'vm-digest-send-type
       'vm-display-buffer-hook
+      'vm-display-using-mime
       'vm-edit-message-hook
       'vm-edit-message-mode
       'vm-flush-interval
@@ -802,8 +842,11 @@
       'vm-forwarding-digest-type
       'vm-forwarding-subject-format
       'vm-frame-parameter-alist
+      'vm-frame-per-completion
       'vm-frame-per-composition
+      'vm-frame-per-edit
       'vm-frame-per-folder
+      'vm-frame-per-summary
       'vm-highlight-url-face
       'vm-highlighted-header-regexp
       'vm-honor-page-delimiters
@@ -812,7 +855,6 @@
       'vm-included-text-discard-header-regexp
       'vm-included-text-headers
       'vm-included-text-prefix
-      'vm-inhibit-startup-message
       'vm-init-file
       'vm-invisible-header-regexp
       'vm-jump-to-new-messages
@@ -821,7 +863,26 @@
       'vm-keep-sent-messages
       'vm-mail-header-from
       'vm-mail-hook
+      'vm-make-crash-box-name
+      'vm-make-spool-file-name
       'vm-mail-mode-hook
+      'vm-mime-8bit-composition-charset
+      'vm-mime-8bit-text-transfer-encoding
+      'vm-mime-alternative-select-method
+      'vm-mime-attachment-auto-type-alist
+      'vm-mime-attachment-save-directory
+      'vm-mime-avoid-folding-content-type
+      'vm-mime-base64-decoder-program
+      'vm-mime-base64-decoder-switches
+      'vm-mime-base64-encoder-program
+      'vm-mime-base64-encoder-switches
+      'vm-mime-button-face
+      'vm-mime-digest-discard-header-regexp
+      'vm-mime-digest-headers
+      'vm-mime-display-function
+      'vm-mime-external-content-types-alist
+      'vm-mime-internal-content-types
+      'vm-mime-max-message-size
       'vm-mode-hook
       'vm-mode-hooks
       'vm-mosaic-program
@@ -832,8 +893,9 @@
       'vm-mutable-frames
       'vm-mutable-windows
       'vm-netscape-program
-      'vm-options-file
       'vm-pop-md5-program
+      'vm-popup-menu-on-mouse-3
+      'vm-preferences-file
       'vm-preview-lines
       'vm-preview-read-messages
       'vm-primary-inbox
@@ -859,10 +921,12 @@
       'vm-select-new-message-hook
       'vm-select-unread-message-hook
       'vm-send-digest-hook
+      'vm-send-using-mime
       'vm-skip-deleted-messages
       'vm-skip-read-messages
 ;; don't send vm-spool-files by default, might contain passwords
 ;;      'vm-spool-files
+      'vm-spool-file-suffixes
       'vm-startup-with-summary
       'vm-strip-reply-headers
       'vm-summary-format
@@ -871,17 +935,18 @@
       'vm-summary-mode-hooks
       'vm-summary-redo-hook
       'vm-summary-show-threads
-      'vm-summary-subject-no-newlines
       'vm-summary-thread-indent-level
       'vm-summary-uninteresting-senders
       'vm-summary-uninteresting-senders-arrow
       'vm-tale-is-an-idiot
+      'vm-temp-file-directory
       'vm-trust-From_-with-Content-Length
       'vm-undisplay-buffer-hook
       'vm-unforwarded-header-regexp
       'vm-url-browser
       'vm-url-search-limit
       'vm-use-menus
+      'vm-use-toolbar
       'vm-virtual-folder-alist
       'vm-virtual-mirror
       'vm-visible-headers
@@ -909,7 +974,22 @@
   (setq vm-init-file-loaded t)
   (vm-display nil nil '(vm-load-init-file) '(vm-load-init-file)))
 
+(defun vm-check-emacs-version ()
+  (cond ((and (vm-xemacs-p)
+	      (or (< emacs-major-version 19)
+		  (and (= emacs-major-version 19)
+		       (< emacs-minor-version 14))))
+	 (error "VM %s must be run on XEmacs 19.14 or a later version."
+		vm-version))
+	((and (vm-fsfemacs-19-p)
+	      (or (< emacs-major-version 19)
+		  (and (= emacs-major-version 19)
+		       (< emacs-minor-version 34))))
+	 (error "VM %s must be run on Emacs 19.34 or a later version."
+		vm-version))))
+
 (defun vm-session-initialization ()
+  (vm-check-emacs-version)
   ;; If this is the first time VM has been run in this Emacs session,
   ;; do some necessary preparations.
   (if (or (not (boundp 'vm-session-beginning))