Mercurial > hg > xemacs-beta
comparison lisp/vm/vm-startup.el @ 54:05472e90ae02 r19-16-pre2
Import from CVS: tag r19-16-pre2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:57:55 +0200 |
parents | 8b8b7f3559a2 |
children | 131b0175ea99 |
comparison
equal
deleted
inserted
replaced
53:875393c1a535 | 54:05472e90ae02 |
---|---|
23 to the value of vm-primary-inbox. The folder buffer is put into VM | 23 to the value of vm-primary-inbox. The folder buffer is put into VM |
24 mode, a major mode for reading mail. | 24 mode, a major mode for reading mail. |
25 | 25 |
26 Prefix arg or optional second arg READ-ONLY non-nil indicates | 26 Prefix arg or optional second arg READ-ONLY non-nil indicates |
27 that the folder should be considered read only. No attribute | 27 that the folder should be considered read only. No attribute |
28 changes, messages additions or deletions will be allowed in the | 28 changes, message additions or deletions will be allowed in the |
29 visited folder. | 29 visited folder. |
30 | 30 |
31 Visiting the primary inbox causes any contents of the system mailbox to | 31 Visiting the primary inbox causes any contents of the system mailbox to |
32 be moved and appended to the resulting buffer. | 32 be moved and appended to the resulting buffer. |
33 | 33 |
61 (expand-file-name vm-folder-directory)) | 61 (expand-file-name vm-folder-directory)) |
62 default-directory)) | 62 default-directory)) |
63 (inhibit-local-variables t) | 63 (inhibit-local-variables t) |
64 (enable-local-variables nil) | 64 (enable-local-variables nil) |
65 ;; for XEmacs/Mule | 65 ;; for XEmacs/Mule |
66 (overriding-file-coding-system 'no-conversion)) | 66 (coding-system-for-read 'no-conversion)) |
67 (message "Reading %s..." file) | 67 (message "Reading %s..." file) |
68 (prog1 (find-file-noselect file) | 68 (prog1 (find-file-noselect file) |
69 ;; update folder history | 69 ;; update folder history |
70 (let ((item (or folder vm-primary-inbox))) | 70 (let ((item (or folder vm-primary-inbox))) |
71 (if (not (equal item (car vm-folder-history))) | 71 (if (not (equal item (car vm-folder-history))) |
78 ;; If the file coding system is not a no-conversion variant, | 78 ;; If the file coding system is not a no-conversion variant, |
79 ;; make it so by encoding all the text, then setting | 79 ;; make it so by encoding all the text, then setting |
80 ;; the file coding system and decoding it. | 80 ;; the file coding system and decoding it. |
81 ;; This is only possible if a file is visited and then vm-mode | 81 ;; This is only possible if a file is visited and then vm-mode |
82 ;; is run on it afterwards. | 82 ;; is run on it afterwards. |
83 (defvar file-coding-system) | 83 (defvar buffer-file-coding-system) |
84 (if (and (vm-xemacs-mule-p) | 84 (if (and vm-xemacs-mule-p |
85 (not (eq (get-coding-system file-coding-system) | 85 (not (eq (get-coding-system buffer-file-coding-system) |
86 (get-coding-system 'no-conversion-unix))) | 86 (get-coding-system 'no-conversion-unix))) |
87 (not (eq (get-coding-system file-coding-system) | 87 (not (eq (get-coding-system buffer-file-coding-system) |
88 (get-coding-system 'no-conversion-dos))) | 88 (get-coding-system 'no-conversion-dos))) |
89 (not (eq (get-coding-system file-coding-system) | 89 (not (eq (get-coding-system buffer-file-coding-system) |
90 (get-coding-system 'no-conversion-mac))) | 90 (get-coding-system 'no-conversion-mac))) |
91 (not (eq (get-coding-system file-coding-system) | 91 (not (eq (get-coding-system buffer-file-coding-system) |
92 (get-coding-system 'binary)))) | 92 (get-coding-system 'binary)))) |
93 (let ((buffer-read-only nil) | 93 (let ((buffer-read-only nil) |
94 (omodified (buffer-modified-p))) | 94 (omodified (buffer-modified-p))) |
95 (unwind-protect | 95 (unwind-protect |
96 (progn | 96 (progn |
97 (encode-coding-region (point-min) (point-max) | 97 (encode-coding-region (point-min) (point-max) |
98 file-coding-system) | 98 buffer-file-coding-system) |
99 (set-file-coding-system 'no-conversion nil) | 99 (set-buffer-file-coding-system 'no-conversion nil) |
100 (decode-coding-region (point-min) (point-max) | 100 (decode-coding-region (point-min) (point-max) |
101 file-coding-system)) | 101 buffer-file-coding-system)) |
102 (set-buffer-modified-p omodified)))) | 102 (set-buffer-modified-p omodified)))) |
103 (vm-check-for-killed-summary) | 103 (vm-check-for-killed-summary) |
104 (vm-check-for-killed-presentation) | 104 (vm-check-for-killed-presentation) |
105 ;; If the buffer's not modified then we know that there can be no | 105 ;; If the buffer's not modified then we know that there can be no |
106 ;; messages in the folder that are not on disk. | 106 ;; messages in the folder that are not on disk. |
156 (if folder '(folder) '(primary-folder folder)))) | 156 (if folder '(folder) '(primary-folder folder)))) |
157 | 157 |
158 ;; raise frame if requested and apply startup window | 158 ;; raise frame if requested and apply startup window |
159 ;; configuration. | 159 ;; configuration. |
160 (if full-startup | 160 (if full-startup |
161 (progn | 161 (let ((buffer-to-display (or vm-summary-buffer |
162 vm-presentation-buffer | |
163 (current-buffer)))) | |
164 (vm-display buffer-to-display buffer-to-display | |
165 (list this-command) | |
166 (list (or this-command 'vm) 'startup)) | |
162 (if vm-raise-frame-at-startup | 167 (if vm-raise-frame-at-startup |
163 (vm-raise-frame)) | 168 (vm-raise-frame)))) |
164 (vm-display nil nil (list this-command) | |
165 (list (or this-command 'vm) 'startup)))) | |
166 | 169 |
167 ;; say this NOW, before the non-previewers read a message, | 170 ;; say this NOW, before the non-previewers read a message, |
168 ;; alter the new message count and confuse themselves. | 171 ;; alter the new message count and confuse themselves. |
169 (if full-startup | 172 (if full-startup |
170 ;; save blurb so we can repeat it later as necessary. | 173 ;; save blurb so we can repeat it later as necessary. |
171 (setq totals-blurb (vm-emit-totals-blurb))) | 174 (setq totals-blurb (vm-emit-totals-blurb))) |
172 | 175 |
173 (vm-thoughtfully-select-message) | 176 (vm-thoughtfully-select-message) |
174 (if vm-message-list | 177 (vm-update-summary-and-mode-line) |
175 (vm-preview-current-message) | |
176 (vm-update-summary-and-mode-line)) | |
177 ;; need to do this after any frame creation because the | 178 ;; need to do this after any frame creation because the |
178 ;; toolbar sets frame-specific height and width specifiers. | 179 ;; toolbar sets frame-specific height and width specifiers. |
179 (and (vm-toolbar-support-possible-p) vm-use-toolbar | 180 (and (vm-toolbar-support-possible-p) vm-use-toolbar |
180 (progn | 181 (progn |
181 (vm-toolbar-install-toolbar) | 182 (vm-toolbar-install-toolbar) |
193 (not preserve-auto-save-file)) | 194 (not preserve-auto-save-file)) |
194 (vm-summarize t nil)) | 195 (vm-summarize t nil)) |
195 ;; raise the summary frame if the user wants frames | 196 ;; raise the summary frame if the user wants frames |
196 ;; raised and if there is a summary frame. | 197 ;; raised and if there is a summary frame. |
197 (if (and vm-summary-buffer | 198 (if (and vm-summary-buffer |
199 vm-mutable-frames | |
198 vm-frame-per-summary | 200 vm-frame-per-summary |
199 vm-raise-frame-at-startup) | 201 vm-raise-frame-at-startup) |
200 (vm-raise-frame)) | 202 (vm-raise-frame)) |
201 ;; if vm-mutable-windows is nil, the startup | 203 ;; if vm-mutable-windows is nil, the startup |
202 ;; configuration can't be applied, so do | 204 ;; configuration can't be applied, so do |
206 (list (or this-command 'vm) 'startup)) | 208 (list (or this-command 'vm) 'startup)) |
207 (save-excursion | 209 (save-excursion |
208 (switch-to-buffer (or vm-summary-buffer | 210 (switch-to-buffer (or vm-summary-buffer |
209 vm-presentation-buffer | 211 vm-presentation-buffer |
210 (current-buffer))))))) | 212 (current-buffer))))))) |
213 | |
214 (if vm-message-list | |
215 (vm-preview-current-message)) | |
211 | 216 |
212 (run-hooks 'vm-visit-folder-hook) | 217 (run-hooks 'vm-visit-folder-hook) |
213 | 218 |
214 (if full-startup | 219 (if full-startup |
215 (message totals-blurb)) | 220 (message totals-blurb)) |
273 (put 'vm-mode 'mode-class 'special) | 278 (put 'vm-mode 'mode-class 'special) |
274 | 279 |
275 (defun vm-mode (&optional read-only) | 280 (defun vm-mode (&optional read-only) |
276 "Major mode for reading mail. | 281 "Major mode for reading mail. |
277 | 282 |
278 This is VM 6.22. | 283 This is VM 6.34. |
279 | 284 |
280 Commands: | 285 Commands: |
281 h - summarize folder contents | 286 h - summarize folder contents |
282 C-t - toggle threads display | 287 C-t - toggle threads display |
283 | 288 |
438 vm-frame-parameter-alist | 443 vm-frame-parameter-alist |
439 vm-frame-per-completion | 444 vm-frame-per-completion |
440 vm-frame-per-composition | 445 vm-frame-per-composition |
441 vm-frame-per-edit | 446 vm-frame-per-edit |
442 vm-frame-per-folder | 447 vm-frame-per-folder |
448 vm-frame-per-help | |
443 vm-frame-per-summary | 449 vm-frame-per-summary |
444 vm-highlighted-header-face | 450 vm-highlighted-header-face |
445 vm-highlighted-header-regexp | 451 vm-highlighted-header-regexp |
446 vm-honor-page-delimiters | 452 vm-honor-page-delimiters |
447 vm-image-directory | 453 vm-image-directory |
536 vm-summary-redo-hook | 542 vm-summary-redo-hook |
537 vm-summary-show-threads | 543 vm-summary-show-threads |
538 vm-summary-thread-indent-level | 544 vm-summary-thread-indent-level |
539 vm-tale-is-an-idiot | 545 vm-tale-is-an-idiot |
540 vm-temp-file-directory | 546 vm-temp-file-directory |
547 vm-toolbar-pixmap-directory | |
541 vm-trust-From_-with-Content-Length | 548 vm-trust-From_-with-Content-Length |
542 vm-undisplay-buffer-hook | 549 vm-undisplay-buffer-hook |
543 vm-unforwarded-header-regexp | 550 vm-unforwarded-header-regexp |
544 vm-url-browser | 551 vm-url-browser |
545 vm-url-search-limit | 552 vm-url-search-limit |
737 (progn (vm-summarize t nil) | 744 (progn (vm-summarize t nil) |
738 (message blurb))) | 745 (message blurb))) |
739 ;; raise the summary frame if the user wants frames | 746 ;; raise the summary frame if the user wants frames |
740 ;; raised and if there is a summary frame. | 747 ;; raised and if there is a summary frame. |
741 (if (and vm-summary-buffer | 748 (if (and vm-summary-buffer |
749 vm-mutable-frames | |
742 vm-frame-per-summary | 750 vm-frame-per-summary |
743 vm-raise-frame-at-startup) | 751 vm-raise-frame-at-startup) |
744 (vm-raise-frame)) | 752 (vm-raise-frame)) |
745 ;; if vm-mutable-windows is nil, the startup | 753 ;; if vm-mutable-windows is nil, the startup |
746 ;; configuration can't be applied, so do | 754 ;; configuration can't be applied, so do |
795 (other-window 1) | 803 (other-window 1) |
796 (let ((vm-frame-per-folder nil) | 804 (let ((vm-frame-per-folder nil) |
797 (vm-search-other-frames nil)) | 805 (vm-search-other-frames nil)) |
798 (vm-visit-virtual-folder folder-name read-only))) | 806 (vm-visit-virtual-folder folder-name read-only))) |
799 | 807 |
800 (defun vm-mail () | 808 (defun vm-mail (&optional to) |
801 "Send a mail message from within VM, or from without." | 809 "Send a mail message from within VM, or from without. |
810 Optional argument TO is a string that should contain a comma separated | |
811 recipient list." | |
802 (interactive) | 812 (interactive) |
803 (vm-session-initialization) | 813 (vm-session-initialization) |
804 (vm-select-folder-buffer) | 814 (vm-select-folder-buffer) |
805 (vm-check-for-killed-summary) | 815 (vm-check-for-killed-summary) |
806 (vm-mail-internal) | 816 (vm-mail-internal nil to) |
807 (run-hooks 'vm-mail-hook) | 817 (run-hooks 'vm-mail-hook) |
808 (run-hooks 'vm-mail-mode-hook)) | 818 (run-hooks 'vm-mail-mode-hook)) |
809 | 819 |
810 (defun vm-mail-other-frame () | 820 (defun vm-mail-other-frame (&optional to) |
811 "Like vm-mail, but run in a newly created frame." | 821 "Like vm-mail, but run in a newly created frame. |
822 Optional argument TO is a string that should contain a comma separated | |
823 recipient list." | |
812 (interactive) | 824 (interactive) |
813 (vm-session-initialization) | 825 (vm-session-initialization) |
814 (if (vm-multiple-frames-possible-p) | 826 (if (vm-multiple-frames-possible-p) |
815 (vm-goto-new-frame 'composition)) | 827 (vm-goto-new-frame 'composition)) |
816 (let ((vm-frame-per-composition nil) | 828 (let ((vm-frame-per-composition nil) |
817 (vm-search-other-frames nil)) | 829 (vm-search-other-frames nil)) |
818 (vm-mail)) | 830 (vm-mail to)) |
819 (if (vm-multiple-frames-possible-p) | 831 (if (vm-multiple-frames-possible-p) |
820 (vm-set-hooks-for-frame-deletion))) | 832 (vm-set-hooks-for-frame-deletion))) |
821 | 833 |
822 (defun vm-mail-other-window () | 834 (defun vm-mail-other-window (&optional to) |
823 "Like vm-mail, but run in a different window." | 835 "Like vm-mail, but run in a different window. |
836 Optional argument TO is a string that should contain a comma separated | |
837 recipient list." | |
824 (interactive) | 838 (interactive) |
825 (vm-session-initialization) | 839 (vm-session-initialization) |
826 (if (one-window-p t) | 840 (if (one-window-p t) |
827 (split-window)) | 841 (split-window)) |
828 (other-window 1) | 842 (other-window 1) |
829 (let ((vm-frame-per-composition nil) | 843 (let ((vm-frame-per-composition nil) |
830 (vm-search-other-frames nil)) | 844 (vm-search-other-frames nil)) |
831 (vm-mail))) | 845 (vm-mail to))) |
832 | 846 |
833 (defun vm-submit-bug-report () | 847 (defun vm-submit-bug-report () |
834 "Submit a bug report, with pertinent information to the VM bug list." | 848 "Submit a bug report, with pertinent information to the VM bug list." |
835 (interactive) | 849 (interactive) |
836 (require 'reporter) | 850 (require 'reporter) |
884 'vm-frame-parameter-alist | 898 'vm-frame-parameter-alist |
885 'vm-frame-per-completion | 899 'vm-frame-per-completion |
886 'vm-frame-per-composition | 900 'vm-frame-per-composition |
887 'vm-frame-per-edit | 901 'vm-frame-per-edit |
888 'vm-frame-per-folder | 902 'vm-frame-per-folder |
903 'vm-frame-per-help | |
889 'vm-frame-per-summary | 904 'vm-frame-per-summary |
890 'vm-highlight-url-face | 905 'vm-highlight-url-face |
891 'vm-highlighted-header-regexp | 906 'vm-highlighted-header-regexp |
892 'vm-honor-page-delimiters | 907 'vm-honor-page-delimiters |
893 'vm-image-directory | 908 'vm-image-directory |
988 'vm-summary-show-threads | 1003 'vm-summary-show-threads |
989 'vm-summary-thread-indent-level | 1004 'vm-summary-thread-indent-level |
990 'vm-summary-uninteresting-senders | 1005 'vm-summary-uninteresting-senders |
991 'vm-summary-uninteresting-senders-arrow | 1006 'vm-summary-uninteresting-senders-arrow |
992 'vm-tale-is-an-idiot | 1007 'vm-tale-is-an-idiot |
1008 'vm-toolbar-pixmap-directory | |
993 'vm-temp-file-directory | 1009 'vm-temp-file-directory |
994 'vm-trust-From_-with-Content-Length | 1010 'vm-trust-From_-with-Content-Length |
995 'vm-undisplay-buffer-hook | 1011 'vm-undisplay-buffer-hook |
996 'vm-unforwarded-header-regexp | 1012 'vm-unforwarded-header-regexp |
997 'vm-url-browser | 1013 'vm-url-browser |
1008 ;; see what the user had loaded | 1024 ;; see what the user had loaded |
1009 'features | 1025 'features |
1010 ) | 1026 ) |
1011 nil | 1027 nil |
1012 nil | 1028 nil |
1013 "Please change the Subject header to a concise bug description.\nRemember to cover the basics, that is, what you expected to\nhappen and what in fact did happen. Please remove these instructions from your message.") | 1029 "Please change the Subject header to a concise bug description.\nRemember to cover the basics, that is, what you expected to\nhappen and what in fact did happen. Please remove these\ninstructions from your message.") |
1014 (save-excursion | 1030 (save-excursion |
1015 (goto-char (point-min)) | 1031 (goto-char (point-min)) |
1016 (mail-position-on-field "Subject") | 1032 (mail-position-on-field "Subject") |
1017 (beginning-of-line) | 1033 (beginning-of-line) |
1018 (delete-region (point) (progn (forward-line) (point))) | 1034 (delete-region (point) (progn (forward-line) (point))) |
1024 (load vm-init-file (not interactive) (not interactive) t)) | 1040 (load vm-init-file (not interactive) (not interactive) t)) |
1025 (setq vm-init-file-loaded t) | 1041 (setq vm-init-file-loaded t) |
1026 (vm-display nil nil '(vm-load-init-file) '(vm-load-init-file))) | 1042 (vm-display nil nil '(vm-load-init-file) '(vm-load-init-file))) |
1027 | 1043 |
1028 (defun vm-check-emacs-version () | 1044 (defun vm-check-emacs-version () |
1029 (cond ((and (vm-xemacs-p) | 1045 (cond ((and vm-xemacs-p |
1030 (or (< emacs-major-version 19) | 1046 (or (< emacs-major-version 19) |
1031 (and (= emacs-major-version 19) | 1047 (and (= emacs-major-version 19) |
1032 (< emacs-minor-version 14)))) | 1048 (< emacs-minor-version 14)))) |
1033 (error "VM %s must be run on XEmacs 19.14 or a later version." | 1049 (error "VM %s must be run on XEmacs 19.14 or a later version." |
1034 vm-version)) | 1050 vm-version)) |
1035 ((and (vm-fsfemacs-19-p) | 1051 ((and vm-fsfemacs-19-p |
1036 (or (< emacs-major-version 19) | 1052 (or (< emacs-major-version 19) |
1037 (and (= emacs-major-version 19) | 1053 (and (= emacs-major-version 19) |
1038 (< emacs-minor-version 34)))) | 1054 (< emacs-minor-version 34)))) |
1039 (error "VM %s must be run on Emacs 19.34 or a later version." | 1055 (error "VM %s must be run on Emacs 19.34 or a later version." |
1040 vm-version)))) | 1056 vm-version)))) |
1050 void-function | 1066 void-function |
1051 void-variable | 1067 void-variable |
1052 )))) | 1068 )))) |
1053 | 1069 |
1054 (defun vm-session-initialization () | 1070 (defun vm-session-initialization () |
1071 (vm-note-emacs-version) | |
1055 (vm-check-emacs-version) | 1072 (vm-check-emacs-version) |
1056 (vm-set-debug-flags) | 1073 ;; (vm-set-debug-flags) |
1057 ;; If this is the first time VM has been run in this Emacs session, | 1074 ;; If this is the first time VM has been run in this Emacs session, |
1058 ;; do some necessary preparations. | 1075 ;; do some necessary preparations. |
1059 (if (or (not (boundp 'vm-session-beginning)) | 1076 (if (or (not (boundp 'vm-session-beginning)) |
1060 vm-session-beginning) | 1077 vm-session-beginning) |
1061 (progn | 1078 (progn |