/usr/share/emacs/site-lisp/mew/mew.el is in mew 1:6.7-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 | ;;; mew.el --- Messaging in the Emacs World
;; Author: Kazu Yamamoto <Kazu@Mew.org>
;; Created: Mar 23, 1994
;; Revised: Aug 4, 2015
;;; Commentary:
;; The updated version is available from:
;; http://www.Mew.org/
;;
;; See info for configuring a site file/.emacs/.mew.el.
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Mew version
;;;
(defconst mew-version-number "6.7"
"Version number for this version of Mew.")
(defconst mew-version (format "Mew version %s" mew-version-number)
"Version string for this version of Mew.")
(provide 'mew)
(require 'mew-const)
(require 'mew-blvs)
(require 'mew-func)
(require 'mew-vars) ;; mew-env && mew-key
(require 'mew-vars2)
(require 'mew-vars3)
(defun mew-version-show ()
"Show mew-version in minibuffer."
(interactive)
(message "%s" mew-version))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; For developers
;;;
(defvar mew-debug nil
"'decode, 'encode, 'net, 'pgp, 'thread, 'sort, t for all.")
(defun mew-debug (category)
(or (eq mew-debug t) (eq mew-debug category)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Bootstrap
;;;
(defvar mew-init-p nil)
;;;###autoload
(defun mew (&optional arg)
"Execute Mew first unless Mew is running. And retrieve arrived
messages or just visit to the default folder.
'proto' is determined by 'mew-proto' and 'mew-case'.
If 'proto' is '+' (ie a local folder), a mailbox is determined
according to 'mew-mailbox-type'. Otherwise (ie a remote folder), an
appropriate protocol to retrieve messages is chosen according to
'proto'.
If 'mew-auto-get' is 't', arrived messages are asynchronously fetched
and listed up in Summary mode.
'mew-auto-get' is 'nil', just visit to the folder determined by
'proto'.
When executed with '\\[universal-argument]', 'mew-auto-get' is
considered reversed."
(interactive "P")
(mew-window-push)
(unless mew-init-p (mew-init))
(let* ((auto (if arg (not mew-auto-get) mew-auto-get))
(case mew-case)
(proto (mew-proto case))
inbox case:inbox)
(if auto
(mew-summary-scan-boot proto case)
;; see also mew-summary-retrieve
(setq inbox (mew-proto-inbox-folder proto case))
(setq case:inbox (mew-case-folder case inbox))
(mew-summary-visit-folder case:inbox 'goend))
(setq mew-inbox-window (current-window-configuration))))
;;;###autoload
(defun mew-send (&optional to cc subject)
"Execute Mew then prepare a draft. This may be used as library
function."
(interactive)
(mew-current-set-window-config)
(unless mew-init-p (mew-init))
(mew-summary-send to cc subject))
;;;###autoload
(defun mew-user-agent-compose (&optional to subject other-headers continue
switch-function yank-action
send-actions
&rest dummy)
"Set up message composition draft with Mew.
This is 'mail-user-agent' entry point to Mew.
The optional arguments TO and SUBJECT specify recipients and the
initial Subject field, respectively.
OTHER-HEADERS is an alist specifying additional
header fields. Elements look like (HEADER . VALUE) where both
HEADER and VALUE are strings.
A Draft buffer is prepared according to SWITCH-FUNCTION.
CONTINUE, YANK-ACTION and SEND-ACTIONS are ignored."
(unless mew-init-p (mew-init))
(let* ((draft (mew-folder-new-message mew-draft-folder))
(attachdir (mew-attachdir draft))
cc asked)
(when (and mew-ask-to (null to))
(setq to (mew-input-address (concat mew-to: " ")))
(setq asked t))
(when mew-ask-cc
(setq cc (mew-input-address (concat mew-cc: " ")))
(setq asked t))
(mew-current-set-window-config)
(mew-window-configure 'draft)
(mew-summary-prepare-draft
(mew-draft-find-and-switch draft switch-function)
(mew-delete-directory-recursively attachdir)
(mew-draft-header subject nil to cc nil nil nil other-headers asked)
(mew-draft-mode)
(run-hooks 'mew-draft-mode-newdraft-hook))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Functions for boot time
;;;
(defun mew-init ()
(let ((buf (get-buffer-create "*Mew hello*")))
(run-hooks 'mew-env-hook)
(load mew-rc-file 'no-err 'no-msg)
(cond
((memq system-type '(windows-nt cygwin))
(require 'mew-win32))
((eq system-type 'darwin)
(require 'mew-darwin))
(t
(require 'mew-unix)))
(require 'mew-varsx)
(if mew-theme-file (load mew-theme-file 'no-err 'no-msg))
(switch-to-buffer buf)
(mew-window-configure '(1 0)) ;; Using mew-mode-name-message
(mew-hello)
(message "Setting up Mew world...")
(mew-set-environment)
(run-hooks 'mew-init-hook)
(mew-transit-folder)
(mew-status-update t)
(mew-passwd-setup)
(mew-highlight-timer-setup)
(setq mew-init-p t)
(mew-kill-buffer buf)
(message "Setting up Mew world...done")))
(defun mew-set-environment (&optional no-dir)
(let (error-message)
(condition-case nil
(progn
;; sanity check
(cond
((featurep 'xemacs)
(setq error-message "Not support XEmacs\n")
(error ""))
((string-match "^\\(18\\|19\\|20\\)" emacs-version)
(setq error-message "Not support Emacs 18/19/20 nor Mule 1\n")
(error "")))
;; initializing
(or no-dir (mew-buffers-init))
(or no-dir (mew-temp-dir-init))
(mew-mark-init)
(mew-config-init)
(mew-subprocess-init)
(mew-rotate-log-files mew-smtp-log-file)
(mew-rotate-log-files mew-nntp-log-file)
(mew-rotate-log-files mew-refile-log-file))
(error
(set-buffer (generate-new-buffer mew-buffer-debug))
(goto-char (point-max))
(insert "\n\nMew errors:\n\n")
(and error-message (insert error-message))
(set-buffer-modified-p nil)
(setq buffer-read-only t)
;; cause an error again
(error "Mew found some errors above")))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Status update
;;;
(defun mew-folder-init (folders)
(let (dir)
(dolist (folder folders)
(setq folder (mew-canonicalize-folder folder))
(setq dir (mew-expand-folder folder))
(unless (file-exists-p dir)
(mew-make-directory dir)
(mew-local-folder-insert folder)
(message "%s was created" dir))
(setq dir (file-chase-links dir))
(if (file-exists-p dir)
(if (/= mew-folder-mode (file-modes dir))
(set-file-modes dir mew-folder-mode))))))
(defun mew-status-update (&optional arg)
"Read Addrbook and update its information.
If executed with '\\[universal-argument]', information about folders
of the current world is also updated."
(interactive "P")
(cond
((and arg (integerp arg))
(mew-message-for-summary "This command was obsoleted. Type '\\[universal-argument]\\[mew-status-update]' to collect folders"))
((consp arg)
(let (case proto)
(mew-set '(case proto) (mew-summary-case-proto))
(cond
((mew-folder-localp proto)
(mew-local-update (mew-called-interactively-p)))
((mew-folder-popp proto)
(message "Nothing updated for POP"))
((mew-folder-imapp proto)
(mew-imap-update case))
((mew-folder-nntpp proto)
(mew-nntp-update case)))))
(t
(if (mew-called-interactively-p) (mew-set-environment 'no-dir))
;; These two must be before mew-local-update
(message "Updating status...")
(mew-config-setup)
(mew-regex-setup)
(if arg (mew-local-update (mew-called-interactively-p)))
(mew-folder-init mew-basic-folders)
(mew-folder-init mew-inbox-folders)
(mew-folder-init mew-queue-folders)
(mew-folder-init mew-postq-folders)
(mew-refile-setup)
(mew-addrbook-setup)
(mew-scan-setup)
(mew-pgp-setup)
(mew-smime-setup)
(mew-ssh-setup)
(mew-ssl-setup)
(mew-net-setup)
(mew-thread-setup)
(mew-decoration-setup)
(mew-biff-setup)
(mew-ct-setup)
(run-hooks 'mew-status-update-hook)
(message "Updating status...done"))))
(defvar mew-mime-content-type-list nil
"Candidate of Content-Type: when CT: is changed in draft buffer.")
(defun mew-ct-setup ()
(dolist (ct (mapcar 'car mew-mime-content-type))
(if (and (stringp ct) (not (string-match "/$" ct)))
(setq mew-mime-content-type-list
(cons (capitalize ct) mew-mime-content-type-list)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Current status
;;;
(defun mew-frame-id (&optional frame)
(if window-system
(let ((fram (or frame (selected-frame))))
(concat "mew-current-info-"
(cdr (assq 'window-id (frame-parameters fram)))))
"mew-current-info-no-window"))
(defvar mew-current-info-list '("fld" "msg" "part" "window"))
(mew-info-defun "mew-current-" mew-current-info-list)
(defun mew-current-set (fld msg part)
(let ((fid (mew-frame-id)))
(mew-current-set-fld fid fld)
(mew-current-set-msg fid msg)
(mew-current-set-part fid part)))
(defun mew-current-clean-up ()
(if window-system
(dolist (frame (frame-list))
(mew-info-clean-up (concat "mew-current-info-" (mew-frame-id frame))))
(mew-info-clean-up "mew-current-info-no-window")))
(defun mew-current-set-window-config ()
(mew-current-set-window (mew-frame-id) (current-window-configuration)))
(defun mew-current-get-window-config ()
(let ((win (mew-current-get-window (mew-frame-id))))
(unless (window-configuration-p win)
(setq win mew-inbox-window))
(if win (set-window-configuration win))
(mew-current-set-window (mew-frame-id) nil)
(mew-summary-toolbar-update)
(mew-redraw)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Window configuration stack
;;;
(defvar mew-inbox-window nil)
(defvar mew-window-stack nil)
(defun mew-window-clean-up ()
(setq mew-window-stack nil))
(defun mew-window-push ()
(let ((frame (selected-frame))
(config (current-window-configuration)))
(setq mew-window-stack (cons (cons frame config) mew-window-stack))))
(defun mew-window-pop ()
(let* ((frame (selected-frame))
(assoc (assoc frame mew-window-stack)))
(if (and assoc (window-configuration-p (cdr assoc)))
(set-window-configuration (cdr assoc))
(switch-to-buffer (get-buffer-create mew-window-home-buffer)))
(setq mew-window-stack (delq assoc mew-window-stack))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Window configuration
;;;
(defun mew-delete-other-window ()
(unless (one-window-p)
(let ((owin (selected-window))
wins ret)
(walk-windows
(lambda (win)
(set-buffer (window-buffer win))
(unless (or (eq owin win)
(string-match "^mew-" (symbol-name major-mode)))
(setq wins (cons win wins))))
nil)
(dolist (win wins)
(unless (one-window-p)
(setq ret t)
(delete-window win)))
(select-window owin)
ret)))
(defun mew-window-configure (action)
"Configure windows according to ACTION.
ACTION should be symbol or a list of two numbers.
Predefined symbol is 'summary, 'message, and 'draft.
They are used as a key of 'mew-window-configuration to get
a list of two numbers.
Two numbers means the ratio of the upper window and
the lower window (i.e. the window of Message buffer).
If Message buffer does not exist, it will be created. If the height of
the lower window is not zero, switch to the buffer."
(let* ((windows
(if (listp action)
action
(car (cdr (assq action mew-window-configuration)))))
(msgbuf (mew-buffer-message))
(obufwin (get-buffer-window (current-buffer)))
(msgwin (get-buffer-window msgbuf))
(height nil) (winsum nil) (sum-height 0) (msg-height 0))
(setq height (+ (if obufwin (window-height obufwin) 0)
(if msgwin (window-height msgwin) 0)))
(cond
((<= height (* 2 window-min-height))
;; Delete other windows and use full emacs window.
(delete-other-windows)
(setq height (window-height (selected-window))))
((and mew-use-full-window (mew-delete-other-window))
;; delete windows all but Mew's one.
(setq height (+ (if obufwin (window-height obufwin) 0)
(if msgwin (window-height msgwin) 0)))))
;;
(if (get-buffer msgbuf)
(delete-windows-on msgbuf)
(with-current-buffer (get-buffer-create msgbuf)
(kill-all-local-variables)
;; "truncate?" is asked in Message mode.
;; so set the same toolbar as Summary mode
(mew-summary-toolbar-update)
(mew-message-mode)))
;;
(setq winsum (apply '+ windows))
(unless (zerop (nth 0 windows))
(setq sum-height (max window-min-height
(/ (* height (nth 0 windows)) winsum))))
(if (and (eq action 'message) (= (% sum-height 2) 1))
(setq sum-height (1+ sum-height)))
(unless (zerop (nth 1 windows))
(setq msg-height (max window-min-height (- height sum-height))))
(setq height (+ sum-height msg-height))
;;
(unless (zerop msg-height)
(split-window nil sum-height)
(other-window 1)
(switch-to-buffer msgbuf 'norecord)
(mew-set-buffer-cs mew-cs-m17n))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Message buffer
;;;
(defun mew-window-number ()
(let ((x (car (window-edges (selected-window))))
(i 1))
(walk-windows
(lambda (win)
(when (with-current-buffer (window-buffer win)
(mew-summary-or-virtual-p))
(if (< (car (window-edges win)) x)
(setq i (1+ i)))))
'nominibuf)
i))
(defun mew-buffer-message ()
(let* ((me (selected-frame))
(frames (frame-list))
(len (length frames))
(n (mew-window-number))
(i 0))
(catch 'loop
(dolist (frame frames)
(if (equal me frame) (throw 'loop i))
(setq i (1+ i))))
(setq i (- len i 1))
(if (= n 1)
(format "%s%d" mew-buffer-message i)
(format "%s%d<%d>" mew-buffer-message i n))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Buffers
;;;
(defvar mew-buffers nil)
(defun mew-buffers-init ()
(setq mew-buffers nil))
(defun mew-buffers-setup (folder)
(mew-addq mew-buffers folder))
(defun mew-buffers-bury ()
(dolist (buffer mew-buffers)
(if (get-buffer buffer) (bury-buffer buffer))))
(defun mew-buffers-clean-up ()
(dolist (buffer mew-buffers)
(mew-remove-buffer buffer))
(mew-buffers-init))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Temporary directory
;;;
(defvar mew-temp-dir nil) ;; the default is "/tmp/user_name_uniq"
(defvar mew-temp-file nil) ;; the default is "/tmp/user_name_uniq/mew"
(defun mew-temp-dir-init ()
"Setting temporary directory for Mew.
mew-temp-file must be local and readable for the user only
for privacy/speed reasons."
(setq mew-temp-dir (make-temp-name mew-temp-file-initial))
(mew-make-directory mew-temp-dir)
(set-file-modes mew-temp-dir mew-folder-mode)
(setq mew-temp-file (expand-file-name "mew" mew-temp-dir))
(add-hook 'kill-emacs-hook 'mew-temp-dir-clean-up))
(defun mew-temp-dir-clean-up ()
"A function to remove Mew's temporary directory recursively.
It is typically called by kill-emacs-hook."
(remove-hook 'kill-emacs-hook 'mew-temp-dir-clean-up)
(if (and mew-temp-dir (file-exists-p mew-temp-dir))
(mew-delete-directory-recursively mew-temp-dir))
(setq mew-temp-dir nil)
(setq mew-temp-file nil))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Regular expressions
;;;
(defvar mew-regex-msg-show-list nil)
(defvar mew-regex-msg-show nil)
(defvar mew-regex-msg-or-part nil)
(defvar mew-regex-msg-review nil)
(defvar mew-regex-msg-delete nil)
(defvar mew-regex-attach-beg nil)
(defvar mew-regex-attach-end nil)
(defvar mew-regex-my-address-list nil)
(defvar mew-regex-ignore-folders nil)
(defvar mew-regex-thread-separator nil)
(defun mew-mark-regex (mark)
(concat "^" (regexp-quote (char-to-string mark))))
(defun mew-mark-list-regex (mark-list)
(concat "^" "[" (mapconcat 'char-to-string mark-list "") "]"))
(defun mew-regex-setup-msg (lst)
(setq mew-regex-msg-show-list lst)
(setq mew-regex-msg-show (mew-mark-list-regex lst))
(setq mew-regex-msg-or-part (concat mew-regex-msg-show "\\|" mew-regex-part)))
(defun mew-regex-setup ()
(setq mew-eoh (format "^\\(%s\\|\\)$" (regexp-quote mew-header-separator)))
(mew-regex-setup-msg mew-mark-show-list)
(setq mew-regex-msg-review (mew-mark-regex mew-mark-review))
(setq mew-regex-msg-delete (mew-mark-regex mew-mark-delete))
(setq mew-regex-thread-separator
(concat "^" (regexp-quote mew-thread-separator)))
(setq mew-regex-attach-beg
(concat "^" mew-draft-attach-boundary-beg "$"))
(setq mew-regex-attach-end
(concat "^" mew-draft-attach-boundary-end "$"))
(setq mew-regex-my-address-list (mew-get-my-address-regex-list))
(setq mew-regex-ignore-folders
(mapconcat
'mew-folder-regex
(mew-uniq-list
(append
mew-basic-folders
mew-inbox-folders
mew-queue-folders
mew-postq-folders
(list
mew-friend-folder
mew-attach-folder)))
"\\|"))
(unless mew-range-list
(setq mew-range-list
`((,mew-queue-folders ,mew-range-str-all)
(, mew-postq-folders ,mew-range-str-all)
((,mew-draft-folder) ,mew-range-str-all)
(t ,mew-range-str-update)))))
(defun mew-summary-toggle-mark-regex ()
(interactive)
(let (lst)
(if (equal mew-regex-msg-show-list mew-mark-show-list)
(setq lst mew-mark-show-list2)
(setq lst mew-mark-show-list))
(mew-regex-setup-msg lst)
(message "Target marks are: %s" (mapconcat (lambda (x) (message "'%c'" x)) lst ", "))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Theme
;;;
(defun mew-decoration-setup ()
(interactive)
(put-text-property 0 (length mew-end-of-message-string)
'face 'mew-face-eof-message
mew-end-of-message-string)
(put-text-property 0 (length mew-end-of-part-string)
'face 'mew-face-eof-part
mew-end-of-part-string))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Tear down
;;;
(defun mew-bury-buffer (&optional buf)
(bury-buffer buf)
(delete-windows-on buf t))
(defun mew-kill-buffer (&optional buf)
"Erase the current buffer."
(interactive)
(let* ((buf (or buf (current-buffer)))
(folder (if (bufferp buf) (buffer-name buf) buf))
obuf)
(if (get-buffer buf)
(with-current-buffer buf
(when (mew-summary-or-virtual-p)
(mew-summary-kill-subprocess)
(setq obuf (mew-local-buffer-name folder))
;; xxx should kill pop's buffer...
(mew-remove-buffer obuf))
(mew-overlay-delete-buffer)))
(mew-remove-buffer buf)))
(defun mew-buffer-clean-up (regex &optional func)
(unless func (setq func 'mew-kill-buffer))
(dolist (buf (mew-buffer-list regex))
(funcall func buf)))
(defun mew-quit-toolbar-update ()
(mew-redraw) ;; due to mouse-face bug
(if (fboundp 'redraw-frame) ;; for BOW
(redraw-frame (selected-frame)))) ;; update toolbar
(defun mew-summary-suspend ()
"Suspend Mew then switch to another buffer. All buffers of
Mew remain, so you can resume with buffer operations."
(interactive)
(mew-buffer-clean-up
(concat "^" (regexp-quote mew-buffer-message))
'mew-bury-buffer)
(mew-buffers-bury)
(mew-window-pop)
(mew-quit-toolbar-update)
(run-hooks 'mew-suspend-hook))
(defun mew-summary-quit ()
"Quit Mew. All buffers of Mew are erased."
(interactive)
(when (y-or-n-p "Quit Mew? ")
;; killing buffers
(mew-cache-clean-up)
(mew-buffer-clean-up (concat "^" (regexp-quote mew-buffer-message)))
(mew-buffer-clean-up (mew-folder-regex mew-draft-folder)) ;; +draft/*
(mew-buffer-clean-up mew-buffer-regex) ;; other buffers
;;
(mew-sinfo-clean-up)
(mew-buffers-clean-up) ;; Summary mode and Virtual mode
;;
(mew-passwd-clean-up) ;; should be before dir clean up
(mew-temp-dir-clean-up)
(mew-subprocess-clean-up)
;;
(run-hooks 'mew-quit-hook)
;;
;; lastly, clean up variables
;;
(mew-folder-clean-up)
(mew-refile-clean-up)
(mew-current-clean-up)
(mew-addrbook-clean-up)
(mew-highlight-timer-clean-up)
(mew-net-clean-up)
(mew-biff-clean-up)
;;
(mew-window-pop)
(mew-window-clean-up)
(mew-quit-toolbar-update)
;;
(setq mew-init-p nil)
(message nil))) ;; just clear
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Transit (should be removed someday)
;;;
;; Spotlight does not handle Files/Directories starting with ".".
(defvar mew-transit-folder-alist
'(("+.pop" "+#pop") ("+.imap" "+#imap") ("+.nntp" "+#nntp")))
(defun mew-transit-folder ()
(let (old new dirs subnew)
(with-temp-buffer
(dolist (ent mew-transit-folder-alist)
(setq old (mew-expand-folder (nth 0 ent)))
(setq new (mew-expand-folder (nth 1 ent)))
(when (and (file-directory-p old) (not (file-exists-p new)))
(rename-file old new)
(cd new)
(setq dirs (directory-files "."))
(dolist (subold dirs)
;; % is a special character for URL.
;; And "open" does not convert % to %25, sigh.
(when (string-match "@[^%]+\\(%\\)" subold)
(setq subnew (copy-sequence subold))
(aset subnew (match-beginning 1) ?#)
(rename-file subold subnew))))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Load Mew libraries
;;;
(require 'mew-local)
(require 'mew-addrbook)
(require 'mew-complete)
(require 'mew-minibuf)
(require 'mew-cache)
(require 'mew-encode)
(require 'mew-decode)
(require 'mew-edit)
(require 'mew-mime)
(require 'mew-mark)
(require 'mew-exec)
(require 'mew-header)
(require 'mew-pgp)
(require 'mew-smime)
(require 'mew-bq)
(require 'mew-syntax)
(require 'mew-scan)
(require 'mew-passwd)
(require 'mew-pick)
(require 'mew-search)
(require 'mew-summary)
(require 'mew-summary2)
(require 'mew-summary3)
(require 'mew-summary4)
(require 'mew-virtual)
(require 'mew-thread)
(require 'mew-message)
(require 'mew-draft)
(require 'mew-attach)
(require 'mew-demo)
(require 'mew-refile)
(require 'mew-ext)
(require 'mew-fib)
(require 'mew-sort)
(require 'mew-highlight)
(require 'mew-net)
(require 'mew-ssh)
(require 'mew-ssl)
(require 'mew-smtp)
(require 'mew-pop)
(require 'mew-nntp)
(require 'mew-nntp2)
(require 'mew-imap)
(require 'mew-imap2)
(require 'mew-config)
(require 'mew-auth)
(eval-when-compile
(if (mew-which-el "timer")
(require 'timer)))
;;; Copyright Notice:
;; Copyright (C) 1994-2015 Mew developing team.
;; All rights reserved.
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions
;; are met:
;;
;; 1. Redistributions of source code must retain the above copyright
;; notice, this list of conditions and the following disclaimer.
;; 2. Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;; 3. Neither the name of the team nor the names of its contributors
;; may be used to endorse or promote products derived from this software
;; without specific prior written permission.
;;
;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND
;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE
;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;; mew.el ends here
|