Mercurial > hg > xemacs-beta
comparison lisp/vm/vm-folder.el @ 100:4be1180a9e89 r20-1b2
Import from CVS: tag r20-1b2
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:15:11 +0200 |
parents | 0d2f883870bc |
children | a145efe76779 |
comparison
equal
deleted
inserted
replaced
99:2d83cbd90d8d | 100:4be1180a9e89 |
---|---|
304 'vm-folder-type | 304 'vm-folder-type |
305 'vm-virtual-folder-definition | 305 'vm-virtual-folder-definition |
306 'vm-virtual-mirror | 306 'vm-virtual-mirror |
307 'vm-ml-sort-keys | 307 'vm-ml-sort-keys |
308 'vm-ml-labels | 308 'vm-ml-labels |
309 'vm-spooled-mail-waiting | |
309 'vm-message-list) | 310 'vm-message-list) |
310 (set-buffer vm-summary-buffer) | 311 (set-buffer vm-summary-buffer) |
311 (set-buffer-modified-p modified)))) | 312 (set-buffer-modified-p modified)))) |
312 (if vm-presentation-buffer | 313 (if vm-presentation-buffer |
313 (let ((modified (buffer-modified-p))) | 314 (let ((modified (buffer-modified-p))) |
328 'vm-folder-read-only | 329 'vm-folder-read-only |
329 'vm-folder-type | 330 'vm-folder-type |
330 'vm-virtual-folder-definition | 331 'vm-virtual-folder-definition |
331 'vm-virtual-mirror | 332 'vm-virtual-mirror |
332 'vm-ml-labels | 333 'vm-ml-labels |
334 'vm-spooled-mail-waiting | |
333 'vm-message-list) | 335 'vm-message-list) |
334 (set-buffer vm-presentation-buffer) | 336 (set-buffer vm-presentation-buffer) |
335 (set-buffer-modified-p modified)))) | 337 (set-buffer-modified-p modified)))) |
336 (vm-force-mode-line-update)) | 338 (vm-force-mode-line-update)) |
337 | 339 |
504 (set-buffer b) | 506 (set-buffer b) |
505 (setq temp-buffer (generate-new-buffer "*vm-work*")) | 507 (setq temp-buffer (generate-new-buffer "*vm-work*")) |
506 (set-buffer temp-buffer) | 508 (set-buffer temp-buffer) |
507 (if (file-readable-p file) | 509 (if (file-readable-p file) |
508 (condition-case nil | 510 (condition-case nil |
509 (insert-file-contents file nil 0 4096) | 511 (let ((overriding-file-coding-system 'binary)) |
512 (insert-file-contents file nil 0 4096)) | |
510 (wrong-number-of-arguments | 513 (wrong-number-of-arguments |
511 (call-process "sed" file temp-buffer nil | 514 (call-process "sed" file temp-buffer nil |
512 "-n" "1,/^$/p"))))))) | 515 "-n" "1,/^$/p"))))))) |
513 (save-excursion | 516 (save-excursion |
514 (save-restriction | 517 (save-restriction |
2140 (kill-buffer (current-buffer))) | 2143 (kill-buffer (current-buffer))) |
2141 (vm-update-summary-and-mode-line))) | 2144 (vm-update-summary-and-mode-line))) |
2142 | 2145 |
2143 (defun vm-start-itimers-if-needed () | 2146 (defun vm-start-itimers-if-needed () |
2144 (cond ((and (not (natnump vm-flush-interval)) | 2147 (cond ((and (not (natnump vm-flush-interval)) |
2145 (not (natnump vm-auto-get-new-mail)))) | 2148 (not (natnump vm-auto-get-new-mail)) |
2149 (not (natnump vm-mail-check-interval)))) | |
2146 ((condition-case data | 2150 ((condition-case data |
2147 (progn (require 'itimer) t) | 2151 (progn (require 'itimer) t) |
2148 (error nil)) | 2152 (error nil)) |
2149 (and (natnump vm-flush-interval) (not (get-itimer "vm-flush")) | 2153 (and (natnump vm-flush-interval) (not (get-itimer "vm-flush")) |
2150 (start-itimer "vm-flush" 'vm-flush-itimer-function | 2154 (start-itimer "vm-flush" 'vm-flush-itimer-function |
2151 vm-flush-interval nil)) | 2155 vm-flush-interval nil)) |
2152 (and (natnump vm-auto-get-new-mail) (not (get-itimer "vm-get-mail")) | 2156 (and (natnump vm-auto-get-new-mail) (not (get-itimer "vm-get-mail")) |
2153 (start-itimer "vm-get-mail" 'vm-get-mail-itimer-function | 2157 (start-itimer "vm-get-mail" 'vm-get-mail-itimer-function |
2154 vm-auto-get-new-mail nil))) | 2158 vm-auto-get-new-mail nil)) |
2159 (and (natnump vm-mail-check-interval) | |
2160 (not (get-itimer "vm-check-mail")) | |
2161 (start-itimer "vm-check-mail" 'vm-check-mail-itimer-function | |
2162 vm-mail-check-interval nil))) | |
2155 ((condition-case data | 2163 ((condition-case data |
2156 (progn (require 'timer) t) | 2164 (progn (require 'timer) t) |
2157 (error nil)) | 2165 (error nil)) |
2158 (let (timer) | 2166 (let (timer) |
2159 (and (natnump vm-flush-interval) | 2167 (and (natnump vm-flush-interval) |
2160 (setq timer (run-at-time vm-flush-interval vm-flush-interval | 2168 (setq timer (run-at-time vm-flush-interval vm-flush-interval |
2161 'vm-flush-itimer-function nil)) | 2169 'vm-flush-itimer-function nil)) |
2162 (timer-set-function timer 'vm-flush-itimer-function | 2170 (timer-set-function timer 'vm-flush-itimer-function |
2171 (list timer))) | |
2172 (and (natnump vm-mail-check-interval) | |
2173 (setq timer (run-at-time vm-mail-check-interval | |
2174 vm-mail-check-interval | |
2175 'vm-check-mail-itimer-function nil)) | |
2176 (timer-set-function timer 'vm-check-mail-itimer-function | |
2163 (list timer))) | 2177 (list timer))) |
2164 (and (natnump vm-auto-get-new-mail) | 2178 (and (natnump vm-auto-get-new-mail) |
2165 (setq timer (run-at-time vm-auto-get-new-mail | 2179 (setq timer (run-at-time vm-auto-get-new-mail |
2166 vm-auto-get-new-mail | 2180 vm-auto-get-new-mail |
2167 'vm-get-mail-itimer-function nil)) | 2181 'vm-get-mail-itimer-function nil)) |
2169 (list timer))))) | 2183 (list timer))))) |
2170 (t | 2184 (t |
2171 (setq vm-flush-interval t | 2185 (setq vm-flush-interval t |
2172 vm-auto-get-new-mail t)))) | 2186 vm-auto-get-new-mail t)))) |
2173 | 2187 |
2188 ;; support for vm-mail-check-interval | |
2189 ;; if timer argument is present, this means we're using the Emacs | |
2190 ;; 'timer package rather than the 'itimer package. | |
2191 (defun vm-check-mail-itimer-function (&optional timer) | |
2192 ;; FSF Emacs sets this non-nil, which means the user can't | |
2193 ;; interrupt the check. Bogus. | |
2194 (setq inhibit-quit nil) | |
2195 (if (integerp vm-mail-check-interval) | |
2196 (if timer | |
2197 (timer-set-time timer (current-time) vm-mail-check-interval) | |
2198 (set-itimer-restart current-itimer vm-mail-check-interval))) | |
2199 (let ((b-list (buffer-list)) | |
2200 oldval) | |
2201 (while (and (not (input-pending-p)) b-list) | |
2202 (save-excursion | |
2203 (set-buffer (car b-list)) | |
2204 (if (and (eq major-mode 'vm-mode) | |
2205 (not vm-block-new-mail)) | |
2206 (progn | |
2207 (setq oldval vm-spooled-mail-waiting) | |
2208 (vm-check-for-spooled-mail nil) | |
2209 (if (not (eq oldval vm-spooled-mail-waiting)) | |
2210 (progn | |
2211 (intern (buffer-name) vm-buffers-needing-display-update) | |
2212 (vm-update-summary-and-mode-line)))))) | |
2213 (setq b-list (cdr b-list))))) | |
2214 | |
2174 ;; support for numeric vm-auto-get-new-mail | 2215 ;; support for numeric vm-auto-get-new-mail |
2175 ;; if timer argument is present, this means we're using the Emacs | 2216 ;; if timer argument is present, this means we're using the Emacs |
2176 ;; 'timer package rather than the 'itimer package. | 2217 ;; 'timer package rather than the 'itimer package. |
2177 (defun vm-get-mail-itimer-function (&optional timer) | 2218 (defun vm-get-mail-itimer-function (&optional timer) |
2219 ;; FSF Emacs sets this non-nil, which means the user can't | |
2220 ;; interrupt mail retrieval. Bogus. | |
2221 (setq inhibit-quit nil) | |
2178 (if (integerp vm-auto-get-new-mail) | 2222 (if (integerp vm-auto-get-new-mail) |
2179 (if timer | 2223 (if timer |
2180 (timer-set-time timer (current-time) vm-auto-get-new-mail) | 2224 (timer-set-time timer (current-time) vm-auto-get-new-mail) |
2181 (set-itimer-restart current-itimer vm-auto-get-new-mail))) | 2225 (set-itimer-restart current-itimer vm-auto-get-new-mail))) |
2182 (let ((b-list (buffer-list))) | 2226 (let ((b-list (buffer-list))) |
2189 (file-newer-than-file-p | 2233 (file-newer-than-file-p |
2190 (make-auto-save-file-name) | 2234 (make-auto-save-file-name) |
2191 buffer-file-name))) | 2235 buffer-file-name))) |
2192 (not vm-block-new-mail) | 2236 (not vm-block-new-mail) |
2193 (not vm-folder-read-only) | 2237 (not vm-folder-read-only) |
2194 (vm-get-spooled-mail) | 2238 (vm-get-spooled-mail nil) |
2195 (vm-assimilate-new-messages t)) | 2239 (vm-assimilate-new-messages t)) |
2196 (progn | 2240 (progn |
2197 ;; don't move the message pointer unless the folder | 2241 ;; don't move the message pointer unless the folder |
2198 ;; was empty. | 2242 ;; was empty. |
2199 (if (and (null vm-message-pointer) | 2243 (if (and (null vm-message-pointer) |
2467 (setq crash-buf | 2511 (setq crash-buf |
2468 ;; crash box could contain a letter bomb... | 2512 ;; crash box could contain a letter bomb... |
2469 ;; force user notification of file variables for v18 Emacses | 2513 ;; force user notification of file variables for v18 Emacses |
2470 ;; enable-local-variables == nil disables them for newer Emacses | 2514 ;; enable-local-variables == nil disables them for newer Emacses |
2471 (let ((inhibit-local-variables t) | 2515 (let ((inhibit-local-variables t) |
2472 (enable-local-variables nil)) | 2516 (enable-local-variables nil) |
2517 (overriding-file-coding-system 'no-conversion)) | |
2473 (find-file-noselect crash-box))) | 2518 (find-file-noselect crash-box))) |
2474 (save-excursion | 2519 (save-excursion |
2475 (set-buffer crash-buf) | 2520 (set-buffer crash-buf) |
2476 (setq crash-folder-type (vm-get-folder-type)) | 2521 (setq crash-folder-type (vm-get-folder-type)) |
2477 (if (and crash-folder-type vm-check-folder-types) | 2522 (if (and crash-folder-type vm-check-folder-types) |
2518 (insert-buffer-substring crash-buf | 2563 (insert-buffer-substring crash-buf |
2519 1 (1+ (save-excursion | 2564 1 (1+ (save-excursion |
2520 (set-buffer crash-buf) | 2565 (set-buffer crash-buf) |
2521 (widen) | 2566 (widen) |
2522 (buffer-size)))) | 2567 (buffer-size)))) |
2523 (write-region opoint-max (point-max) buffer-file-name t t) | |
2524 (vm-increment vm-modification-counter) | |
2525 (setq got-mail (/= opoint-max (point-max))) | 2568 (setq got-mail (/= opoint-max (point-max))) |
2526 (set-buffer-modified-p old-buffer-modified-p) | 2569 (if (not got-mail) |
2527 (kill-buffer crash-buf) | 2570 nil |
2528 (if (not (stringp vm-keep-crash-boxes)) | 2571 (write-region opoint-max (point-max) buffer-file-name t t) |
2529 (vm-error-free-call 'delete-file crash-box) | 2572 (vm-increment vm-modification-counter) |
2530 (rename-file crash-box | 2573 (set-buffer-modified-p old-buffer-modified-p) |
2531 (concat (expand-file-name vm-keep-crash-boxes) | 2574 (kill-buffer crash-buf) |
2532 (if (not | 2575 (if (not (stringp vm-keep-crash-boxes)) |
2533 (= (aref vm-keep-crash-boxes | 2576 (vm-error-free-call 'delete-file crash-box) |
2534 (1- (length vm-keep-crash-boxes))) | 2577 (let (name) |
2535 ?/)) | 2578 (setq name (expand-file-name (format "Z%d" (vm-abs (random))) |
2536 "/" | 2579 vm-keep-crash-boxes)) |
2537 "") | 2580 (while (file-exists-p name) |
2538 "Z" | 2581 (setq name (expand-file-name (format "Z%d" (vm-abs (random))) |
2539 (substring | 2582 vm-keep-crash-boxes))) |
2540 (timezone-make-date-sortable | 2583 (rename-file crash-box name)))) |
2541 (current-time-string)) | |
2542 4))) | |
2543 ;; guarantee that each new saved crashbox will have a | |
2544 ;; different name, assuming time doesn't reverse. | |
2545 (sleep-for 1)) | |
2546 got-mail )))) | 2584 got-mail )))) |
2547 | 2585 |
2548 (defun vm-get-spooled-mail () | 2586 (defun vm-compute-spool-files () |
2549 (if vm-block-new-mail | 2587 (let ((fallback-triples nil) |
2550 (error "Can't get new mail until you save this folder.")) | 2588 triples) |
2551 (let ((triples nil) | |
2552 ;; since we could accept-process-output here (POP code), | |
2553 ;; a timer process might try to start retrieving mail | |
2554 ;; before we finish. block these attempts. | |
2555 (vm-block-new-mail t) | |
2556 (fallback-triples nil) | |
2557 crash in maildrop popdrop | |
2558 (got-mail nil)) | |
2559 (cond ((and buffer-file-name | 2589 (cond ((and buffer-file-name |
2560 (consp vm-spool-file-suffixes) | 2590 (consp vm-spool-file-suffixes) |
2561 (stringp vm-crash-box-suffix)) | 2591 (stringp vm-crash-box-suffix)) |
2562 (setq fallback-triples | 2592 (setq fallback-triples |
2563 (mapcar (function | 2593 (mapcar (function |
2568 vm-crash-box-suffix)))) | 2598 vm-crash-box-suffix)))) |
2569 vm-spool-file-suffixes)))) | 2599 vm-spool-file-suffixes)))) |
2570 (cond ((and buffer-file-name | 2600 (cond ((and buffer-file-name |
2571 vm-make-spool-file-name vm-make-crash-box-name) | 2601 vm-make-spool-file-name vm-make-crash-box-name) |
2572 (setq fallback-triples | 2602 (setq fallback-triples |
2573 (ncons fallback-triples | 2603 (nconc fallback-triples |
2574 (list (list buffer-file-name | 2604 (list (list buffer-file-name |
2575 (save-excursion | 2605 (save-excursion |
2576 (funcall vm-make-spool-file-name | 2606 (funcall vm-make-spool-file-name |
2577 buffer-file-name)) | 2607 buffer-file-name)) |
2578 (save-excursion | 2608 (save-excursion |
2589 (lambda (s) (list vm-primary-inbox s vm-crash-box))) | 2619 (lambda (s) (list vm-primary-inbox s vm-crash-box))) |
2590 (vm-spool-files)))) | 2620 (vm-spool-files)))) |
2591 ((consp (car (vm-spool-files))) | 2621 ((consp (car (vm-spool-files))) |
2592 (setq triples (vm-spool-files)))) | 2622 (setq triples (vm-spool-files)))) |
2593 (setq triples (append triples fallback-triples)) | 2623 (setq triples (append triples fallback-triples)) |
2624 triples )) | |
2625 | |
2626 (defun vm-spool-check-mail (source) | |
2627 (let ((handler (and (fboundp 'find-file-name-handler) | |
2628 (condition-case () | |
2629 (find-file-name-handler source 'vm-spool-check-mail) | |
2630 (wrong-number-of-arguments | |
2631 (find-file-name-handler source)))))) | |
2632 (if handler | |
2633 (funcall handler 'vm-spool-check-mail source) | |
2634 (and (not (equal 0 (nth 7 (file-attributes source)))) | |
2635 (file-readable-p source))))) | |
2636 | |
2637 (defun vm-check-for-spooled-mail (&optional interactive) | |
2638 (if vm-block-new-mail | |
2639 nil | |
2640 (let ((triples (vm-compute-spool-files)) | |
2641 ;; since we could accept-process-output here (POP code), | |
2642 ;; a timer process might try to start retrieving mail | |
2643 ;; before we finish. block these attempts. | |
2644 (vm-block-new-mail t) | |
2645 (vm-pop-ok-to-ask interactive) | |
2646 (done nil) | |
2647 crash in maildrop popdrop | |
2648 (mail-waiting nil)) | |
2649 (while (and triples (not done)) | |
2650 (setq in (expand-file-name (nth 0 (car triples)) vm-folder-directory) | |
2651 maildrop (nth 1 (car triples)) | |
2652 crash (nth 2 (car triples))) | |
2653 (if (eq (current-buffer) (vm-get-file-buffer in)) | |
2654 (progn | |
2655 (if (file-exists-p crash) | |
2656 (progn | |
2657 (setq mail-waiting t | |
2658 done t)) | |
2659 (setq popdrop (and vm-recognize-pop-maildrops | |
2660 (string-match vm-recognize-pop-maildrops | |
2661 maildrop))) | |
2662 (if (not interactive) | |
2663 ;; allow no error to be signaled | |
2664 (condition-case nil | |
2665 (setq mail-waiting | |
2666 (or mail-waiting | |
2667 (if popdrop | |
2668 (vm-pop-check-mail maildrop) | |
2669 (vm-spool-check-mail maildrop)))) | |
2670 (error nil)) | |
2671 (setq mail-waiting (or mail-waiting | |
2672 (if popdrop | |
2673 (vm-pop-check-mail maildrop) | |
2674 (vm-spool-check-mail maildrop))))) | |
2675 (if mail-waiting | |
2676 (setq done t))))) | |
2677 (setq triples (cdr triples))) | |
2678 (setq vm-spooled-mail-waiting mail-waiting) | |
2679 mail-waiting ))) | |
2680 | |
2681 (defun vm-get-spooled-mail (&optional interactive) | |
2682 (if vm-block-new-mail | |
2683 (error "Can't get new mail until you save this folder.")) | |
2684 (let ((triples (vm-compute-spool-files)) | |
2685 ;; since we could accept-process-output here (POP code), | |
2686 ;; a timer process might try to start retrieving mail | |
2687 ;; before we finish. block these attempts. | |
2688 (vm-block-new-mail t) | |
2689 (vm-pop-ok-to-ask interactive) | |
2690 crash in maildrop popdrop | |
2691 (got-mail nil)) | |
2594 (while triples | 2692 (while triples |
2595 (setq in (expand-file-name (nth 0 (car triples)) vm-folder-directory) | 2693 (setq in (expand-file-name (nth 0 (car triples)) vm-folder-directory) |
2596 maildrop (nth 1 (car triples)) | 2694 maildrop (nth 1 (car triples)) |
2597 crash (nth 2 (car triples))) | 2695 crash (nth 2 (car triples))) |
2598 (if (eq (current-buffer) (vm-get-file-buffer in)) | 2696 (if (eq (current-buffer) (vm-get-file-buffer in)) |
2599 (progn | 2697 (let (retrieval-function) |
2600 (if (file-exists-p crash) | 2698 (if (file-exists-p crash) |
2601 (progn | 2699 (progn |
2602 (message "Recovering messages from %s..." crash) | 2700 (message "Recovering messages from %s..." crash) |
2603 (setq got-mail (or (vm-gobble-crash-box crash) got-mail)) | 2701 (setq got-mail (or (vm-gobble-crash-box crash) got-mail)) |
2604 (message "Recovering messages from %s... done" crash))) | 2702 (message "Recovering messages from %s... done" crash))) |
2611 (and (not (equal 0 (nth 7 (file-attributes maildrop)))) | 2709 (and (not (equal 0 (nth 7 (file-attributes maildrop)))) |
2612 (file-readable-p maildrop))) | 2710 (file-readable-p maildrop))) |
2613 (progn | 2711 (progn |
2614 (setq crash (expand-file-name crash vm-folder-directory)) | 2712 (setq crash (expand-file-name crash vm-folder-directory)) |
2615 (if (not popdrop) | 2713 (if (not popdrop) |
2616 (setq maildrop (expand-file-name maildrop))) | 2714 (setq maildrop (expand-file-name maildrop) |
2617 (if (if popdrop | 2715 retrieval-function 'vm-spool-move-mail) |
2618 (vm-pop-move-mail maildrop crash) | 2716 (setq retrieval-function 'vm-pop-move-mail)) |
2619 (vm-spool-move-mail maildrop crash)) | 2717 (if (if got-mail |
2718 ;; don't allow errors to be signaled unless no | |
2719 ;; mail has been appended to the incore | |
2720 ;; copy of the folder. otherwise the | |
2721 ;; user will wonder where the mail is, | |
2722 ;; since it is not in the crash box or | |
2723 ;; the spool file and doesn't _appear_ to | |
2724 ;; be in the folder either. | |
2725 (condition-case error-data | |
2726 (funcall retrieval-function maildrop crash) | |
2727 (error (message "%s signaled: %s" | |
2728 (if popdrop | |
2729 'vm-pop-move-mail | |
2730 'vm-spool-move-mail) | |
2731 error-data) | |
2732 (sleep-for 2) | |
2733 ;; we don't know if mail was | |
2734 ;; put into the crash box or | |
2735 ;; not, so return t just to be | |
2736 ;; safe. | |
2737 t )) | |
2738 (funcall retrieval-function maildrop crash)) | |
2620 (if (vm-gobble-crash-box crash) | 2739 (if (vm-gobble-crash-box crash) |
2621 (progn | 2740 (progn |
2622 (setq got-mail t) | 2741 (setq got-mail t) |
2623 (message "Got mail from %s." | 2742 (message "Got mail from %s." |
2624 (or popdrop maildrop))))))))) | 2743 (or popdrop maildrop))))))))) |
2625 (setq triples (cdr triples))) | 2744 (setq triples (cdr triples))) |
2745 ;; not really correct, but it is what the user expects to see. | |
2746 (if got-mail | |
2747 (setq vm-spooled-mail-waiting nil)) | |
2748 (intern (buffer-name) vm-buffers-needing-display-update) | |
2749 (vm-update-summary-and-mode-line) | |
2626 (if got-mail | 2750 (if got-mail |
2627 (run-hooks 'vm-retrieved-spooled-mail-hook)) | 2751 (run-hooks 'vm-retrieved-spooled-mail-hook)) |
2628 got-mail )) | 2752 got-mail )) |
2629 | 2753 |
2630 (defun vm-safe-popdrop-string (drop) | 2754 (defun vm-safe-popdrop-string (drop) |
2660 (if (consp (car (vm-spool-files))) | 2784 (if (consp (car (vm-spool-files))) |
2661 (vm-unsaved-message "Checking for new mail for %s..." | 2785 (vm-unsaved-message "Checking for new mail for %s..." |
2662 (or buffer-file-name (buffer-name))) | 2786 (or buffer-file-name (buffer-name))) |
2663 (vm-unsaved-message "Checking for new mail...")) | 2787 (vm-unsaved-message "Checking for new mail...")) |
2664 (let (totals-blurb) | 2788 (let (totals-blurb) |
2665 (if (and (vm-get-spooled-mail) (vm-assimilate-new-messages t)) | 2789 (if (and (vm-get-spooled-mail t) (vm-assimilate-new-messages t)) |
2666 (progn | 2790 (progn |
2667 ;; say this NOW, before the non-previewers read | 2791 ;; say this NOW, before the non-previewers read |
2668 ;; a message, alter the new message count and | 2792 ;; a message, alter the new message count and |
2669 ;; confuse themselves. | 2793 ;; confuse themselves. |
2670 (setq totals-blurb (vm-emit-totals-blurb)) | 2794 (setq totals-blurb (vm-emit-totals-blurb)) |
2689 folder)) | 2813 folder)) |
2690 (save-excursion | 2814 (save-excursion |
2691 (vm-save-restriction | 2815 (vm-save-restriction |
2692 (widen) | 2816 (widen) |
2693 (goto-char (point-max)) | 2817 (goto-char (point-max)) |
2694 (insert-file-contents folder))) | 2818 (let ((overriding-file-coding-system 'binary)) |
2819 (insert-file-contents folder)))) | |
2695 (setq mcount (length vm-message-list)) | 2820 (setq mcount (length vm-message-list)) |
2696 (if (vm-assimilate-new-messages) | 2821 (if (vm-assimilate-new-messages) |
2697 (progn | 2822 (progn |
2698 ;; say this NOW, before the non-previewers read | 2823 ;; say this NOW, before the non-previewers read |
2699 ;; a message, alter the new message count and | 2824 ;; a message, alter the new message count and |
2880 (message "Folder is now %s" | 3005 (message "Folder is now %s" |
2881 (if vm-folder-read-only "read-only" "modifiable")) | 3006 (if vm-folder-read-only "read-only" "modifiable")) |
2882 (vm-display nil nil '(vm-toggle-read-only) '(vm-toggle-read-only)) | 3007 (vm-display nil nil '(vm-toggle-read-only) '(vm-toggle-read-only)) |
2883 (vm-update-summary-and-mode-line)) | 3008 (vm-update-summary-and-mode-line)) |
2884 | 3009 |
3010 (defvar scroll-in-place) | |
3011 | |
2885 ;; this does the real major mode scutwork. | 3012 ;; this does the real major mode scutwork. |
2886 (defun vm-mode-internal () | 3013 (defun vm-mode-internal () |
2887 (widen) | 3014 (widen) |
2888 (make-local-variable 'require-final-newline) | 3015 (make-local-variable 'require-final-newline) |
2889 ;; don't kill local variables, as there is some state we'd like to | 3016 ;; don't kill local variables, as there is some state we'd like to |
2925 (and (vm-menu-support-possible-p) | 3052 (and (vm-menu-support-possible-p) |
2926 (vm-menu-install-menus)) | 3053 (vm-menu-install-menus)) |
2927 (add-hook 'kill-buffer-hook 'vm-garbage-collect-folder) | 3054 (add-hook 'kill-buffer-hook 'vm-garbage-collect-folder) |
2928 (add-hook 'kill-buffer-hook 'vm-garbage-collect-message) | 3055 (add-hook 'kill-buffer-hook 'vm-garbage-collect-message) |
2929 ;; avoid the XEmacs file dialog box. | 3056 ;; avoid the XEmacs file dialog box. |
2930 (defvar should-use-dialog-box) | 3057 (defvar use-dialog-box) |
2931 (make-local-variable 'should-use-dialog-box) | 3058 (make-local-variable 'use-dialog-box) |
2932 (setq should-use-dialog-box nil) | 3059 (setq use-dialog-box nil) |
2933 ;; mail folders are precious. protect them by default. | 3060 ;; mail folders are precious. protect them by default. |
2934 (make-local-variable 'file-precious-flag) | 3061 (make-local-variable 'file-precious-flag) |
2935 (setq file-precious-flag t) | 3062 (setq file-precious-flag t) |
3063 ;; scroll in place messes with scroll-up and this loses | |
3064 (make-local-variable 'scroll-in-place) | |
3065 (setq scroll-in-place nil) | |
2936 (run-hooks 'vm-mode-hook) | 3066 (run-hooks 'vm-mode-hook) |
2937 ;; compatibility | 3067 ;; compatibility |
2938 (run-hooks 'vm-mode-hooks)) | 3068 (run-hooks 'vm-mode-hooks)) |
2939 | 3069 |
2940 (defun vm-link-to-virtual-buffers () | 3070 (defun vm-link-to-virtual-buffers () |