47
47
;; against letter bombs.
48
48
;; set enable-local-variables to nil for newer Emacses
50
;; deduce the access method if none specified
51
(if (null access-method)
52
(let ((f (or folder vm-primary-inbox)))
53
(cond ((and vm-recognize-imap-maildrops
54
;; f could be a buffer
56
(string-match vm-recognize-imap-maildrops f))
57
(setq access-method 'imap
59
((and vm-recognize-pop-maildrops
60
;; f could be a buffer
62
(string-match vm-recognize-pop-maildrops f))
63
(setq access-method 'pop
50
65
(let ((full-startup (not (bufferp folder)))
51
66
(did-read-index-file nil)
52
67
folder-buffer first-time totals-blurb
56
71
(setq remote-spec (vm-pop-find-spec-for-name folder))
57
72
(if (null remote-spec)
58
73
(error "No such POP folder: %s" folder))
59
(setq folder-name folder
60
folder (vm-pop-make-filename-for-spec remote-spec))))
74
(setq folder-name folder)
75
;; Prior to VM 7.11, we computed the cache filename
76
;; based on the full POP spec including the password
77
;; if it was in the spec. This meant that every
78
;; time the user changed his password, we'd start
79
;; visiting the wrong (and probably nonexistent)
82
;; To fix this we do two things. First, migrate the
83
;; user's caches to the filenames based in the POP
84
;; sepc without the password. Second, we visit the
85
;; old password based filename if it still exists
86
;; after trying to migrate it.
88
;; For VM 7.16 we apply the same logic to the access
89
;; methods, pop, pop-ssh and pop-ssl and to
90
;; authentication method and service port, which can
91
;; also change and lead us to visit a nonexistent
92
;; cache file. The assumption is that these
93
;; properties of the connection can change and we'll
94
;; still be accessing the same mailbox on the
96
(let ((f-pass (vm-pop-make-filename-for-spec remote-spec))
97
(f-nopass (vm-pop-make-filename-for-spec remote-spec t))
98
(f-nospec (vm-pop-make-filename-for-spec remote-spec t t)))
99
(cond ((or (string= f-pass f-nospec)
100
(file-exists-p f-nospec))
102
((file-exists-p f-pass)
105
(rename-file f-pass f-nospec)
107
((file-exists-p f-nopass)
110
(rename-file f-nopass f-nospec)
112
;; choose the one that exists, password version,
113
;; nopass version and finally nopass+nospec
115
(cond ((file-exists-p f-pass)
116
(setq folder f-pass))
117
((file-exists-p f-nopass)
118
(setq folder f-nopass))
120
(setq folder f-nospec)))))
121
((eq access-method 'imap)
122
(setq remote-spec folder
123
folder-name (or (nth 3 (vm-imap-parse-spec-to-list
126
folder (vm-imap-make-filename-for-spec remote-spec))))
61
127
(setq folder-buffer
62
128
(if (bufferp folder)
184
250
(vm-fsfemacs-nonmule-display-8bit-chars)
185
251
(vm-mode-internal access-method)
186
252
(cond ((eq access-method 'pop)
187
(vm-set-folder-pop-maildrop-spec remote-spec)))
253
(vm-set-folder-pop-maildrop-spec remote-spec))
254
((eq access-method 'imap)
255
(vm-set-folder-imap-maildrop-spec remote-spec)))
188
256
;; If the buffer is modified we don't know if the
189
257
;; folder format has been changed to be different
190
258
;; from index file, so don't read the index file in
448
515
that match those selectors.
449
516
M ? - partial help for mark commands
451
W S - save the current window configuration to a name
452
W D - delete a window configuration
453
W W - apply a configuration
454
W ? - help for the window configuration commands
518
W - prefix for window configuration commands:
519
W S - save the current window configuration to a name
520
W D - delete a window configuration
521
W W - apply a configuration
522
W ? - help for the window configuration commands
456
V V - visit a virtual folder (must be defined in vm-virtual-folder-alist)
457
V C - create a virtual folder composed of a subset of the
458
current folder's messages.
459
V A - create a virtual folder containing all the messages in the current
460
folder with the same author as the current message.
461
V S - create a virtual folder containing all the messages in the current
462
folder with the same subject as the current message.
463
V X - apply the selectors of a named virtual folder to the
464
messages in the current folder and create a virtual folder
465
containing the selected messages.
466
V M - toggle whether this virtual folder's messages mirror the
467
underlying real messages' attributes.
468
V ? - help for virtual folder commands
524
V - prefix for virtual folder commands:
525
V V - visit a virtual folder (folder must be defined in
526
vm-virtual-folder-alist)
527
V C - create a virtual folder composed of a subset of
528
the current folder's messages.
529
V A - create a virtual folder containing all the messages in
530
the current folder with the same author as the current message.
531
V S - create a virtual folder containing all the messages in
532
the current folder with the same subject as the current message.
533
V X - apply the selectors of a named virtual folder to the messages in
534
the current folder and create a virtual folder
535
containing the selected messages.
536
V M - toggle whether this virtual folder's messages mirror the
537
underlying real messages' attributes.
538
V ? - help for virtual folder commands
470
540
C-_ - undo, special undo that retracts the most recent
471
541
changes in message attributes and labels. Expunges,
475
545
a - set message attributes
477
l a - add labels to message
478
l d - delete labels from message
547
l - prefix for label commands:
548
l a - add labels to message
549
l d - delete labels from message
480
551
$ - prefix for MIME commands. Position the cursor over a MIME
481
552
tag and use these keystrokes to operate on a MIME object.
483
$ s - save the MIME object
484
$ p - print the MIME object
485
$ | - pipe the MIME object to a shell command.
554
RET - display the MIME object according to its type.
555
$ s - save the MIME object
556
$ p - print the MIME object
557
$ | - pipe the MIME object to a shell command.
486
558
$ RET - display the MIME object's text using the \"default\" face.
487
$ e - display the MIME object with an external viewer.
488
$ d - delete the MIME object from the message.
559
$ e - display the MIME object with an external viewer.
560
$ d - delete the MIME object from the message.
561
$ v - display the MIME object as some other type.
562
$ w - write the MIME object to a file.
563
$ a - attach the MIME object to a composition buffer.
490
565
L - reload your VM init file, ~/.vm
931
1023
(vm-search-other-frames nil))
932
1024
(vm-visit-pop-folder folder read-only)))
1027
(defun vm-visit-imap-folder (folder &optional read-only)
1028
"Visit a IMAP mailbox.
1029
VM will present its messages to you in the usual way. Messages
1030
found in the IMAP mailbox will be downloaded and stored in a local
1031
cache. If you expunge messages from the cache, the corresponding
1032
messages will be expunged from the IMAP mailbox.
1034
First arg FOLDER specifies the IMAP mailbox to visit. You can only
1035
visit mailboxes on servers that are listed in `vm-imap-server-list'.
1036
When this command is called interactively the server and mailbox
1037
names are read from the minibuffer.
1039
Prefix arg or optional second arg READ-ONLY non-nil indicates
1040
that the folder should be considered read only. No attribute
1041
changes, messages additions or deletions will be allowed in the
1045
(vm-session-initialization)
1046
(vm-check-for-killed-folder)
1047
(vm-select-folder-buffer-if-possible)
1048
(let ((this-command this-command)
1049
(last-command last-command))
1050
(list (vm-read-imap-folder-name
1051
(format "Visit%s IMAP folder: "
1052
(if current-prefix-arg " read only" ""))
1053
vm-imap-server-list t)
1054
current-prefix-arg))))
1055
(vm-session-initialization)
1056
(vm-check-for-killed-folder)
1057
(vm-select-folder-buffer-if-possible)
1058
(vm-check-for-killed-summary)
1059
(vm folder read-only 'imap))
1062
(defun vm-visit-imap-folder-other-frame (folder &optional read-only)
1063
"Like vm-visit-imap-folder, but run in a newly created frame."
1066
(vm-session-initialization)
1067
(vm-check-for-killed-folder)
1068
(vm-select-folder-buffer-if-possible)
1069
(let ((this-command this-command)
1070
(last-command last-command))
1071
(list (vm-read-imap-folder-name
1072
(format "Visit%s IMAP folder: "
1073
(if current-prefix-arg " read only" ""))
1074
vm-imap-server-list)
1075
current-prefix-arg))))
1076
(vm-session-initialization)
1077
(if (vm-multiple-frames-possible-p)
1078
(vm-goto-new-frame 'folder))
1079
(let ((vm-frame-per-folder nil)
1080
(vm-search-other-frames nil))
1081
(vm-visit-imap-folder folder read-only))
1082
(if (vm-multiple-frames-possible-p)
1083
(vm-set-hooks-for-frame-deletion)))
1086
(defun vm-visit-imap-folder-other-window (folder &optional read-only)
1087
"Like vm-visit-imap-folder, but run in a different window."
1090
(vm-session-initialization)
1091
(vm-check-for-killed-folder)
1092
(vm-select-folder-buffer-if-possible)
1093
(let ((this-command this-command)
1094
(last-command last-command))
1095
(list (vm-read-imap-folder-name
1096
(format "Visit%s IMAP folder: "
1097
(if current-prefix-arg " read only" ""))
1098
vm-imap-server-list)
1099
current-prefix-arg))))
1100
(vm-session-initialization)
1101
(if (one-window-p t)
1104
(let ((vm-frame-per-folder nil)
1105
(vm-search-other-frames nil))
1106
(vm-visit-imap-folder folder read-only)))
934
1108
(put 'vm-virtual-mode 'mode-class 'special)
936
1110
(defun vm-virtual-mode (&rest ignored)
997
1171
(setq major-mode 'vm-virtual-mode)
998
1172
(run-hooks 'vm-virtual-mode-hook)
999
1173
;; must come after the setting of major-mode
1000
(setq mode-popup-menu (and vm-use-menus vm-popup-menu-on-mouse-3
1174
(setq mode-popup-menu (and vm-use-menus
1001
1175
(vm-menu-support-possible-p)
1002
1176
(vm-menu-mode-menu)))
1003
1177
(setq blurb (vm-emit-totals-blurb))
1004
1178
(if vm-summary-show-threads
1005
1179
(vm-sort-messages "thread"))
1006
(if (vm-thoughtfully-select-message)
1007
(vm-preview-current-message)
1008
(vm-update-summary-and-mode-line))
1181
(let ((mp vm-message-list))
1183
(if (eq bookmark (vm-real-message-of (car mp)))
1185
(vm-record-and-change-message-pointer
1186
vm-message-pointer mp)
1187
(vm-preview-current-message)
1189
(setq mp (cdr mp))))))
1190
(if (null vm-message-pointer)
1191
(if (vm-thoughtfully-select-message)
1192
(vm-preview-current-message)
1193
(vm-update-summary-and-mode-line)))
1009
1194
(message blurb)))
1010
1195
;; make a new frame if the user wants one. reuse an
1011
1196
;; existing frame that is showing this folder.
1588
1791
;; names may not be valid.
1589
1792
(set-face-foreground 'gui-button-face "white")
1590
1793
(set-face-background 'gui-button-face "red")))))
1794
;; gui-button-face might not exist under XEmacs either.
1795
;; This can happen if XEmacs is built without window
1796
;; system support. In any case, create it anyway.
1797
(if (and vm-xemacs-p (not (find-face 'gui-button-face)))
1799
(make-face 'gui-button-face)
1800
(set-face-foreground 'gui-button-face "black" nil '(win))
1801
(set-face-background 'gui-button-face "gray75" nil '(win))
1802
(set-face-foreground 'gui-button-face "white" nil '(tty))
1803
(set-face-background 'gui-button-face "red" nil '(tty))))
1591
1804
(and (vm-mouse-support-possible-p)
1592
1805
(vm-mouse-install-mouse))
1593
1806
(and (vm-menu-support-possible-p)