make mew support chinese attatchment.
set default task in org-mode
retrieve all account's mail in mew.
make org mode always have a clocked task.
hide some buffers

make mew support chinese attatchment.


Modify the function mew-header-insert in mew-header.el like this

(defvar *mew-header-encoding-method* :rfc2047)
(defun mew-header-insert (key value &optional no-fold)
  (if (and value (stringp key))
      (let ((beg (point)) params med parname parval)
        (when (listp value)
          (setq params (cdr value))
          (setq value (car value)))
        (insert key)
        (insert " ")
        (setq med (point))
        (if (string-match "^[\t -~]*$" value)
            (insert value)
          (mew-header-encode-text value nil (length key)))
        (dolist (par params)
          (mew-set '(parname parval) par)
          (insert ";")
           ((string-match "^[-a-zA-Z0-9]+$" parval)
            ) ;; do nothing
           ((and (string= (mew-charset-guess-string parval) mew-us-ascii)
                 (not (string-match "\"" parval)))
            (setq parval (concat "\"" parval "\"")))
            (case *mew-header-encoding-method*
               (when (loop for c across parval
                        thereis (> c 255))
                 (setq parval (concat "\"" (rfc2047-encode-string parval)
              (t (setq parval (mew-param-encode parval))
                 (setq parname (concat parname "*"))))))
          (insert " " parname "=" parval))
        (insert "\n")
        (unless no-fold
          (mew-header-fold-region beg (point) med)))))

set default task in org-mode

Insert following codes below headline.

%%(progn (org-clock-mark-default-task) nil)
Default task is ready after executing (org-agenda).

retrieve all account's mail in mew.

;;; utils to retrieve all accounts mails.
(defvar my-mew-cases '("default" "hotmail" "" ""))
(defvar my-mew-orig-case "default")
(defvar my-mew-current-caselist my-mew-cases)
(defun my-mew-summary-set-case (case)
  "Set the case."
  (setq mew-case case)
  (let ((case mew-case)) ;; side effect
      (dolist (buf mew-buffers)
        (when (get-buffer buf)
          (set-buffer buf)
             (mew-summary-mode-name mew-mode-name-summary))
             (mew-summary-mode-name mew-mode-name-virtual))))))
    (when mew-visit-inbox-after-setting-case
      (let ((inbox (mew-case-folder
                    (mew-proto-inbox-folder (mew-proto case) case))))
        (mew-summary-visit-folder inbox)))))
(defun my-mew-summary-retrive-all ()
  (setq my-mew-orig-case mew-case)
  (my-mew-summary-set-case (car my-mew-cases))
  (setq my-mew-current-caselist (cdr my-mew-cases))
(defadvice mew-net-disp-info-display (after my-cache-save-postfix-action)
  (sleep-for 2)
  (cond (my-mew-current-caselist
         (my-mew-summary-set-case (car my-mew-current-caselist))
         (setq my-mew-current-caselist (cdr my-mew-current-caselist))
         (sleep-for 2)
         (message "retrieve all acounts done.")
         (my-mew-summary-set-case my-mew-orig-case)
         (setq my-mew-orig-case nil))))
(ad-activate 'mew-net-disp-info-display)
(define-key mew-summary-mode-map "I"    'my-mew-summary-retrive-all)

make org mode always have a clocked task.

First create an contains following lines.

This heading is used by keeping clocks is always opening.
%%(progn (xjt/org-clock-mark-idle-task) nil)

# Local Variables: ***
# buffer-save-without-query : t ***
# End: ***
Then add following code when start emacs.
(defvar *org-clock-idle-task* nil)
(defvar *org-clock-idle-quit* nil)
(defun xjt/org-clock-mark-idle-task ()
  "Mark current task as idle task."
    (org-back-to-heading t)
    (setq *org-clock-idle-task* (make-marker))
    (move-marker *org-clock-idle-task* (point))))

(defun xjt/clock-to-idle-maybe ()
  (unless org-clock-clocking-in
    (when (and (not *org-clock-idle-quit*)
        (with-current-buffer (marker-buffer *org-clock-idle-task*)
          (goto-char (marker-position *org-clock-idle-task*))
(add-hook 'org-clock-out-hook 'xjt/clock-to-idle-maybe 'append)

(org-copy-face 'modeline 'org-mode-line-clock-idle
  "Face used for clock display for idle tasks in mode line."
  :background "IndianRed3")
(defadvice org-clock-update-mode-line (around xjt/org-clock-update-mode-line)
  (if (string= "*NO TASK*" org-clock-heading)
      (setq org-mode-line-string (org-propertize "*NO TASK*" 'face 'org-mode-line-clock-idle))
(ad-activate 'org-clock-update-mode-line)

(defadvice org-clock-save (before xjt/org-clock-idle-save)
  (setq *org-clock-idle-quit* t)
  (when (string= "*NO TASK*" org-clock-heading)
    (with-current-buffer ""
(ad-activate 'org-clock-save)
Finally,make emacs load when start.
  (let ((org-agenda-files (append org-agenda-files (list (concat org-directory "")))))
    (org-agenda nil "D")

hide some buffers

(setq *tabbar-ignore-buffers* '("" ".bbdb" "diary"))
(setq tabbar-buffer-list-function
             (lambda ()
                (lambda (buffer)
                  (and (not (eq (current-buffer) buffer)) ; Always include the current buffer.
                       (loop for name in *tabbar-ignore-buffers* ;remove buffer name in this list.
                          thereis (string-equal (buffer-name buffer) name))))