From: okazaki Date: Mon, 11 Sep 2000 08:40:21 +0000 (+0000) Subject: Trim trailing whitespaces. X-Git-Tag: wl-2_4-root~155 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=2e9f5d2e3f003da464c20fe9924d1e80849265e6;p=elisp%2Fwanderlust.git Trim trailing whitespaces. --- diff --git a/elmo/elmo-archive.el b/elmo/elmo-archive.el index 39d32a1..20361fd 100644 --- a/elmo/elmo-archive.el +++ b/elmo/elmo-archive.el @@ -307,7 +307,7 @@ TYPE specifies the archiver's symbol." (if (and (find-file-name-handler dir 'copy-file) ; ange-ftp, efs spec) (progn - (setq filename (expand-file-name + (setq filename (expand-file-name (concat elmo-archive-basename suffix) (setq dbdir (elmo-msgdb-expand-path nil spec)))) (if (file-directory-p dbdir) @@ -454,7 +454,7 @@ TYPE specifies the archiver's symbol." (arc (elmo-archive-get-archive-name (nth 1 spec) type spec)) (prefix (nth 3 spec)) (method (elmo-archive-get-method type 'cat)) - (args (list arc (elmo-concat-path + (args (list arc (elmo-concat-path prefix (int-to-string number))))) (set-buffer outbuf) (erase-buffer) @@ -529,7 +529,7 @@ TYPE specifies the archiver's symbol." (setq tmp-dir (substring src-dir 0 (match-beginning 0))) (setq p-method (elmo-archive-get-method dst-type 'cp-pipe) n-method (elmo-archive-get-method dst-type 'cp)) - (setq tmp-msgs (mapcar '(lambda (x) + (setq tmp-msgs (mapcar '(lambda (x) (elmo-concat-path prefix (int-to-string x))) msgs)) (setq do-link nil)) @@ -779,7 +779,7 @@ TYPE specifies the archiver's symbol." (if (and elmo-archive-use-izip-agent (elmo-archive-get-method (nth 2 spec) 'cat-headers)) (elmo-archive-msgdb-create-as-numlist-subr2 - spec numlist new-mark already-mark seen-mark important-mark + spec numlist new-mark already-mark seen-mark important-mark seen-list) (elmo-archive-msgdb-create-as-numlist-subr1 spec numlist new-mark already-mark seen-mark important-mark @@ -790,7 +790,7 @@ TYPE specifies the archiver's symbol." (defun elmo-archive-msgdb-create-as-numlist-subr1 (spec numlist new-mark already-mark seen-mark - important-mark + important-mark seen-list) (let* ((type (nth 2 spec)) (file (elmo-archive-get-archive-name (nth 1 spec) type spec)) @@ -829,7 +829,7 @@ TYPE specifies the archiver's symbol." seen-mark new-mark)))) (setq mark-alist - (elmo-msgdb-mark-append + (elmo-msgdb-mark-append mark-alist (elmo-msgdb-overview-entity-get-number entity) gmark)))) @@ -904,8 +904,8 @@ TYPE specifies the archiver's symbol." (list overview number-alist mark-alist)) ) (defun elmo-archive-parse-mmdf (msgs new-mark - already-mark - seen-mark + already-mark + seen-mark seen-list) (let ((delim elmo-mmdf-delimiter) number sp ep rest entity overview number-alist mark-alist ret-val @@ -933,7 +933,7 @@ TYPE specifies the archiver's symbol." (car entity))) (setq message-id (car entity)) (setq seen (member message-id seen-list)) - (if (setq gmark + (if (setq gmark (or (elmo-msgdb-global-mark-get message-id) (if (elmo-cache-exists-p message-id) ; XXX (if seen @@ -943,7 +943,7 @@ TYPE specifies the archiver's symbol." seen-mark new-mark)))) (setq mark-alist - (elmo-msgdb-mark-append + (elmo-msgdb-mark-append mark-alist (elmo-msgdb-overview-entity-get-number entity) gmark))) @@ -1043,9 +1043,9 @@ TYPE specifies the archiver's symbol." (elmo-concat-path prefix (int-to-string number)) tmp-dir))) -(defalias 'elmo-archive-sync-number-alist +(defalias 'elmo-archive-sync-number-alist 'elmo-generic-sync-number-alist) -(defalias 'elmo-archive-list-folder-unread +(defalias 'elmo-archive-list-folder-unread 'elmo-generic-list-folder-unread) (defalias 'elmo-archive-list-folder-important 'elmo-generic-list-folder-important) diff --git a/elmo/elmo-cache.el b/elmo/elmo-cache.el index bb8eeac..cf3482a 100644 --- a/elmo/elmo-cache.el +++ b/elmo/elmo-cache.el @@ -47,12 +47,12 @@ (unless (string-match elmo-cache-dirname path) (error "%s is not cache file!" path)) (let (message-id) - (if (or (elmo-msgdb-global-mark-get + (if (or (elmo-msgdb-global-mark-get (setq message-id (elmo-cache-to-msgid (file-name-nondirectory path)))) (member message-id locked)) nil ;; Don't delete caches with mark (or locked message). - (if (and path + (if (and path (file-directory-p path)) (progn (mapcar 'delete-file (directory-files path t "^[^\\.]")) @@ -65,13 +65,13 @@ (if msgid (let ((path1 (elmo-cache-get-path msgid)) path2) - (if (and path1 + (if (and path1 (file-exists-p path1)) (if (and folder (file-directory-p path1)) - (when (file-exists-p (setq path2 + (when (file-exists-p (setq path2 (expand-file-name - (format "%s@%s" + (format "%s@%s" number (elmo-safe-filename folder)) @@ -103,7 +103,7 @@ (defun elmo-read-float-value-from-minibuffer (prompt &optional initial) (let ((str (read-from-minibuffer prompt initial))) - (cond + (cond ((string-match "[0-9]*\\.[0-9]+" str) (string-to-number str)) ((string-match "[0-9]+" str) @@ -111,7 +111,7 @@ (t (error "%s is not number" str))))) (defun elmo-cache-expire-by-size (&optional kbytes) - "Expire cache file by size. + "Expire cache file by size. If KBYTES is kilo bytes (This value must be float)." (interactive) (let ((size (or kbytes @@ -136,14 +136,14 @@ If KBYTES is kilo bytes (This value must be float)." (message "Checking disk usage...done.") (let ((cfl (elmo-cache-get-sorted-cache-file-list)) (deleted 0) - oldest + oldest cur-size cur-file) (while (and (<= size total) (setq oldest (elmo-cache-get-oldest-cache-file-entity cfl))) (setq cur-file (expand-file-name (car (cdr oldest)) (car oldest))) (if (file-directory-p cur-file) (setq cur-size (elmo-disk-usage cur-file)) - (setq cur-size + (setq cur-size (/ (float (nth 7 (file-attributes cur-file))) Kbytes))) (when (elmo-cache-force-delete cur-file locked) @@ -151,7 +151,7 @@ If KBYTES is kilo bytes (This value must be float)." (message "%d cache(s) are expired." count)) (setq deleted (+ deleted cur-size)) (setq total (- total cur-size))) - (message "%d cache(s) are expired from disk (%d Kbytes/%d Kbytes)." + (message "%d cache(s) are expired from disk (%d Kbytes/%d Kbytes)." count deleted beginning)))) (defun elmo-cache-make-file-entity (filename path) @@ -162,8 +162,8 @@ If KBYTES is kilo bytes (This value must be float)." flist firsts oldest-entity wonlist) (while cfl (setq flist (cdr (car cfl))) - (setq firsts (append firsts (list - (cons (car (car cfl)) + (setq firsts (append firsts (list + (cons (car (car cfl)) (car flist))))) (setq cfl (cdr cfl))) ; (prin1 firsts) @@ -182,8 +182,8 @@ If KBYTES is kilo bytes (This value must be float)." oldest-entity)) (defun elmo-cache-get-sorted-cache-file-list () - (let ((dirs (directory-files - (expand-file-name elmo-cache-dirname elmo-msgdb-dir) + (let ((dirs (directory-files + (expand-file-name elmo-cache-dirname elmo-msgdb-dir) t "^[^\\.]")) (i 0) num elist @@ -191,13 +191,13 @@ If KBYTES is kilo bytes (This value must be float)." (setq num (length dirs)) (message "Collecting cache info...") (while dirs - (setq elist (mapcar (lambda (x) + (setq elist (mapcar (lambda (x) (elmo-cache-make-file-entity x (car dirs))) (directory-files (car dirs) nil "^[^\\.]"))) (setq ret-val (append ret-val (list (cons (car dirs) - (sort + (sort elist (lambda (x y) (< (cdr x) @@ -212,12 +212,12 @@ If KBYTES is kilo bytes (This value must be float)." (defun elmo-cache-expire-by-age (&optional days) (let ((age (or (and days (int-to-string days)) (and (interactive-p) - (read-from-minibuffer + (read-from-minibuffer (format "Enter days (%s): " elmo-cache-expire-default-age))) (int-to-string elmo-cache-expire-default-age))) - (dirs (directory-files - (expand-file-name elmo-cache-dirname elmo-msgdb-dir) + (dirs (directory-files + (expand-file-name elmo-cache-dirname elmo-msgdb-dir) t "^[^\\.]")) (locked (elmo-dop-lock-list-load)) (count 0) @@ -226,7 +226,7 @@ If KBYTES is kilo bytes (This value must be float)." (setq age elmo-cache-expire-default-age) (setq age (string-to-int age))) (setq curtime (current-time)) - (setq curtime (+ (* (nth 0 curtime) + (setq curtime (+ (* (nth 0 curtime) (float 65536)) (nth 1 curtime))) (while dirs (let ((files (directory-files (car dirs) t "^[^\\.]")) @@ -248,7 +248,7 @@ If KBYTES is kilo bytes (This value must be float)." (elmo-cache-get-path msgid folder number) (elmo-cache-get-path msgid))) dir tmp-buf) - (when path + (when path (setq dir (directory-file-name (file-name-directory path))) (if (not (file-exists-p dir)) (elmo-make-directory dir)) @@ -268,8 +268,8 @@ If KBYTES is kilo bytes (This value must be float)." (if (and folder (file-directory-p path)) (if (file-exists-p (setq path (expand-file-name - (format "%s@%s" - (or number "") + (format "%s@%s" + (or number "") (elmo-safe-filename folder)) path))) @@ -287,10 +287,10 @@ If KBYTES is kilo bytes (This value must be float)." ret-val case-fold-search msg percent i) - (setq i 0) + (setq i 0) (while nalist (if (and (setq cache-file (elmo-cache-exists-p (cdr (car nalist)) - folder + folder (car (car nalist)))) (elmo-file-field-condition-match cache-file condition)) (setq ret-val (append ret-val (list (caar nalist))))) @@ -304,7 +304,7 @@ If KBYTES is kilo bytes (This value must be float)." (defun elmo-cache-collect-sub-directories (init dir &optional recursively) "Collect subdirectories under 'dir'" - (let ((dirs + (let ((dirs (delete (expand-file-name elmo-cache-dirname elmo-msgdb-dir) (directory-files dir t "^[^\\.]"))) @@ -313,14 +313,14 @@ If KBYTES is kilo bytes (This value must be float)." (setq ret-val (append init dirs)) (while (and recursively dirs) (setq ret-val - (elmo-cache-collect-sub-directories + (elmo-cache-collect-sub-directories ret-val (car dirs) recursively)) (setq dirs (cdr dirs))) ret-val)) (defun elmo-msgid-to-cache (msgid) - (when (and msgid + (when (and msgid (string-match "<\\(.+\\)>$" msgid)) (elmo-replace-msgid-as-filename (elmo-match-string 1 msgid)))) @@ -330,12 +330,12 @@ If KBYTES is kilo bytes (This value must be float)." (expand-file-name (expand-file-name (if folder - (format "%s/%s/%s@%s" + (format "%s/%s/%s@%s" (elmo-cache-get-path-subr msgid) msgid (or number "") (elmo-safe-filename folder)) - (format "%s/%s" + (format "%s/%s" (elmo-cache-get-path-subr msgid) msgid)) (expand-file-name elmo-cache-dirname @@ -459,8 +459,8 @@ Returning its cache buffer." (when (file-exists-p file) ;; Read until header separator is found. (while (and (eq elmo-localdir-header-chop-length - (nth 1 - (as-binary-input-file + (nth 1 + (as-binary-input-file (insert-file-contents file nil beg (incf beg elmo-localdir-header-chop-length))))) @@ -528,8 +528,8 @@ Returning its cache buffer." nil new-mark))) (setq mark-alist - (elmo-msgdb-mark-append - mark-alist + (elmo-msgdb-mark-append + mark-alist num gmark)))) (setq i (1+ i)) @@ -579,10 +579,10 @@ Returning its cache buffer." (let* ((dir (elmo-cache-get-folder-directory spec)) (flist (mapcar 'file-name-nondirectory (elmo-delete-if 'file-directory-p - (directory-files + (directory-files dir t "^[^@]+@[^@]+$" t)))) (folder (concat "'cache/" (nth 1 spec))) - (number-alist (or (elmo-msgdb-number-load + (number-alist (or (elmo-msgdb-number-load (elmo-msgdb-expand-path folder)) (list nil))) nlist) @@ -636,7 +636,7 @@ Returning its cache buffer." (defun elmo-cache-read-msg (spec number outbuf &optional set-mark) (save-excursion (let* ((dir (elmo-cache-get-folder-directory spec)) - (file (expand-file-name + (file (expand-file-name (elmo-cache-number-to-filename spec number) dir))) (set-buffer outbuf) (erase-buffer) @@ -678,7 +678,7 @@ Returning its cache buffer." (i 0) case-fold-search ret-val) (while msgs (if (elmo-file-field-condition-match - (expand-file-name + (expand-file-name (elmo-msgid-to-cache (cdr (assq (car msgs) number-alist))) (elmo-cache-get-folder-directory spec)) @@ -726,9 +726,9 @@ Returning its cache buffer." (elmo-cache-number-to-filename spec number) (elmo-cache-get-folder-directory spec))) -(defalias 'elmo-cache-sync-number-alist +(defalias 'elmo-cache-sync-number-alist 'elmo-generic-sync-number-alist) -(defalias 'elmo-cache-list-folder-unread +(defalias 'elmo-cache-list-folder-unread 'elmo-generic-list-folder-unread) (defalias 'elmo-cache-list-folder-important 'elmo-generic-list-folder-important) diff --git a/elmo/elmo-database.el b/elmo/elmo-database.el index 84f9d26..dc8b185 100644 --- a/elmo/elmo-database.el +++ b/elmo/elmo-database.el @@ -54,16 +54,16 @@ (and msgid db (progn (remove-database msgid db) - (put-database msgid (prin1-to-string + (put-database msgid (prin1-to-string (list folder number)) db))))) (defun elmo-database-msgid-delete (msgid) - (remove-database msgid (elmo-database-get + (remove-database msgid (elmo-database-get 'elmo-database-msgid elmo-database-msgid-filename))) (defun elmo-database-msgid-get (msgid) - (let ((match (get-database msgid (elmo-database-get + (let ((match (get-database msgid (elmo-database-get 'elmo-database-msgid elmo-database-msgid-filename)))) (and match (read match)))) diff --git a/elmo/elmo-date.el b/elmo/elmo-date.el index 5a6216c..5e8ad89 100644 --- a/elmo/elmo-date.el +++ b/elmo/elmo-date.el @@ -49,15 +49,15 @@ (aref datevec 0))) (defun elmo-date-get-datevec (description) - (cond + (cond ((not elmo-date-match) (error "date match is not available")) ((string-match "^[ \t]*\\([0-9]+\\)?[ \t]*\\([a-zA-Z]+\\)$" description) - (let ((today + (let ((today (save-match-data (timezone-fix-time (current-time-string) (current-time-zone) nil))) - (number + (number (string-to-int (if (match-beginning 1) (elmo-match-string 1 description) @@ -70,7 +70,7 @@ (elmo-date-get-offset-datevec today number) (error "%s is not supported yet" suffix))))) ((string-match "[0-9]+-[A-Za-z]+-[0-9]+" description) - (timezone-fix-time + (timezone-fix-time (concat (elmo-replace-in-string description "-" " ") " 0:00") nil nil)))) @@ -113,7 +113,7 @@ (minute (aref datevec 4)) (second (aref datevec 5)) (timezone (aref datevec 6)) - day-number p + day-number p day-of-month) (setq p 1) (setq day-number (- (timezone-day-number month day year) diff --git a/elmo/elmo-dop.el b/elmo/elmo-dop.el index 26679a5..0c278c6 100644 --- a/elmo/elmo-dop.el +++ b/elmo/elmo-dop.el @@ -45,7 +45,7 @@ Automatically loaded/saved.") (let ((operation (list (format "%s" folder) function argument))) (elmo-dop-queue-load) (unless (member operation elmo-dop-queue) ;; don't append same operation - (setq elmo-dop-queue + (setq elmo-dop-queue (append elmo-dop-queue (list operation))) (elmo-dop-queue-save)))) @@ -64,7 +64,7 @@ even an operation concerns the unplugged folder." (setq count (1+ count))) (setq queue (cdr queue))) (when (> count 0) - (if (elmo-y-or-n-p + (if (elmo-y-or-n-p (format "%d pending operation(s) exists. Perform now?" count) (not elmo-dop-flush-confirm) t) (progn @@ -102,11 +102,11 @@ even an operation concerns the unplugged folder." )))) (quit (setq failure t)) (error (setq failure err))) - (if failure + (if failure ;; create-folder was failed. (when (and (string= func "create-folder-maybe") - (elmo-y-or-n-p - (format + (elmo-y-or-n-p + (format "Create folder %s failed. Abort creating?" folder) (not elmo-dop-flush-confirm) t)) @@ -144,12 +144,12 @@ even an operation concerns the unplugged folder." (let ((queue elmo-dop-queue) new-queue match-queue que) (while (setq que (car queue)) - (if (and + (if (and (member (cadr que) elmo-dop-merge-funcs) (setq match-queue (car (delete nil (mapcar '(lambda (new-queue) - (if (and + (if (and (string= (car que) (car new-queue)) (string= (cadr que) (cadr new-queue))) new-queue)) @@ -162,7 +162,7 @@ even an operation concerns the unplugged folder." (defun elmo-dop-queue-load () (save-excursion - (setq elmo-dop-queue + (setq elmo-dop-queue (elmo-object-load (expand-file-name elmo-queue-filename elmo-msgdb-dir))))) @@ -176,7 +176,7 @@ even an operation concerns the unplugged folder." (defun elmo-dop-lock-message (message-id &optional lock-list) (let ((locked (or lock-list - (elmo-object-load + (elmo-object-load (expand-file-name elmo-msgdb-lock-list-filename elmo-msgdb-dir))))) @@ -188,7 +188,7 @@ even an operation concerns the unplugged folder." (defun elmo-dop-unlock-message (message-id &optional lock-list) (let ((locked (or lock-list - (elmo-object-load + (elmo-object-load (expand-file-name elmo-msgdb-lock-list-filename elmo-msgdb-dir))))) (setq locked (delete message-id locked)) @@ -198,7 +198,7 @@ even an operation concerns the unplugged folder." locked))) (defun elmo-dop-lock-list-load () - (elmo-object-load + (elmo-object-load (expand-file-name elmo-msgdb-lock-list-filename elmo-msgdb-dir))) @@ -209,7 +209,7 @@ even an operation concerns the unplugged folder." lock-list)) (defun elmo-dop-append-list-load (folder &optional resume) - (elmo-object-load + (elmo-object-load (expand-file-name (if resume elmo-msgdb-resume-list-filename elmo-msgdb-append-list-filename) @@ -246,7 +246,7 @@ even an operation concerns the unplugged folder." (let ((folder-numbers (elmo-make-folder-numbers-list folder msgs)) appended-deleting) (while folder-numbers - (if (eq (elmo-folder-get-type (car (car folder-numbers))) + (if (eq (elmo-folder-get-type (car (car folder-numbers))) 'imap4) (if elmo-enable-disconnected-operation (progn @@ -256,7 +256,7 @@ even an operation concerns the unplugged folder." msgs ; virtual number (elmo-dop-append-list-load folder))) (if (cdr appended-deleting) - (elmo-dop-queue-append + (elmo-dop-queue-append (car (car folder-numbers)) ; real folder "delete-msgids" ;; for secure removal. (cdr appended-deleting))) @@ -287,12 +287,12 @@ even an operation concerns the unplugged folder." max-num) (while append-list (if (rassoc (car append-list) number-alist) - (setq alreadies (append alreadies + (setq alreadies (append alreadies (list (car append-list))))) (setq append-list (cdr append-list))) (setq append-num (- append-num (length alreadies))) - (setq max-num - (or (nth (max (- (length number-list) 1) 0) + (setq max-num + (or (nth (max (- (length number-list) 1) 0) number-list) 0)) (while (< i append-num) (setq number-list @@ -329,7 +329,7 @@ even an operation concerns the unplugged folder." (defun elmo-dop-max-of-folder (folder) (if (eq (elmo-folder-get-type folder) 'imap4) (if elmo-enable-disconnected-operation - (let* ((number-alist (elmo-msgdb-number-load + (let* ((number-alist (elmo-msgdb-number-load (elmo-msgdb-expand-path folder))) (number-list (mapcar 'car number-alist)) (append-list (elmo-dop-append-list-load folder)) @@ -339,10 +339,10 @@ even an operation concerns the unplugged folder." max-num) (while append-list (if (rassoc (car append-list) number-alist) - (setq alreadies (append alreadies + (setq alreadies (append alreadies (list (car append-list))))) (setq append-list (cdr append-list))) - (setq max-num + (setq max-num (or (nth (max (- (length number-list) 1) 0) number-list) 0)) (cons (- (+ max-num append-num) (length alreadies)) @@ -357,18 +357,18 @@ even an operation concerns the unplugged folder." file-string) (while append-list (when (setq file-string (elmo-get-file-string ; message string - (elmo-cache-get-path + (elmo-cache-get-path (car append-list)))) (elmo-append-msg elmo-lost+found-folder file-string) (elmo-dop-unlock-message (car append-list))) (setq append-list (cdr append-list)) (elmo-dop-append-list-save folder nil))) - (message (format "Saving queued message in %s...done." + (message (format "Saving queued message in %s...done." elmo-lost+found-folder))) (defun elmo-dop-flush-pending-append-operations (folder &optional appends resume) (message "Appending queued messages...") - (let* ((append-list (or appends + (let* ((append-list (or appends (elmo-dop-append-list-load folder))) (appendings append-list) (i 0) @@ -377,7 +377,7 @@ even an operation concerns the unplugged folder." (when resume ;; Resume msgdb changed by elmo-dop-msgdb-create. (let* ((resumed-list (elmo-dop-append-list-load folder t)) - (number-alist (elmo-msgdb-number-load + (number-alist (elmo-msgdb-number-load (elmo-msgdb-expand-path folder))) (appendings append-list) pair dels) @@ -390,7 +390,7 @@ even an operation concerns the unplugged folder." (while appendings (setq failure nil) (setq file-string (elmo-get-file-string ; message string - (elmo-cache-get-path + (elmo-cache-get-path (car appendings)))) (when file-string (condition-case () @@ -444,7 +444,7 @@ even an operation concerns the unplugged folder." (insert string) (elmo-cache-save message-id nil folder msg (current-buffer)))) (let ((append-list (elmo-dop-append-list-load folder)) - (number-alist (elmo-msgdb-number-load + (number-alist (elmo-msgdb-number-load (elmo-msgdb-expand-path folder)))) (when (and ; not in current folder. (not (rassoc message-id number-alist)) @@ -466,7 +466,7 @@ even an operation concerns the unplugged folder." (if (or (eq (elmo-folder-get-type folder) 'imap4) (eq (elmo-folder-get-type folder) 'nntp)) (if elmo-enable-disconnected-operation - (let* ((num-alist (elmo-msgdb-number-load + (let* ((num-alist (elmo-msgdb-number-load (elmo-msgdb-expand-path folder))) (number-list (mapcar 'car num-alist)) (ov (elmo-msgdb-overview-load @@ -481,7 +481,7 @@ even an operation concerns the unplugged folder." 0)) (while numlist (if (setq msgid - (nth (+ (length append-list) + (nth (+ (length append-list) (- (car numlist) max-num 1 num)) append-list)) (progn @@ -497,7 +497,7 @@ even an operation concerns the unplugged folder." (setq seen (member msgid seen-list)) (if (setq gmark (or (elmo-msgdb-global-mark-get msgid) - (if (elmo-cache-exists-p + (if (elmo-cache-exists-p msgid folder (car number-alist)) @@ -511,7 +511,7 @@ even an operation concerns the unplugged folder." (elmo-msgdb-mark-append mark-alist (car numlist) gmark)))) - (when (setq ov-entity (assoc + (when (setq ov-entity (assoc (cdr (assq (car numlist) num-alist)) ov)) (setq overview diff --git a/elmo/elmo-filter.el b/elmo/elmo-filter.el index cd17d38..810a314 100644 --- a/elmo/elmo-filter.el +++ b/elmo/elmo-filter.el @@ -30,11 +30,11 @@ ;; (require 'elmo-msgdb) -(defun elmo-filter-msgdb-create (spec numlist new-mark already-mark +(defun elmo-filter-msgdb-create (spec numlist new-mark already-mark seen-mark important-mark seen-list) (if (eq (nth 2 spec) 'partial) (elmo-msgdb-create (nth 2 spec) - numlist + numlist new-mark already-mark seen-mark important-mark seen-list) @@ -45,7 +45,7 @@ seen-mark important-mark seen-list))) (defun elmo-filter-msgdb-create-as-numlist (spec numlist new-mark already-mark - seen-mark important-mark + seen-mark important-mark seen-list) (elmo-msgdb-create-as-numlist (nth 2 spec) numlist @@ -69,12 +69,12 @@ (let ((filter (nth 1 spec)) (folder (nth 2 spec)) msgs) - (cond + (cond ((vectorp filter) (cond ((string= (elmo-filter-key filter) "last") (setq msgs (elmo-list-folder folder)) - (nthcdr (max (- (length msgs) + (nthcdr (max (- (length msgs) (string-to-int (elmo-filter-value filter))) 0) msgs)) @@ -83,7 +83,7 @@ (setq msgs (elmo-list-folder folder)) (let ((rest (nthcdr (string-to-int (elmo-filter-value filter) ) msgs))) - (mapcar '(lambda (x) + (mapcar '(lambda (x) (delete x msgs)) rest)) msgs))) ((listp filter) @@ -93,13 +93,13 @@ (let ((filter (nth 1 spec)) (folder (nth 2 spec)) msgs pair) - (cond + (cond ((vectorp filter) (cond ((string= (elmo-filter-key filter) "last") - (setq msgs (elmo-list-folder-unread folder mark-alist + (setq msgs (elmo-list-folder-unread folder mark-alist unread-marks)) - (nthcdr (max (- (length msgs) + (nthcdr (max (- (length msgs) (string-to-int (elmo-filter-value filter))) 0) msgs)) @@ -110,11 +110,11 @@ unread-marks)) (let ((rest (nthcdr (string-to-int (elmo-filter-value filter) ) msgs))) - (mapcar '(lambda (x) + (mapcar '(lambda (x) (delete x msgs)) rest)) msgs))) ((listp filter) - (elmo-list-filter + (elmo-list-filter (elmo-search folder filter) (elmo-list-folder-unread folder mark-alist unread-marks)))))) @@ -122,12 +122,12 @@ (let ((filter (nth 1 spec)) (folder (nth 2 spec)) msgs pair) - (cond + (cond ((vectorp filter) (cond ((string= (elmo-filter-key filter) "last") (setq msgs (elmo-list-folder-important folder overview)) - (nthcdr (max (- (length msgs) + (nthcdr (max (- (length msgs) (string-to-int (elmo-filter-value filter))) 0) msgs)) @@ -136,11 +136,11 @@ (setq msgs (elmo-list-folder-important folder overview)) (let ((rest (nthcdr (string-to-int (elmo-filter-value filter) ) msgs))) - (mapcar '(lambda (x) + (mapcar '(lambda (x) (delete x msgs)) rest)) msgs))) ((listp filter) - (elmo-list-filter + (elmo-list-filter (mapcar '(lambda (x) (elmo-msgdb-overview-entity-get-number x)) overview) @@ -160,9 +160,9 @@ (defun elmo-filter-search (spec condition &optional numlist) ;; search from messages in this folder - (elmo-list-filter - numlist - (elmo-call-func (nth 2 spec) "search" condition + (elmo-list-filter + numlist + (elmo-call-func (nth 2 spec) "search" condition (elmo-filter-list-folder spec)))) (defun elmo-filter-use-cache-p (spec number) diff --git a/elmo/elmo-imap4.el b/elmo/elmo-imap4.el index 7250d6f..308599e 100644 --- a/elmo/elmo-imap4.el +++ b/elmo/elmo-imap4.el @@ -47,9 +47,9 @@ (require 'sasl)) (error)) (defun-maybe sasl-cram-md5 (username passphrase challenge)) - (defun-maybe sasl-digest-md5-digest-response + (defun-maybe sasl-digest-md5-digest-response (digest-challenge username passwd serv-type host &optional realm)) - (defun-maybe starttls-negotiate (a)) + (defun-maybe starttls-negotiate (a)) (defun-maybe elmo-generic-list-folder-unread (spec mark-alist unread-marks)) (defsubst-maybe utf7-decode-string (string &optional imap) string)) @@ -78,9 +78,9 @@ (defvar elmo-imap4-lock nil) -;; For debugging. +;; For debugging. (defvar elmo-imap4-debug nil - "Non-nil forces IMAP4 folder as debug mode. + "Non-nil forces IMAP4 folder as debug mode. Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (defsubst elmo-imap4-debug (message &rest args) @@ -112,15 +112,15 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (insert string) (goto-char (point-min)) ;; XXX This doesn't consider literal name response. - (while (re-search-forward + (while (re-search-forward "\\* LIST (\\([^)]*\\)) \"[^\"]*\" \\([^\n]*\\)$" nil t) (unless (string-match "noselect" (elmo-match-buffer 1)) (setq val (elmo-match-buffer 2)) (if (string-match "^\"\\(.*\\)\"$" val) - (setq val (match-string 1 val))) - (setq mailbox-list - (append mailbox-list + (setq val (match-string 1 val))) + (setq mailbox-list + (append mailbox-list (list val))))) mailbox-list))) @@ -140,12 +140,12 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") ;; Append delimiter (if (and root (not (string= root "")) - (not (string-match (concat "\\(.*\\)" + (not (string-match (concat "\\(.*\\)" (regexp-quote delim) "\\'") root))) (setq root (concat root delim))) - (elmo-imap4-send-command (process-buffer process) + (elmo-imap4-send-command (process-buffer process) process (format "list \"%s\" *" root)) (setq response (elmo-imap4-read-response (process-buffer process) @@ -154,14 +154,14 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (unless (string= (elmo-imap4-spec-username spec) elmo-default-imap4-user) (setq append-serv (concat ":" (elmo-imap4-spec-username spec)))) - (unless (string= (elmo-imap4-spec-hostname spec) + (unless (string= (elmo-imap4-spec-hostname spec) elmo-default-imap4-server) (setq append-serv (concat append-serv "@" (elmo-imap4-spec-hostname spec)))) (unless (eq (elmo-imap4-spec-port spec) elmo-default-imap4-port) - (setq append-serv (concat append-serv ":" - (int-to-string + (setq append-serv (concat append-serv ":" + (int-to-string (elmo-imap4-spec-port spec))))) (unless (eq (setq ssl (elmo-imap4-spec-ssl spec)) elmo-default-imap4-ssl) @@ -171,7 +171,7 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (setq append-serv (concat append-serv "!")))) (mapcar '(lambda (fld) (concat "%" (elmo-imap4-decode-folder-string fld) - (and append-serv + (and append-serv (eval append-serv)))) result)))) @@ -249,7 +249,7 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (elmo-imap4-spec-folder spec))) (setq response (elmo-imap4-read-response (process-buffer process) process)) - (when (and response (string-match + (when (and response (string-match "\\* STATUS [^(]* \\(([^)]*)\\)" response)) (setq response (read (downcase (elmo-match-string 1 response)))) (cons (- (cadr (memq 'uidnext response)) 1) @@ -266,24 +266,24 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") user-at-host-on-port) (if (not (elmo-plugged-p server port)) (error "Unplugged")) - (setq user-at-host-on-port + (setq user-at-host-on-port (concat user-at-host ":" (int-to-string port) (if (eq ssl 'starttls) "!!" (if ssl "!")))) (setq ret-val (assoc user-at-host-on-port elmo-imap4-connection-cache)) - (if (and ret-val - (or (eq (setq proc-stat - (process-status (cadr (cdr ret-val)))) + (if (and ret-val + (or (eq (setq proc-stat + (process-status (cadr (cdr ret-val)))) 'closed) (eq proc-stat 'exit))) ;; connection is closed... (progn (kill-buffer (car (cdr ret-val))) - (setq elmo-imap4-connection-cache + (setq elmo-imap4-connection-cache (delete ret-val elmo-imap4-connection-cache)) (setq ret-val nil))) (if ret-val - (progn + (progn (setq ret-val (cdr ret-val)) ;; connection cache exists. ret-val) (setq result @@ -299,25 +299,25 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (elmo-remove-passwd user-at-host) (delete-process process) (error "Login failed")) - (setq elmo-imap4-connection-cache - (append elmo-imap4-connection-cache - (list + (setq elmo-imap4-connection-cache + (append elmo-imap4-connection-cache + (list (cons user-at-host-on-port - (setq ret-val (list buffer process + (setq ret-val (list buffer process ""; current-folder.. )))))) ret-val))) (defun elmo-imap4-process-filter (process output) - (save-match-data + (save-match-data (with-current-buffer (process-buffer process) (goto-char (point-max)) (insert output) (forward-line -1) (beginning-of-line) - (if (looking-at (concat - "\\(^" - elmo-imap4-seq-prefix + (if (looking-at (concat + "\\(^" + elmo-imap4-seq-prefix (int-to-string elmo-imap4-seqno) "\\|^\\* OK\\|^\\* BYE\\'\\|^\\+\\)[^\n]*\n\\'")) (progn @@ -344,15 +344,15 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (setq response-string (buffer-substring elmo-imap4-read-point (- match-end 2))) (goto-char elmo-imap4-read-point) - (if (looking-at (format "%s[0-9]+ OK.*$\\|\\+.*$" + (if (looking-at (format "%s[0-9]+ OK.*$\\|\\+.*$" elmo-imap4-seq-prefix)) (progn (setq response-continue nil) (setq elmo-imap4-read-point match-end) - (setq return-value - (if return-value + (setq return-value + (if return-value (concat return-value "\n" response-string) response-string))) - (if (looking-at (format "\\(. BYE.*\\|%s[0-9]+ \\(NO\\|BAD\\).*\\)$" + (if (looking-at (format "\\(. BYE.*\\|%s[0-9]+ \\(NO\\|BAD\\).*\\)$" elmo-imap4-seq-prefix)) (progn (setq response-continue nil) (setq elmo-imap4-read-point match-end) @@ -361,8 +361,8 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (setq elmo-imap4-read-point match-end) (if not-command (setq response-continue nil)) - (setq return-value - (if return-value + (setq return-value + (if return-value (concat return-value "\n" response-string) response-string))) (setq elmo-imap4-read-point match-end))) @@ -376,15 +376,15 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (response-string nil) match-end) (goto-char elmo-imap4-read-point) - (while (not (re-search-forward - (format "%s[0-9]+ \\(NO\\|BAD\\|OK\\).*$" + (while (not (re-search-forward + (format "%s[0-9]+ \\(NO\\|BAD\\|OK\\).*$" elmo-imap4-seq-prefix) nil t)) (accept-process-output process) (goto-char elmo-imap4-read-point)) (beginning-of-line) (setq match-end (point)) - (setq response-string (buffer-substring + (setq response-string (buffer-substring elmo-imap4-read-point match-end)) (if (eq (length response-string) 0) nil @@ -410,7 +410,7 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (with-current-buffer buffer (setq start elmo-imap4-read-point) (while (< (point-max) (+ start bytes)) - (accept-process-output process)) + (accept-process-output process)) (with-current-buffer outbuf (erase-buffer) (insert-buffer-substring buffer start (+ start bytes)) @@ -422,7 +422,7 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (let ((buffer (car connection)) (process (cadr connection))) (save-excursion - (elmo-imap4-send-command buffer + (elmo-imap4-send-command buffer process "noop") (elmo-imap4-read-response buffer process)))) @@ -431,23 +431,23 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (let ((connection (elmo-imap4-get-connection spec)) response ret-val beg end) (and (not (null (elmo-imap4-spec-folder spec))) - (if (not (string= (elmo-imap4-connection-get-cwf connection) + (if (not (string= (elmo-imap4-connection-get-cwf connection) (elmo-imap4-spec-folder spec))) - (if (null (setq response - (elmo-imap4-select-folder + (if (null (setq response + (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) connection))) (error "Select folder failed")) (if elmo-imap4-use-select-to-update-status - (elmo-imap4-select-folder + (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) - connection) + connection) (elmo-imap4-check connection))))))) (defun elmo-imap4-check (connection) (let ((process (elmo-imap4-connection-get-process connection))) (save-excursion - (elmo-imap4-send-command (process-buffer process) + (elmo-imap4-send-command (process-buffer process) process "check") (elmo-imap4-read-response (process-buffer process) process)))) @@ -458,9 +458,9 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (unwind-protect (progn (elmo-imap4-send-command (process-buffer process) - process (format "select \"%s\"" + process (format "select \"%s\"" folder)) - (setq response (elmo-imap4-read-response + (setq response (elmo-imap4-read-response (process-buffer process) process))) (if (null response) (progn @@ -475,10 +475,10 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") response) (save-excursion (elmo-imap4-send-command (process-buffer process) - process - (format "status \"%s\" (uidvalidity)" + process + (format "status \"%s\" (uidvalidity)" (elmo-imap4-spec-folder spec))) - (setq response (elmo-imap4-read-response + (setq response (elmo-imap4-read-response (process-buffer process) process)) (if (string-match "UIDVALIDITY \\([0-9]+\\)" response) (string= (elmo-get-file-string validity-file) @@ -491,10 +491,10 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") response) (save-excursion (elmo-imap4-send-command (process-buffer process) - process - (format "status \"%s\" (uidvalidity)" + process + (format "status \"%s\" (uidvalidity)" (elmo-imap4-spec-folder spec))) - (setq response (elmo-imap4-read-response + (setq response (elmo-imap4-read-response (process-buffer process) process)) (if (string-match "UIDVALIDITY \\([0-9]+\\)" response) (progn @@ -512,22 +512,22 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (and (elmo-imap4-spec-folder spec) (if (not (string= (elmo-imap4-connection-get-cwf connection) (elmo-imap4-spec-folder spec))) - (if (null (setq response - (elmo-imap4-select-folder + (if (null (setq response + (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) connection))) (error "Select folder failed")) ;; for status update. (if elmo-imap4-use-select-to-update-status - (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) + (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) connection) (unless (elmo-imap4-check connection) ;; Check failed...not selected?? - (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) + (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) connection))))) (elmo-imap4-send-command (process-buffer process) process - (format (if elmo-imap4-use-uid + (format (if elmo-imap4-use-uid "uid search %s" "search %s") str)) (setq response (elmo-imap4-read-response (process-buffer process) @@ -538,8 +538,8 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (if (string-match "\n" response) (progn (setq end (match-end 0)) - (setq ret-val (read (concat "(" (substring - response + (setq ret-val (read (concat "(" (substring + response 0 end) ")")))) (error "SEARCH failed")))) ret-val))) @@ -564,21 +564,21 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (string= "before" search-key)) (setq search-key (concat "sent" search-key)) (elmo-imap4-send-command buffer process - (format + (format (if elmo-imap4-use-uid - "uid search %s %s" + "uid search %s %s" " search %s %s") search-key (elmo-date-get-description - (elmo-date-get-datevec + (elmo-date-get-datevec (elmo-filter-value filter)))))) (t - (setq word (encode-mime-charset-string (elmo-filter-value filter) + (setq word (encode-mime-charset-string (elmo-filter-value filter) elmo-search-mime-charset)) - (elmo-imap4-send-command buffer process - (format + (elmo-imap4-send-command buffer process + (format (if elmo-imap4-use-uid - "uid search CHARSET %s%s %s {%d}" + "uid search CHARSET %s%s %s {%d}" " search CHARSET %s%s %s {%d}") (symbol-name elmo-search-mime-charset) (if (eq (elmo-filter-type filter) 'unmatch) @@ -602,7 +602,7 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (if (and (elmo-imap4-spec-folder spec) (not (string= (elmo-imap4-connection-get-cwf connection) (elmo-imap4-spec-folder spec))) - (null (elmo-imap4-select-folder + (null (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) connection))) (error "Select folder failed")) (while condition @@ -612,7 +612,7 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (setq ret-val (nconc ret-val response)) (setq condition (cdr condition))) (if from-msgs - (elmo-list-filter + (elmo-list-filter from-msgs (elmo-uniq-list (sort ret-val '<))) (elmo-uniq-list (sort ret-val '<)))))) @@ -637,14 +637,14 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (t (concat mbox "@" host)))) -(static-cond +(static-cond ((fboundp 'float) ;; Emacs can parse dot symbol. (defvar elmo-imap4-rfc822-size "RFC822\.SIZE") (defvar elmo-imap4-header-fields "HEADER\.FIELDS") (defmacro elmo-imap4-replace-dot-symbols ()) ;; noop ) - (t + (t ;; Cannot parse dot symbol, replace it. (defvar elmo-imap4-rfc822-size "RFC822_SIZE") (defvar elmo-imap4-header-fields "HEADER_FIELDS") @@ -667,10 +667,10 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (goto-char (point-min)) (while (re-search-forward "{\\([0-9]+\\)}\r\n" nil t) (let (str) - (goto-char (+ (point) + (goto-char (+ (point) (string-to-int (elmo-match-buffer 1)))) - (setq str (save-match-data - (elmo-replace-in-string + (setq str (save-match-data + (elmo-replace-in-string (buffer-substring (match-end 0) (point)) "\r" ""))) (delete-region (match-beginning 0) (point)) @@ -689,14 +689,14 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (insert string) (goto-char (point-min)) (setq beg (point)) - (if (re-search-forward "^\* \\([0-9]+\\) FETCH" + (if (re-search-forward "^\* \\([0-9]+\\) FETCH" nil t) (progn (setq beg (point)) (unless elmo-imap4-use-uid (setq number (string-to-int (elmo-match-buffer 1)))) - (while (re-search-forward - "^\* \\([0-9]+\\) FETCH" + (while (re-search-forward + "^\* \\([0-9]+\\) FETCH" nil t) (setq attr (elmo-imap4-make-attributes-object (buffer-substring beg (match-beginning 0)))) @@ -754,7 +754,7 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") ((eq sym 'BODY) (setq extra-fields (elmo-collect-field-from-string value t))) ((eq sym 'ENVELOPE) - ;; According to rfc2060, + ;; According to rfc2060, ;; 0 date, 1 subject, 2 from, 3 sender, ;; 4 reply-to, 5 to, 6 cc, 7 bcc, 8 in-reply-to, 9 message-id. (setq date-string (elmo-imap4-nth 0 value)) @@ -765,7 +765,7 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (and (or (elmo-imap4-nth 0 from-list) (elmo-imap4-nth 2 from-list) (elmo-imap4-nth 3 from-list)) - (elmo-delete-char + (elmo-delete-char ?\" (elmo-imap4-make-address (elmo-imap4-nth 0 from-list) @@ -786,7 +786,7 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (elmo-imap4-nth 0 cc) (elmo-imap4-nth 2 cc) (elmo-imap4-nth 3 cc))) - (elmo-imap4-nth 6 value) ",")) + (elmo-imap4-nth 6 value) ",")) (setq reference (elmo-msgdb-get-last-message-id (elmo-imap4-nth 8 value))) (setq message-id (elmo-imap4-nth 9 value))))) @@ -835,7 +835,7 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") entity found) (while (and elist (not found)) (setq entity (car elist)) - (cond + (cond ((and (consp entity) (eq (+ 1 (cdr entity)) msg)) (setcdr entity msg) @@ -845,7 +845,7 @@ Debug information is inserted in the buffer \"*IMAP4 DEBUG*\"") (setcar elist (cons entity msg)) (setq found t)) ((or (and (integerp entity) (eq entity msg)) - (and (consp entity) + (and (consp entity) (<= (car entity) msg) (<= msg (cdr entity)))) ; included (setq found t))); noop @@ -870,12 +870,12 @@ If CHOP-LENGTH is not specified, message set is not chopped." (setq chop-length (length msg-list))) (while (and (not (null msg-list)) (< count chop-length)) - (setq cont-list - (elmo-imap4-add-to-cont-list + (setq cont-list + (elmo-imap4-add-to-cont-list cont-list (car msg-list))) (incf count) (setq msg-list (cdr msg-list))) - (setq set-list + (setq set-list (cons (cons count @@ -907,15 +907,15 @@ If optional argument UNMARK is non-nil, unmark." (if (and (elmo-imap4-spec-folder spec) (not (string= (elmo-imap4-connection-get-cwf connection) (elmo-imap4-spec-folder spec))) - (null (elmo-imap4-select-folder + (null (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) connection))) (error "Select folder failed")) (setq set-list (elmo-imap4-make-number-set-list msg-list)) (when set-list (elmo-imap4-send-command (process-buffer process) process - (format - (if elmo-imap4-use-uid + (format + (if elmo-imap4-use-uid "uid store %s %sflags.silent (%s)" "store %s %sflags.silent (%s)") (cdr (car set-list)) @@ -924,7 +924,7 @@ If optional argument UNMARK is non-nil, unmark." (unless (elmo-imap4-read-response (process-buffer process) process) (error "Store %s flag failed" mark)) (unless no-expunge - (elmo-imap4-send-command + (elmo-imap4-send-command (process-buffer process) process "expunge") (unless (elmo-imap4-read-response (process-buffer process) process) (error "Expunge failed")))) @@ -940,7 +940,7 @@ If optional argument UNMARK is non-nil, unmark." (defun elmo-imap4-unmark-important (spec msgs) (and (elmo-imap4-use-flag-p spec) - (elmo-imap4-mark-set-on-msgs spec msgs "\\Flagged" 'unmark + (elmo-imap4-mark-set-on-msgs spec msgs "\\Flagged" 'unmark 'no-expunge))) (defun elmo-imap4-mark-as-unread (spec msgs) @@ -953,14 +953,14 @@ If optional argument UNMARK is non-nil, unmark." (defun elmo-imap4-delete-msgs-no-expunge (spec msgs) (elmo-imap4-mark-set-on-msgs spec msgs "\\Deleted" nil 'no-expunge)) -(defun elmo-imap4-msgdb-create-as-numlist (spec numlist new-mark already-mark - seen-mark important-mark +(defun elmo-imap4-msgdb-create-as-numlist (spec numlist new-mark already-mark + seen-mark important-mark seen-list) "Create msgdb for SPEC for NUMLIST." (elmo-imap4-msgdb-create spec numlist new-mark already-mark seen-mark important-mark seen-list t)) -(defun elmo-imap4-msgdb-create (spec numlist new-mark already-mark seen-mark +(defun elmo-imap4-msgdb-create (spec numlist new-mark already-mark seen-mark important-mark seen-list &optional as-num) "Create msgdb for SPEC." (when numlist @@ -983,23 +983,23 @@ If optional argument UNMARK is non-nil, unmark." (error "No IMAP4 capability!!"))))) (setq count 0) (setq length (length numlist)) - (setq set-list (elmo-imap4-make-number-set-list + (setq set-list (elmo-imap4-make-number-set-list numlist elmo-imap4-overview-fetch-chop-length)) (message "Getting overview...") (if (and (elmo-imap4-spec-folder spec) (not (string= (elmo-imap4-connection-get-cwf connection) (elmo-imap4-spec-folder spec))) - (null (elmo-imap4-select-folder + (null (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) connection))) - (error "Select imap folder %s failed" + (error "Select imap folder %s failed" (elmo-imap4-spec-folder spec))) (while set-list - (elmo-imap4-send-command + (elmo-imap4-send-command (process-buffer process) process ;; get overview entity from IMAP4 - (format + (format (if rfc2060 (concat (if elmo-imap4-use-uid "uid " "") @@ -1014,9 +1014,9 @@ If optional argument UNMARK is non-nil, unmark." (with-current-buffer (process-buffer process) (if ov-str (setq ret-val - (elmo-msgdb-append + (elmo-msgdb-append ret-val - (elmo-imap4-create-msgdb-from-overview-string + (elmo-imap4-create-msgdb-from-overview-string ov-str (elmo-imap4-spec-folder spec) new-mark already-mark seen-mark important-mark @@ -1025,17 +1025,17 @@ If optional argument UNMARK is non-nil, unmark." (setq ov-str (elmo-imap4-read-contents (process-buffer process) process)) (elmo-display-progress - 'elmo-imap4-msgdb-create "Getting overview..." + 'elmo-imap4-msgdb-create "Getting overview..." (/ (* count 100) length)) (setq set-list (cdr set-list))) ;; process last one. (with-current-buffer (process-buffer process) (if ov-str (setq ret-val - (elmo-msgdb-append + (elmo-msgdb-append ret-val - (elmo-imap4-create-msgdb-from-overview-string - ov-str + (elmo-imap4-create-msgdb-from-overview-string + ov-str (elmo-imap4-spec-folder spec) new-mark already-mark seen-mark important-mark seen-list filter))))) @@ -1063,7 +1063,7 @@ If optional argument UNMARK is non-nil, unmark." (setq prefix (elmo-imap4-nth 0 (car cur))) (setq delim (elmo-imap4-nth 1 (car cur))) (if (and prefix delim - (string-match (concat "\\(.*\\)" + (string-match (concat "\\(.*\\)" (regexp-quote delim) "\\'") prefix)) @@ -1082,7 +1082,7 @@ If optional argument UNMARK is non-nil, unmark." (length (car y)))))))) (defun elmo-imap4-open-connection (imap4-server user auth port passphrase ssl) - "Open Imap connection and returns + "Open Imap connection and returns the list of (process session-buffer current-working-folder). Return nil if connection failed." (let ((process nil) @@ -1094,7 +1094,7 @@ Return nil if connection failed." (get-buffer-create (format " *IMAP session to %s:%d" host port))) (save-excursion (set-buffer process-buffer) - (elmo-set-buffer-multibyte nil) + (elmo-set-buffer-multibyte nil) (make-variable-buffer-local 'elmo-imap4-server-capability) (make-variable-buffer-local 'elmo-imap4-lock) (erase-buffer)) @@ -1125,8 +1125,8 @@ Return nil if connection failed." (setq response (elmo-imap4-read-response process-buffer process))) - (string-match - (concat "^\\(" elmo-imap4-seq-prefix + (string-match + (concat "^\\(" elmo-imap4-seq-prefix (int-to-string elmo-imap4-seqno) "\\|\\*\\) OK") response)) @@ -1139,16 +1139,16 @@ Return nil if connection failed." (and (string= "digest-md5" auth) (not (memq 'auth=digest-md5 capability)))) (if (or elmo-imap4-force-login - (y-or-n-p - (format + (y-or-n-p + (format "There's no %s capability in server. continue?" auth))) (setq auth "login") (error "Login aborted"))) - (cond + (cond ((string= "auth" auth) (elmo-imap4-send-command process-buffer process "authenticate login" 'no-lock) - ;; Base64 + ;; Base64 (when (null (elmo-imap4-read-response process-buffer process t)) (setq ret-val (cons nil process)) (throw 'done nil)) @@ -1164,28 +1164,28 @@ Return nil if connection failed." (throw 'done nil)) (setq ret-val (cons process-buffer process))) ((string= "cram-md5" auth) - (elmo-imap4-send-command + (elmo-imap4-send-command process-buffer process "authenticate cram-md5" 'no-lock) - (when (null (setq response - (elmo-imap4-read-response + (when (null (setq response + (elmo-imap4-read-response process-buffer process t))) (setq ret-val (cons nil process)) (throw 'done nil)) (setq response (cadr (split-string response " "))) (elmo-imap4-send-string - process-buffer process + process-buffer process (elmo-base64-encode-string - (sasl-cram-md5 user passphrase + (sasl-cram-md5 user passphrase (elmo-base64-decode-string response)))) (when (null (elmo-imap4-read-response process-buffer process)) (setq ret-val (cons nil process)) (throw 'done nil)) (setq ret-val (cons process-buffer process))) ((string= "digest-md5" auth) - (elmo-imap4-send-command + (elmo-imap4-send-command process-buffer process "authenticate digest-md5" 'no-lock) (when (null (setq response - (elmo-imap4-read-response + (elmo-imap4-read-response process-buffer process t))) (setq ret-val (cons nil process)) (throw 'done nil)) @@ -1207,11 +1207,11 @@ Return nil if connection failed." (throw 'done nil)) (setq ret-val (cons process-buffer process))) (t ;; not auth... try login - (elmo-imap4-send-command - process-buffer process - (format "login %s \"%s\"" user + (elmo-imap4-send-command + process-buffer process + (format "login %s \"%s\"" user (elmo-replace-in-string passphrase - "\"" "\\\\\"")) + "\"" "\\\\\"")) nil 'no-log) ;; No LOGGING. (if (null (elmo-imap4-read-response process-buffer process)) (setq ret-val (cons nil process)) @@ -1237,7 +1237,7 @@ Return nil if connection failed." (elmo-set-buffer-multibyte nil) (insert string) (goto-char (point-min)) - (if (eq (re-search-forward "^$" nil t) + (if (eq (re-search-forward "^$" nil t) (point-max)) (insert "\n")) (goto-char (point-min)) @@ -1263,8 +1263,8 @@ Return nil if connection failed." (elmo-imap4-debug "lock(%d): (No-logging command)." (+ elmo-imap4-seqno 1)) (elmo-imap4-debug "lock(%d): %s" (+ elmo-imap4-seqno 1) command)) (setq elmo-imap4-lock t)) - (process-send-string process (concat (format "%s%d " - elmo-imap4-seq-prefix + (process-send-string process (concat (format "%s%d " + elmo-imap4-seq-prefix (elmo-imap4-get-seqno)) command)) (process-send-string process "\r\n"))) @@ -1288,25 +1288,25 @@ Return nil if connection failed." (when (elmo-imap4-spec-folder spec) (when (not (string= (elmo-imap4-connection-get-cwf connection) (elmo-imap4-spec-folder spec))) - (if (null (setq response - (elmo-imap4-select-folder + (if (null (setq response + (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) connection))) (error "Select folder failed"))) (elmo-imap4-send-command (process-buffer process) process - (format - (if elmo-imap4-use-uid + (format + (if elmo-imap4-use-uid "uid fetch %s body.peek[%s]" "fetch %s body.peek[%s]") msg part)) - (if (null (setq response (elmo-imap4-read-response - (process-buffer process) + (if (null (setq response (elmo-imap4-read-response + (process-buffer process) process t))) (error "Fetch failed")) (save-match-data (while (string-match "^\\* OK" response) - (if (null (setq response (elmo-imap4-read-response - (process-buffer process) + (if (null (setq response (elmo-imap4-read-response + (process-buffer process) process t))) (error "Fetch failed")))) (save-match-data @@ -1315,7 +1315,7 @@ Return nil if connection failed." (string-to-int (elmo-match-string 1 response))) (error "Fetch failed"))) - (if (null (setq response (elmo-imap4-read-bytes + (if (null (setq response (elmo-imap4-read-bytes (process-buffer process) process bytes))) (error "Fetch message failed")) (setq ret-val response) @@ -1326,7 +1326,7 @@ Return nil if connection failed." (defun elmo-imap4-prefetch-msg (spec msg outbuf) (elmo-imap4-read-msg spec msg outbuf 'unseen)) -(defun elmo-imap4-read-msg (spec msg outbuf +(defun elmo-imap4-read-msg (spec msg outbuf &optional leave-seen-flag-untouched) (save-excursion (let* ((connection (elmo-imap4-get-connection spec)) @@ -1336,28 +1336,28 @@ Return nil if connection failed." (when (elmo-imap4-spec-folder spec) (when (not (string= (elmo-imap4-connection-get-cwf connection) (elmo-imap4-spec-folder spec))) - (if (null (setq response - (elmo-imap4-select-folder - (elmo-imap4-spec-folder spec) + (if (null (setq response + (elmo-imap4-select-folder + (elmo-imap4-spec-folder spec) connection))) (error "Select folder failed"))) (elmo-imap4-send-command (process-buffer process) process - (format - (if elmo-imap4-use-uid - "uid fetch %s body%s[]" + (format + (if elmo-imap4-use-uid + "uid fetch %s body%s[]" "fetch %s body%s[]") msg (if leave-seen-flag-untouched ".peek" ""))) - (if (null (setq response (elmo-imap4-read-response + (if (null (setq response (elmo-imap4-read-response (process-buffer process) process t))) (error "Fetch failed")) (save-match-data (while (string-match "^\\* OK" response) - (if (null (setq response (elmo-imap4-read-response - (process-buffer process) + (if (null (setq response (elmo-imap4-read-response + (process-buffer process) process t))) (error "Fetch failed")))) (save-match-data @@ -1366,16 +1366,16 @@ Return nil if connection failed." (string-to-int (elmo-match-string 1 response))) (error "Fetch failed"))) - (setq ret-val (elmo-imap4-read-body - (process-buffer process) + (setq ret-val (elmo-imap4-read-body + (process-buffer process) process bytes outbuf)) - (elmo-imap4-read-response (process-buffer process) + (elmo-imap4-read-response (process-buffer process) process)) ;; ignore remaining.. ) ret-val))) (defun elmo-imap4-setup-send-buffer-from-file (file) - (let ((tmp-buf (get-buffer-create + (let ((tmp-buf (get-buffer-create " *elmo-imap4-setup-send-buffer-from-file*"))) (save-excursion (save-match-data @@ -1384,9 +1384,9 @@ Return nil if connection failed." (as-binary-input-file (insert-file-contents file)) (goto-char (point-min)) - (if (eq (re-search-forward "^$" nil t) + (if (eq (re-search-forward "^$" nil t) (point-max)) - (insert "\n")) + (insert "\n")) (goto-char (point-min)) (while (search-forward "\n" nil t) (replace-match "\r\n")))) @@ -1404,7 +1404,7 @@ Return nil if connection failed." (setq message-ids (cdr message-ids))) (let* ((connection (elmo-imap4-get-connection spec)) (process (elmo-imap4-connection-get-process connection))) - (elmo-imap4-send-command (process-buffer process) + (elmo-imap4-send-command (process-buffer process) process "expunge") (if (null (elmo-imap4-read-response (process-buffer process) process)) @@ -1419,21 +1419,21 @@ Return nil if connection failed." (if (and (elmo-imap4-spec-folder spec) (not (string= (elmo-imap4-connection-get-cwf connection) (elmo-imap4-spec-folder spec))) - (null (elmo-imap4-select-folder - (elmo-imap4-spec-folder spec) + (null (elmo-imap4-select-folder + (elmo-imap4-spec-folder spec) connection))) (error "Select folder failed")) (save-excursion (elmo-imap4-send-command (process-buffer process) process - (format - (if elmo-imap4-use-uid + (format + (if elmo-imap4-use-uid "uid search header message-id \"%s\"" "search header message-id \"%s\"") msgid)) - (setq response (elmo-imap4-read-response + (setq response (elmo-imap4-read-response (process-buffer process) process)) - (if (and response + (if (and response (string-match "^\\* SEARCH\\([^\n]*\\)$" response)) (setq msgs (read (concat "(" (elmo-match-string 1 response) ")"))) (error "SEARCH failed")) @@ -1447,11 +1447,11 @@ Return nil if connection failed." (if (and (elmo-imap4-spec-folder spec) (not (string= (elmo-imap4-connection-get-cwf connection) (elmo-imap4-spec-folder spec))) - (null (elmo-imap4-select-folder + (null (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) connection))) (error "Select folder failed")) (save-excursion - (setq send-buf (elmo-imap4-setup-send-buffer-from-file + (setq send-buf (elmo-imap4-setup-send-buffer-from-file (elmo-cache-get-path msgid))) (set-buffer send-buf) (elmo-imap4-send-command (process-buffer process) @@ -1519,8 +1519,8 @@ Return nil if connection failed." (elmo-imap4-send-command (process-buffer process) process (format - (if elmo-imap4-use-uid - "uid copy %s %s" + (if elmo-imap4-use-uid + "uid copy %s %s" "copy %s %s") (car mlist) dst-folder)) (if (null (elmo-imap4-read-response (process-buffer process) @@ -1528,7 +1528,7 @@ Return nil if connection failed." (error "Copy failed") (setq mlist (cdr mlist)))) (when expunge-it - (elmo-imap4-send-command (process-buffer process) + (elmo-imap4-send-command (process-buffer process) process "expunge") (if (null (elmo-imap4-read-response (process-buffer process) process)) @@ -1550,7 +1550,7 @@ Return nil if connection failed." (format "status \"%s\" (unseen messages)" (elmo-imap4-spec-folder spec))) - (setq response (elmo-imap4-read-response + (setq response (elmo-imap4-read-response (process-buffer process) process)) (when (string-match "\\* STATUS [^(]* \\(([^)]*)\\)" response) (setq response (read (downcase (elmo-match-string 1 response)))) diff --git a/elmo/elmo-internal.el b/elmo/elmo-internal.el index 2f7a27f..ce5b186 100644 --- a/elmo/elmo-internal.el +++ b/elmo/elmo-internal.el @@ -46,7 +46,7 @@ (defun elmo-internal-list-folder-by-location (spec location &optional msgdb) (let* ((path (elmo-msgdb-expand-path nil spec)) - (location-alist + (location-alist (if msgdb (elmo-msgdb-get-location msgdb) (elmo-msgdb-location-load path))) @@ -63,7 +63,7 @@ (list (cons (car pair) (car location))))) (setq i (1+ i)) (setq result (append result - (list + (list (cons (+ location-max i) (car location)))))) (setq location (cdr location)))) (setq result (sort result '(lambda (x y) @@ -75,10 +75,10 @@ (mapcar 'car result))) (defun elmo-internal-list-location (directive arg) - (let ((mark-alist + (let ((mark-alist (or elmo-msgdb-global-mark-alist (setq elmo-msgdb-global-mark-alist - (elmo-object-load (expand-file-name + (elmo-object-load (expand-file-name elmo-msgdb-global-mark-filename elmo-msgdb-dir))))) result) @@ -92,16 +92,16 @@ number (elmo-cache-get-path (cdr (assq number loc-alist))))) -(defun elmo-internal-msgdb-create (spec numlist new-mark - already-mark seen-mark - important-mark +(defun elmo-internal-msgdb-create (spec numlist new-mark + already-mark seen-mark + important-mark seen-list &optional msgdb) (when numlist (let* ((directive (nth 1 spec)) (arg (nth 2 spec)) (loc-alist (if msgdb (elmo-msgdb-get-location msgdb) - (elmo-msgdb-location-load (elmo-msgdb-expand-path + (elmo-msgdb-location-load (elmo-msgdb-expand-path nil spec)))) (loc-list (elmo-internal-list-location directive arg)) overview number-alist mark-alist entity @@ -115,7 +115,7 @@ (car numlist) loc-alist)) (if (null entity) () - (setq overview + (setq overview (elmo-msgdb-append-element overview entity)) (setq number-alist @@ -128,14 +128,14 @@ (unless (memq location seen-list) (setq mark-alist (elmo-msgdb-mark-append - mark-alist + mark-alist (elmo-msgdb-overview-entity-get-number entity) ;(nth 0 entity) - (or (elmo-msgdb-global-mark-get + (or (elmo-msgdb-global-mark-get (elmo-msgdb-overview-entity-get-id entity)) - (if (elmo-cache-exists-p + (if (elmo-cache-exists-p (elmo-msgdb-overview-entity-get-id entity)) already-mark @@ -164,7 +164,7 @@ (let* ((msgid (elmo-field-body "message-id")) (path (elmo-cache-get-path msgid)) dir) - (when path + (when path (setq dir (directory-file-name (file-name-directory path))) (if (not (file-exists-p dir)) (elmo-make-directory dir)) @@ -174,7 +174,7 @@ (defun elmo-internal-delete-msgs (spec msgs &optional msgdb) (let ((loc-alist (if msgdb (elmo-msgdb-get-location msgdb) - (elmo-msgdb-location-load (elmo-msgdb-expand-path + (elmo-msgdb-location-load (elmo-msgdb-expand-path nil spec))))) (mapcar '(lambda (msg) (elmo-internal-delete-msg spec msg loc-alist)) @@ -187,7 +187,7 @@ (defun elmo-internal-read-msg (spec number outbuf &optional msgdb) (save-excursion (let* ((loc-alist (if msgdb (elmo-msgdb-get-location msgdb) - (elmo-msgdb-location-load (elmo-msgdb-expand-path + (elmo-msgdb-location-load (elmo-msgdb-expand-path nil spec)))) (file (elmo-cache-get-path (cdr (assq number loc-alist))))) (set-buffer outbuf) @@ -215,15 +215,15 @@ nil) (defun elmo-internal-search (spec condition &optional from-msgs msgdb) - (let* ((mark-alist + (let* ((mark-alist (or elmo-msgdb-global-mark-alist (setq elmo-msgdb-global-mark-alist - (elmo-object-load (expand-file-name + (elmo-object-load (expand-file-name elmo-msgdb-global-mark-filename elmo-msgdb-dir))))) (loc-alist (if msgdb (elmo-msgdb-get-location msgdb) - (elmo-msgdb-location-load (elmo-msgdb-expand-path - nil spec)))) + (elmo-msgdb-location-load (elmo-msgdb-expand-path + nil spec)))) cache-file ret-val case-fold-search msg @@ -251,7 +251,7 @@ ) (defalias 'elmo-internal-sync-number-alist 'elmo-generic-sync-number-alist) -(defalias 'elmo-internal-list-folder-unread +(defalias 'elmo-internal-list-folder-unread 'elmo-generic-list-folder-unread) (defalias 'elmo-internal-list-folder-important 'elmo-generic-list-folder-important) diff --git a/elmo/elmo-localdir.el b/elmo/elmo-localdir.el index a1ea8c8..fb16b14 100644 --- a/elmo/elmo-localdir.el +++ b/elmo/elmo-localdir.el @@ -68,8 +68,8 @@ (when (file-exists-p file) ;; Read until header separator is found. (while (and (eq elmo-localdir-header-chop-length - (nth 1 - (as-binary-input-file + (nth 1 + (as-binary-input-file (insert-file-contents file nil beg (incf beg elmo-localdir-header-chop-length))))) @@ -97,7 +97,7 @@ (elmo-localdir-insert-header file) (error (throw 'done nil))) (goto-char (point-min)) - (setq header-end + (setq header-end (if (re-search-forward "\\(^--.*$\\)\\|\\(\n\n\\)" nil t) (point) (point-max))) @@ -111,8 +111,8 @@ (elmo-localdir-msgdb-create-overview-entity-from-file number (expand-file-name (int-to-string number) dir))) -(defun elmo-localdir-msgdb-create-as-numlist (spec numlist new-mark - already-mark seen-mark +(defun elmo-localdir-msgdb-create-as-numlist (spec numlist new-mark + already-mark seen-mark important-mark seen-list) (when numlist (let ((dir (elmo-localdir-get-folder-directory spec)) @@ -123,12 +123,12 @@ (message "Creating msgdb...") (while numlist (setq entity - (elmo-localdir-msgdb-create-entity + (elmo-localdir-msgdb-create-entity dir (car numlist))) (if (null entity) () (setq num (elmo-msgdb-overview-entity-get-number entity)) - (setq overview + (setq overview (elmo-msgdb-append-element overview entity)) (setq number-alist @@ -140,15 +140,15 @@ (setq seen (member message-id seen-list)) (if (setq gmark (or (elmo-msgdb-global-mark-get message-id) (if (elmo-cache-exists-p message-id) ; XXX - (if seen + (if seen nil already-mark) - (if seen + (if seen nil ;;seen-mark new-mark)))) (setq mark-alist - (elmo-msgdb-mark-append - mark-alist + (elmo-msgdb-mark-append + mark-alist num gmark)))) (setq i (1+ i)) @@ -190,7 +190,7 @@ (setq dirent (cdr dirent)) (setq abspath (expand-file-name relpath curdir)) (and - (not (string-match + (not (string-match elmo-localdir-list-folders-filter-regexp relpath)) (eq (nth 0 (setq attr (file-attributes abspath))) t) @@ -254,7 +254,7 @@ (setq file (expand-file-name number dir)) (if (and (string-match "[0-9]+" number) ; for safety. (file-exists-p file) - (file-writable-p file) + (file-writable-p file) (not (file-directory-p file))) (progn (delete-file file) t)))) @@ -283,7 +283,7 @@ (defun elmo-localdir-check-validity (spec validity-file) (let* ((dir (elmo-localdir-get-folder-directory spec)) (cur-val (nth 5 (file-attributes dir))) - (file-val (read + (file-val (read (or (elmo-get-file-string validity-file) "nil")))) (cond @@ -303,7 +303,7 @@ (prin1 (nth 5 (file-attributes dir)) tmp-buffer) (princ "\n" tmp-buffer) (if (file-writable-p validity-file) - (write-region (point-min) (point-max) + (write-region (point-min) (point-max) validity-file nil 'no-msg) (message (format "%s is not writable." number-file))) (kill-buffer tmp-buffer)))) @@ -346,7 +346,7 @@ t)))) (defsubst elmo-localdir-field-condition-match (spec number condition) - (elmo-file-field-condition-match + (elmo-file-field-condition-match (expand-file-name (int-to-string number) (elmo-localdir-get-folder-directory spec)) condition)) @@ -439,7 +439,7 @@ t) (defun elmo-localdir-get-msg-filename (spec number &optional loc-alist) - (expand-file-name + (expand-file-name (int-to-string number) (elmo-localdir-get-folder-directory spec))) @@ -452,9 +452,9 @@ (throw 'found t)) (setq lock (cdr lock))))))) -(defalias 'elmo-localdir-sync-number-alist +(defalias 'elmo-localdir-sync-number-alist 'elmo-generic-sync-number-alist) -(defalias 'elmo-localdir-list-folder-unread +(defalias 'elmo-localdir-list-folder-unread 'elmo-generic-list-folder-unread) (defalias 'elmo-localdir-list-folder-important 'elmo-generic-list-folder-important) diff --git a/elmo/elmo-localnews.el b/elmo/elmo-localnews.el index d106467..24af2fa 100644 --- a/elmo/elmo-localnews.el +++ b/elmo/elmo-localnews.el @@ -121,7 +121,7 @@ (elmo-localdir-get-msg-filename spec number loc-alist))) (defalias 'elmo-localnews-sync-number-alist 'elmo-generic-sync-number-alist) -(defalias 'elmo-localnews-list-folder-unread +(defalias 'elmo-localnews-list-folder-unread 'elmo-generic-list-folder-unread) (defalias 'elmo-localnews-list-folder-important 'elmo-generic-list-folder-important) diff --git a/elmo/elmo-maildir.el b/elmo/elmo-maildir.el index d50d4ea..23f0a11 100644 --- a/elmo/elmo-maildir.el +++ b/elmo/elmo-maildir.el @@ -61,7 +61,7 @@ This variable should not be used in elsewhere.") nil "^[^.].*$" t)) seen-list seen sym list) (setq list - (mapcar + (mapcar (lambda (x) (if (string-match "^\\([^:]+\\):\\([^:]+\\)$" x) (progn @@ -90,7 +90,7 @@ This variable should not be used in elsewhere.") (let ((cur-time (current-time)) (count 0) last-accessed) - (mapcar (function + (mapcar (function (lambda (file) (setq last-accessed (nth 4 (file-attributes file))) (when (or (> (- (car cur-time)(car last-accessed)) 1) @@ -115,7 +115,7 @@ This variable should not be used in elsewhere.") (elmo-maildir-cleanup-temporal maildir) ;; move new msgs to cur directory. (mapcar (lambda (x) - (rename-file + (rename-file (expand-file-name x (expand-file-name "new" maildir)) (expand-file-name (concat x ":2,") (expand-file-name "cur" maildir)))) @@ -124,7 +124,7 @@ This variable should not be used in elsewhere.") (defun elmo-maildir-set-mark (filename mark) "Mark the file in the maildir. MARK is a character." (if (string-match "^\\([^:]+:2,\\)\\(.*\\)$" filename) - (let ((flaglist (string-to-char-list (elmo-match-string + (let ((flaglist (string-to-char-list (elmo-match-string 2 filename)))) (unless (memq mark flaglist) (setq flaglist (sort (cons mark flaglist) '<)) @@ -135,7 +135,7 @@ This variable should not be used in elsewhere.") (defun elmo-maildir-delete-mark (filename mark) "Mark the file in the maildir. MARK is a character." (if (string-match "^\\([^:]+:2,\\)\\(.*\\)$" filename) - (let ((flaglist (string-to-char-list (elmo-match-string + (let ((flaglist (string-to-char-list (elmo-match-string 2 filename)))) (when (memq mark flaglist) (setq flaglist (delq mark flaglist)) @@ -178,15 +178,15 @@ This variable should not be used in elsewhere.") (defun elmo-maildir-mark-as-unread (spec msgs &optional msgdb) (elmo-maildir-delete-mark-msgs spec ?S msgs msgdb)) -(defun elmo-maildir-msgdb-create (spec numlist new-mark - already-mark seen-mark - important-mark +(defun elmo-maildir-msgdb-create (spec numlist new-mark + already-mark seen-mark + important-mark seen-list &optional msgdb) (when numlist (let* ((dir (elmo-maildir-get-folder-directory spec)) (loc-alist (if msgdb (elmo-msgdb-get-location msgdb) - (elmo-msgdb-location-load (elmo-msgdb-expand-path + (elmo-msgdb-location-load (elmo-msgdb-expand-path nil spec)))) (loc-seen (elmo-maildir-list-location dir)) (loc-list (car loc-seen)) @@ -202,7 +202,7 @@ This variable should not be used in elsewhere.") dir (car numlist) loc-alist)) (if (null entity) () - (setq overview + (setq overview (elmo-msgdb-append-element overview entity)) (setq number-alist @@ -214,11 +214,11 @@ This variable should not be used in elsewhere.") (setq location (cdr (assq (car numlist) loc-alist))) (unless (member location seen-list) (setq mark-alist - (elmo-msgdb-mark-append - mark-alist + (elmo-msgdb-mark-append + mark-alist (elmo-msgdb-overview-entity-get-number entity) - (or (elmo-msgdb-global-mark-get + (or (elmo-msgdb-global-mark-get (elmo-msgdb-overview-entity-get-id entity)) new-mark))))) @@ -251,11 +251,11 @@ This variable should not be used in elsewhere.") (not (or (listp folder) (elmo-folder-exists-p folder))))) folders))) -(static-cond +(static-cond ((>= emacs-major-version 19) (defun elmo-maildir-make-unique-string () "This function generates a string that can be used as a unique -file name for maildir directories." +file name for maildir directories." (let ((cur-time (current-time))) (format "%.0f.%d_%d.%s" (+ (* (car cur-time) @@ -276,22 +276,22 @@ file name for maildir directories." (float-to-string (f+ (f* (f (car time)) (f 65536)) - (f (cadr time)))) - 0 5) + (f (cadr time)))) + 0 5) (cadr time) (% (abs (random t)) 10000); dummy pid (system-name)))))) (defun elmo-maildir-temporal-filename (basedir) - (let ((filename (expand-file-name + (let ((filename (expand-file-name (concat "tmp/" (elmo-maildir-make-unique-string)) basedir))) (unless (file-exists-p (file-name-directory filename)) (make-directory (file-name-directory filename))) (while (file-exists-p filename) ;; (sleep-for 2) ; I don't want to wait. - (setq filename - (expand-file-name + (setq filename + (expand-file-name (concat "tmp/" (elmo-maildir-make-unique-string)) basedir))) filename)) @@ -308,7 +308,7 @@ file name for maildir directories." ;; add link from new. (elmo-add-name-to-file filename - (expand-file-name + (expand-file-name (concat "new/" (file-name-nondirectory filename)) basedir)) t) @@ -319,7 +319,7 @@ file name for maildir directories." (let ((dir (elmo-maildir-get-folder-directory spec)) file) (setq file (elmo-maildir-number-to-filename dir number loc-alist)) - (if (and (file-writable-p file) + (if (and (file-writable-p file) (not (file-directory-p file))) (progn (delete-file file) t)))) @@ -327,7 +327,7 @@ file name for maildir directories." (defun elmo-maildir-read-msg (spec number outbuf &optional msgdb) (save-excursion (let* ((loc-alist (if msgdb (elmo-msgdb-get-location msgdb) - (elmo-msgdb-location-load (elmo-msgdb-expand-path + (elmo-msgdb-location-load (elmo-msgdb-expand-path nil spec)))) (dir (elmo-maildir-get-folder-directory spec)) (file (elmo-maildir-number-to-filename dir number loc-alist))) @@ -339,7 +339,7 @@ file name for maildir directories." (defun elmo-maildir-delete-msgs (spec msgs &optional msgdb) (let ((loc-alist (if msgdb (elmo-msgdb-get-location msgdb) - (elmo-msgdb-location-load (elmo-msgdb-expand-path + (elmo-msgdb-location-load (elmo-msgdb-expand-path nil spec))))) (mapcar '(lambda (msg) (elmo-maildir-delete-msg spec msg loc-alist)) @@ -347,7 +347,7 @@ file name for maildir directories." (defsubst elmo-maildir-list-folder-subr (spec &optional nonsort) (let* ((dir (elmo-maildir-get-folder-directory spec)) - (flist (elmo-list-folder-by-location + (flist (elmo-list-folder-by-location spec (car (elmo-maildir-list-location dir)))) (news (car (elmo-maildir-list-location dir "new")))) @@ -413,7 +413,7 @@ file name for maildir directories." (save-excursion (let* ((msgs (or from-msgs (elmo-maildir-list-folder spec))) (loc-alist (if msgdb (elmo-msgdb-get-location msgdb) - (elmo-msgdb-location-load (elmo-msgdb-expand-path + (elmo-msgdb-location-load (elmo-msgdb-expand-path nil spec)))) (dir (elmo-maildir-get-folder-directory spec)) (i 0) @@ -423,7 +423,7 @@ file name for maildir directories." msg-num) (while msgs (setq msg-num (car msgs)) - (if (elmo-file-field-condition-match + (if (elmo-file-field-condition-match (elmo-maildir-number-to-filename dir (car msgs) loc-alist) condition) @@ -437,17 +437,17 @@ file name for maildir directories." ret-val))) ;;; (maildir) -> maildir -(defun elmo-maildir-copy-msgs (dst-spec msgs src-spec +(defun elmo-maildir-copy-msgs (dst-spec msgs src-spec &optional loc-alist same-number) (let (srcfile) (while msgs - (setq srcfile + (setq srcfile (elmo-maildir-get-msg-filename src-spec (car msgs) loc-alist)) (elmo-copy-file ;; src file srcfile ;; dst file - (expand-file-name + (expand-file-name (file-name-nondirectory srcfile) (concat (elmo-maildir-get-folder-directory dst-spec) "/cur"))) (setq msgs (cdr msgs)))) @@ -460,15 +460,15 @@ file name for maildir directories." t) (defun elmo-maildir-get-msg-filename (spec number &optional loc-alist) - (elmo-maildir-number-to-filename + (elmo-maildir-number-to-filename (elmo-maildir-get-folder-directory spec) - number (or loc-alist (elmo-msgdb-location-load - (elmo-msgdb-expand-path + number (or loc-alist (elmo-msgdb-location-load + (elmo-msgdb-expand-path nil spec))))) -(defalias 'elmo-maildir-sync-number-alist +(defalias 'elmo-maildir-sync-number-alist 'elmo-generic-sync-number-alist) -(defalias 'elmo-maildir-list-folder-unread +(defalias 'elmo-maildir-list-folder-unread 'elmo-generic-list-folder-unread) (defalias 'elmo-maildir-list-folder-important 'elmo-generic-list-folder-important) diff --git a/elmo/elmo-msgdb.el b/elmo/elmo-msgdb.el index e91f113..ec3055b 100644 --- a/elmo/elmo-msgdb.el +++ b/elmo/elmo-msgdb.el @@ -41,24 +41,24 @@ (let* ((spec (or spec (elmo-folder-get-spec folder))) (type (car spec)) fld) - (cond + (cond ((eq type 'imap4) (setq fld (elmo-imap4-spec-mailbox spec)) (if (string= "inbox" (downcase fld)) (setq fld "inbox")) (if (eq (string-to-char fld) ?/) (setq fld (substring fld 1 (length fld)))) - (expand-file-name + (expand-file-name fld (expand-file-name (or (elmo-imap4-spec-username spec) "nobody") - (expand-file-name (or + (expand-file-name (or (elmo-imap4-spec-hostname spec) "nowhere") - (expand-file-name + (expand-file-name "imap" elmo-msgdb-dir))))) ((eq type 'nntp) - (expand-file-name + (expand-file-name (elmo-nntp-spec-group spec) (expand-file-name (or (elmo-nntp-spec-hostname spec) "nowhere") (expand-file-name "nntp" @@ -81,22 +81,22 @@ (expand-file-name "filter" elmo-msgdb-dir))) ((eq type 'archive) - (expand-file-name + (expand-file-name (directory-file-name (concat - (elmo-replace-in-string + (elmo-replace-in-string (elmo-replace-in-string - (elmo-replace-in-string + (elmo-replace-in-string (nth 1 spec) "/" "_") ":" "__") "~" "___") "/" (nth 3 spec))) - (expand-file-name (concat (symbol-name type) "/" + (expand-file-name (concat (symbol-name type) "/" (symbol-name (nth 2 spec))) elmo-msgdb-dir))) ((eq type 'pop3) - (expand-file-name + (expand-file-name (elmo-safe-filename (elmo-pop3-spec-username spec)) (expand-file-name (elmo-pop3-spec-hostname spec) (expand-file-name @@ -146,7 +146,7 @@ ;; (defsubst elmo-msgdb-number-add (alist number id) (let ((ret-val alist)) - (setq ret-val + (setq ret-val (elmo-msgdb-append-element ret-val (cons number id))) ret-val)) @@ -160,8 +160,8 @@ (let* ((path (expand-file-name elmo-msgdb-global-mark-filename elmo-msgdb-dir)) - (malist (or elmo-msgdb-global-mark-alist - (setq elmo-msgdb-global-mark-alist + (malist (or elmo-msgdb-global-mark-alist + (setq elmo-msgdb-global-mark-alist (elmo-object-load path)))) match) (when (setq match (assoc msgid malist)) @@ -173,8 +173,8 @@ (let* ((path (expand-file-name elmo-msgdb-global-mark-filename elmo-msgdb-dir)) - (malist (or elmo-msgdb-global-mark-alist - (setq elmo-msgdb-global-mark-alist + (malist (or elmo-msgdb-global-mark-alist + (setq elmo-msgdb-global-mark-alist (elmo-object-load path)))) match) (if (setq match (assoc msgid malist)) @@ -185,9 +185,9 @@ (elmo-object-save path elmo-msgdb-global-mark-alist))) (defun elmo-msgdb-global-mark-get (msgid) - (cdr (assoc msgid (or elmo-msgdb-global-mark-alist - (setq elmo-msgdb-global-mark-alist - (elmo-object-load + (cdr (assoc msgid (or elmo-msgdb-global-mark-alist + (setq elmo-msgdb-global-mark-alist + (elmo-object-load (expand-file-name elmo-msgdb-global-mark-filename elmo-msgdb-dir))))))) @@ -203,12 +203,12 @@ (defsubst elmo-msgdb-location-add (alist number location) (let ((ret-val alist)) - (setq ret-val + (setq ret-val (elmo-msgdb-append-element ret-val (cons number location))) ret-val)) (defsubst elmo-msgdb-location-save (dir alist) - (elmo-object-save + (elmo-object-save (expand-file-name elmo-msgdb-location-filename dir) alist)) @@ -231,8 +231,8 @@ locations-in-db)) (setq modified new-locs) (setq i (or (elmo-max-of-list (mapcar 'car location-alist)) 0)) - (mapcar - (function + (mapcar + (function (lambda (x) (setq location-alist (delq (rassoc x location-alist) location-alist)))) @@ -259,7 +259,7 @@ (setq ret-val (delq entity alist)) ;; set mark (setcar (cdr entity) mark)) - (if mark + (if mark (setq ret-val (elmo-msgdb-append-element ret-val (list id mark))))) ret-val)) @@ -303,7 +303,7 @@ (while (re-search-forward (concat "^" name ":[ \t]*") nil t) (setq field-body (nconc field-body - (list (buffer-substring-no-properties + (list (buffer-substring-no-properties (match-end 0) (std11-field-end)))))) field-body)))) @@ -346,15 +346,15 @@ header separator." (buffer-substring beg (point)) "\n[ \t]*" "")))))))) (defun elmo-msgdb-number-load (dir) - (elmo-object-load + (elmo-object-load (expand-file-name elmo-msgdb-number-filename dir))) (defun elmo-msgdb-overview-load (dir) - (elmo-object-load + (elmo-object-load (expand-file-name elmo-msgdb-overview-filename dir))) (defun elmo-msgdb-mark-load (dir) - (elmo-object-load + (elmo-object-load (expand-file-name elmo-msgdb-mark-filename dir))) (defsubst elmo-msgdb-seen-load (dir) @@ -363,27 +363,27 @@ header separator." dir))) (defun elmo-msgdb-number-save (dir obj) - (elmo-object-save + (elmo-object-save (expand-file-name elmo-msgdb-number-filename dir) obj)) (defun elmo-msgdb-mark-save (dir obj) - (elmo-object-save + (elmo-object-save (expand-file-name elmo-msgdb-mark-filename dir) obj)) (defsubst elmo-msgdb-seen-save (dir obj) - (elmo-object-save + (elmo-object-save (expand-file-name elmo-msgdb-seen-filename dir) obj)) (defsubst elmo-msgdb-overview-save (dir overview) - (elmo-object-save + (elmo-object-save (expand-file-name elmo-msgdb-overview-filename dir) overview)) (defun elmo-msgdb-delete-msgs (folder msgs msgdb &optional reserve-cache) - "Delete MSGS from FOLDER in MSGDB. + "Delete MSGS from FOLDER in MSGDB. content of MSGDB is changed." (save-excursion (let* ((msg-list msgs) @@ -398,14 +398,14 @@ content of MSGDB is changed." ;; remove from current database. (while msg-list (setq message-id (cdr (assq (car msg-list) number-alist))) - (if (and (not reserve-cache) message-id) + (if (and (not reserve-cache) message-id) (elmo-cache-delete message-id folder (car msg-list))) ;; This is no good!!!! ;(setq overview (delete (assoc message-id overview) overview)) - (setq overview + (setq overview (delq - (elmo-msgdb-overview-get-entity-by-number overview + (elmo-msgdb-overview-get-entity-by-number overview (car msg-list)) overview)) (setq number-alist @@ -444,7 +444,7 @@ content of MSGDB is changed." (defsubst elmo-msgdb-overview-entity-get-from (entity) (and entity (aref (cdr entity) 2) - (decode-mime-charset-string (aref (cdr entity) 2) + (decode-mime-charset-string (aref (cdr entity) 2) elmo-mime-charset))) (defsubst elmo-msgdb-overview-entity-set-number (entity number) @@ -518,10 +518,10 @@ content of MSGDB is changed." (and killed-list (not (listp (catch 'found - (mapcar - (function + (mapcar + (function (lambda (entity) - (cond + (cond ((integerp entity) (if (eq entity msg) (throw 'found t))) @@ -542,7 +542,7 @@ if integer, set number th message as killed." (while (and dlist (not found)) (setq entity (car dlist)) (if (or (and (integerp entity) (eq entity msg)) - (and (consp entity) + (and (consp entity) (<= (car entity) msg) (<= msg (cdr entity)))) (setq found t)) @@ -555,7 +555,7 @@ if integer, set number th message as killed." (while (and dlist (not found)) (setq entity (car dlist)) (if (integerp entity) - (cond + (cond ((and (<= (car msg) entity)(<= entity (cdr msg))) (setcar dlist msg) (setq found t) @@ -591,7 +591,7 @@ if integer, set number th message as killed." ret-val)) (defun elmo-msgdb-finfo-load () - (elmo-object-load (expand-file-name + (elmo-object-load (expand-file-name elmo-msgdb-finfo-filename elmo-msgdb-dir) elmo-mime-charset t)) @@ -627,7 +627,7 @@ if integer, set number th message as killed." alist)) (defsubst elmo-msgdb-create-overview-from-buffer (number &optional size time) - "Create overview entity from current buffer. + "Create overview entity from current buffer. Header region is supposed to be narrowed." (save-excursion (let ((extras elmo-msgdb-extra-fields) @@ -642,7 +642,7 @@ Header region is supposed to be narrowed." (elmo-field-body "references")))) (setq from (elmo-mime-string (elmo-delete-char ?\" - (or + (or (elmo-field-body "from") elmo-no-from)))) (setq subject (elmo-mime-string (or (elmo-field-body "subject") @@ -659,7 +659,7 @@ Header region is supposed to be narrowed." (setq extra (cons (cons (downcase (car extras)) field-body) extra))) (setq extras (cdr extras))) - (cons message-id (vector number references + (cons message-id (vector number references from subject date to cc size extra)) ))) @@ -667,12 +667,12 @@ Header region is supposed to be narrowed." (defun elmo-msgdb-overview-sort-by-date (overview) (sort overview (function - (lambda (x y) + (lambda (x y) (condition-case nil (string< - (timezone-make-date-sortable + (timezone-make-date-sortable (elmo-msgdb-overview-entity-get-date x)) - (timezone-make-date-sortable + (timezone-make-date-sortable (elmo-msgdb-overview-entity-get-date y))) (error)))))) @@ -691,7 +691,7 @@ Header region is supposed to be narrowed." (elmo-msgdb-overview-get-entity-by-number overview number)))) (defsubst elmo-msgdb-append (msgdb msgdb-append) - (list + (list (nconc (car msgdb) (car msgdb-append)) (nconc (cadr msgdb) (cadr msgdb-append)) (nconc (caddr msgdb) (caddr msgdb-append)) diff --git a/elmo/elmo-multi.el b/elmo/elmo-multi.el index d711931..918cc22 100644 --- a/elmo/elmo-multi.el +++ b/elmo/elmo-multi.el @@ -35,7 +35,7 @@ (defun elmo-multi-msgdb (msgdb base) (list (mapcar (function - (lambda (x) + (lambda (x) (elmo-msgdb-overview-entity-set-number x (+ base @@ -64,8 +64,8 @@ (setq one-list-list (elmo-multi-get-intlist-list numlist)) (setq cur-number 0) (while (< cur-number (length flds)) - (setq ret-val - (elmo-msgdb-append + (setq ret-val + (elmo-msgdb-append ret-val (elmo-multi-msgdb (elmo-msgdb-create-as-numlist (nth cur-number flds) @@ -80,7 +80,7 @@ ;; returns append-msgdb (defun elmo-multi-delete-crossposts (already-msgdb append-msgdb) (let* ((number-alist (elmo-msgdb-get-number-alist append-msgdb)) - (dummy (copy-sequence (append + (dummy (copy-sequence (append number-alist (elmo-msgdb-get-number-alist already-msgdb)))) (cur number-alist) @@ -95,14 +95,14 @@ ;; base is also same...delete it! (setq to-be-deleted (append to-be-deleted (list (car cur)))))) (setq cur (cdr cur))) - (setq overview (elmo-delete-if + (setq overview (elmo-delete-if (function (lambda (x) (assq (elmo-msgdb-overview-entity-get-number x) to-be-deleted))) (elmo-msgdb-get-overview append-msgdb))) - (setq mark-alist (elmo-delete-if + (setq mark-alist (elmo-delete-if (function (lambda (x) (assq @@ -124,8 +124,8 @@ (setq one-list-list (elmo-multi-get-intlist-list numlist)) (setq cur-number 0) (while (< cur-number (length flds)) - (setq ret-val - (elmo-msgdb-append + (setq ret-val + (elmo-msgdb-append ret-val (elmo-multi-msgdb (elmo-msgdb-create (nth cur-number flds) @@ -156,7 +156,7 @@ (cur-number 0)) (setq one-list-list (elmo-multi-get-intlist-list msgs)) (while (< cur-number (length flds)) - (elmo-delete-msgs (nth cur-number flds) + (elmo-delete-msgs (nth cur-number flds) (nth cur-number one-list-list)) (setq cur-number (+ 1 cur-number))) t)) @@ -173,8 +173,8 @@ (* elmo-multi-divide-number cur-number)) elmo-multi-divide-number))) (setq one-alist (nconc - one-alist - (list + one-alist + (list (list (% (car (car mark-alist)) (* elmo-multi-divide-number cur-number)) (cadr (car mark-alist)))))) @@ -190,15 +190,15 @@ (setq mark-alist-list (elmo-multi-mark-alist-list mark-alist)) (while flds (setq cur-number (+ cur-number 1)) - (setq ret-val (append + (setq ret-val (append ret-val - (mapcar + (mapcar (function (lambda (x) - (+ + (+ (* elmo-multi-divide-number cur-number) x))) (elmo-list-folder-unread (car flds) - (car mark-alist-list) + (car mark-alist-list) unread-marks)))) (setq mark-alist-list (cdr mark-alist-list)) (setq flds (cdr flds))) @@ -210,12 +210,12 @@ ret-val) (while flds (setq cur-number (+ cur-number 1)) - (setq ret-val (append + (setq ret-val (append ret-val - (mapcar + (mapcar (function (lambda (x) - (+ + (+ (* elmo-multi-divide-number cur-number) x))) (elmo-list-folder-important (car flds) overview)))) (setq flds (cdr flds))) @@ -227,12 +227,12 @@ ret-val) (while flds (setq cur-number (+ cur-number 1)) - (setq ret-val (append + (setq ret-val (append ret-val - (mapcar + (mapcar (function (lambda (x) - (+ + (+ (* elmo-multi-divide-number cur-number) x))) (elmo-list-folder (car flds))))) (setq flds (cdr flds))) @@ -284,14 +284,14 @@ (if (null cur-numlist) ;; t means filter all. (setq cur-numlist t))) - (setq ret-val (append + (setq ret-val (append ret-val - (elmo-list-filter + (elmo-list-filter cur-numlist - (mapcar + (mapcar (function (lambda (x) - (+ + (+ (* elmo-multi-divide-number cur-number) x))) (elmo-call-func (car flds) "search" condition))))) @@ -301,15 +301,15 @@ ret-val)) (defun elmo-multi-use-cache-p (spec number) - (elmo-call-func (nth (- (/ number elmo-multi-divide-number) 1) + (elmo-call-func (nth (- (/ number elmo-multi-divide-number) 1) (cdr spec)) - "use-cache-p" + "use-cache-p" (% number elmo-multi-divide-number))) (defun elmo-multi-local-file-p (spec number) - (elmo-call-func (nth (- (/ number elmo-multi-divide-number) 1) + (elmo-call-func (nth (- (/ number elmo-multi-divide-number) 1) (cdr spec)) - "local-file-p" + "local-file-p" (% number elmo-multi-divide-number))) (defun elmo-multi-commit (spec) @@ -347,12 +347,12 @@ (incf multi-base) (setq append-alist (elmo-call-func (nth (- multi-base 1) (cdr spec)) ;; folder name - "sync-number-alist" + "sync-number-alist" (nth (- multi-base 1) number-alist-list))) - (mapcar + (mapcar (function (lambda (x) - (setcar x + (setcar x (+ (* elmo-multi-divide-number multi-base) (car x))))) append-alist) (setq result-alist (nconc result-alist append-alist)) diff --git a/elmo/elmo-nntp.el b/elmo/elmo-nntp.el index 20b481a..b38730b 100644 --- a/elmo/elmo-nntp.el +++ b/elmo/elmo-nntp.el @@ -172,22 +172,22 @@ Don't cache if nil.") (defun elmo-nntp-get-connection (server user port ssl) (let* ((user-at-host (format "%s@%s" user server)) - (user-at-host-on-port (concat + (user-at-host-on-port (concat user-at-host ":" (int-to-string port) (if (eq ssl 'starttls) "!!" (if ssl "!")))) ret-val result buffer process errmsg proc-stat) (if (not (elmo-plugged-p server port)) (error "Unplugged")) (setq ret-val (assoc user-at-host-on-port elmo-nntp-connection-cache)) - (if (and ret-val - (or (eq (setq proc-stat + (if (and ret-val + (or (eq (setq proc-stat (process-status (cadr (cdr ret-val)))) 'closed) (eq proc-stat 'exit))) ;; connection is closed... (progn (kill-buffer (car (cdr ret-val))) - (setq elmo-nntp-connection-cache + (setq elmo-nntp-connection-cache (delete ret-val elmo-nntp-connection-cache)) (setq ret-val nil))) (if ret-val @@ -234,8 +234,8 @@ Don't cache if nil.") (if (looking-at "[23][0-9]+ .*$") (progn (setq response-continue nil) (setq elmo-nntp-read-point match-end) - (setq return-value - (if return-value + (setq return-value + (if return-value (concat return-value "\n" response-string) response-string))) (if (looking-at "[^23][0-9]+ .*$") @@ -245,8 +245,8 @@ Don't cache if nil.") (setq elmo-nntp-read-point match-end) (if not-command (setq response-continue nil)) - (setq return-value - (if return-value + (setq return-value + (if return-value (concat return-value "\n" response-string) response-string))) (setq elmo-nntp-read-point match-end))) @@ -273,7 +273,7 @@ Don't cache if nil.") (goto-char elmo-nntp-read-point)) (setq match-end (point)) (elmo-delete-cr - (buffer-substring elmo-nntp-read-point + (buffer-substring elmo-nntp-read-point (- match-end 3)))))) (defun elmo-nntp-read-body (buffer process outbuf) @@ -299,8 +299,8 @@ Don't cache if nil.") (condition-case () (if (not (string= cwf folder)) (progn - (elmo-nntp-send-command buffer - process + (elmo-nntp-send-command buffer + process (format "group %s" folder)) (if (elmo-nntp-read-response buffer process) (setcar (cddr connection) folder))) @@ -344,7 +344,7 @@ Don't cache if nil.") (defun elmo-nntp-list-folders (spec &optional hierarchy) (elmo-nntp-setting spec - (let* ((cwf (caddr connection)) + (let* ((cwf (caddr connection)) (tmp-buffer (get-buffer-create " *ELMO NNTP list folders TMP*")) response ret-val top-ng append-serv use-list-active start) (save-excursion @@ -446,7 +446,7 @@ Don't cache if nil.") (concat "-" fld (and user (concat ":" user)) - (and append-serv + (and append-serv (concat append-serv))))) ret-val))))) @@ -482,14 +482,14 @@ Don't cache if nil.") (setq retval (elmo-string-to-list response)))) (if use-listgroup retval - (elmo-nntp-send-command buffer - process + (elmo-nntp-send-command buffer + process (format "group %s" folder)) (if (null (setq response (elmo-nntp-read-response buffer process))) (error "Select folder failed")) (setcar (cddr connection) folder) (if (and - (string-match "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$" + (string-match "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$" response) (> (string-to-int (elmo-match-string 1 response)) 0)) (elmo-nntp-make-msglist @@ -518,13 +518,13 @@ Don't cache if nil.") (if (not connection) (error "Connection failed")) (save-excursion - (elmo-nntp-send-command buffer - process + (elmo-nntp-send-command buffer + process (format "group %s" folder)) (setq response (elmo-nntp-read-response buffer process)) - (if (and response - (string-match - "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$" + (if (and response + (string-match + "211 \\([0-9]+\\) \\([0-9]+\\) \\([0-9]+\\) [^.].+$" response)) (progn (setq end-num (string-to-int @@ -547,7 +547,7 @@ Don't cache if nil.") ("lines" . 7) ("xref" . 8))) -(defun elmo-nntp-create-msgdb-from-overview-string (str +(defun elmo-nntp-create-msgdb-from-overview-string (str folder new-mark already-mark @@ -581,17 +581,17 @@ Don't cache if nil.") (setq extra (cons (cons ext field) extra))) (setq extras (cdr extras))) (setq overview - (elmo-msgdb-append-element + (elmo-msgdb-append-element overview (cons (aref ov-entity 4) (vector num - (elmo-msgdb-get-last-message-id + (elmo-msgdb-get-last-message-id (aref ov-entity 5)) ;; from - (elmo-mime-string (elmo-delete-char + (elmo-mime-string (elmo-delete-char ?\" - (or - (aref ov-entity 2) + (or + (aref ov-entity 2) elmo-no-from) 'uni)) ;; subject (elmo-mime-string (or (aref ov-entity 1) @@ -618,7 +618,7 @@ Don't cache if nil.") seen-mark) new-mark)))) (setq mark-alist - (elmo-msgdb-mark-append mark-alist + (elmo-msgdb-mark-append mark-alist num gmark)))) (setq ov-list (cdr ov-list))) (list overview number-alist mark-alist))) @@ -632,7 +632,7 @@ Don't cache if nil.") t)) (defun elmo-nntp-msgdb-create (spec numlist new-mark already-mark - seen-mark important-mark + seen-mark important-mark seen-list &optional as-num) (when numlist (save-excursion @@ -652,19 +652,19 @@ Don't cache if nil.") length (+ (- end-num beg-num) 1)) (message "Getting overview...") (while (<= cur end-num) - (elmo-nntp-send-command buffer process - (format - "xover %s-%s" + (elmo-nntp-send-command buffer process + (format + "xover %s-%s" (int-to-string cur) - (int-to-string - (+ cur + (int-to-string + (+ cur elmo-nntp-overview-fetch-chop-length)))) (with-current-buffer buffer (if ov-str - (setq ret-val + (setq ret-val (elmo-msgdb-append ret-val - (elmo-nntp-create-msgdb-from-overview-string + (elmo-nntp-create-msgdb-from-overview-string ov-str folder new-mark @@ -683,7 +683,7 @@ Don't cache if nil.") (error "Fetching overview failed"))) (setq cur (+ elmo-nntp-overview-fetch-chop-length cur 1)) (elmo-display-progress - 'elmo-nntp-msgdb-create "Getting overview..." + 'elmo-nntp-msgdb-create "Getting overview..." (/ (* (+ (- (min cur end-num) beg-num) 1) 100) length)))) @@ -693,10 +693,10 @@ Don't cache if nil.") new-mark already-mark seen-mark seen-list)) (with-current-buffer buffer (if ov-str - (setq ret-val + (setq ret-val (elmo-msgdb-append ret-val - (elmo-nntp-create-msgdb-from-overview-string + (elmo-nntp-create-msgdb-from-overview-string ov-str folder new-mark @@ -711,15 +711,15 @@ Don't cache if nil.") ;; to max-number(inn 2.3?). (when (and (elmo-nntp-max-number-precedes-list-active-p) (elmo-nntp-list-active-p server port)) - (elmo-nntp-send-command buffer process + (elmo-nntp-send-command buffer process (format "list active %s" folder)) (if (null (elmo-nntp-read-response buffer process)) (progn (elmo-nntp-set-list-active server port nil) (error "NNTP list command failed"))) - (elmo-nntp-catchup-msgdb - ret-val - (nth 1 (read (concat "(" (elmo-nntp-read-contents + (elmo-nntp-catchup-msgdb + ret-val + (nth 1 (read (concat "(" (elmo-nntp-read-contents buffer process) ")"))))) ret-val))))) @@ -755,7 +755,7 @@ Don't cache if nil.") number-alist)))) (defun elmo-nntp-msgdb-create-by-header (folder buffer process numlist - new-mark already-mark + new-mark already-mark seen-mark seen-list) (let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*")) ret-val) @@ -763,7 +763,7 @@ Don't cache if nil.") buffer tmp-buffer process numlist) (setq ret-val (elmo-nntp-msgdb-create-message - tmp-buffer (length numlist) folder new-mark already-mark + tmp-buffer (length numlist) folder new-mark already-mark seen-mark seen-list)) (kill-buffer tmp-buffer) ret-val)) @@ -781,8 +781,8 @@ Don't cache if nil.") (while (not (eobp)) (end-of-line) (setq ret-list (save-match-data - (apply 'vector (split-string - (buffer-substring beg (point)) + (apply 'vector (split-string + (buffer-substring beg (point)) "\t")))) (beginning-of-line) (forward-line 1) @@ -796,15 +796,15 @@ Don't cache if nil.") (let* ((connection (elmo-nntp-get-connection server user port ssl)) (buffer (car connection)) (process (cadr connection)) -; (cwf (caddr connection)) - response errmsg ov-str) +; (cwf (caddr connection)) + response errmsg ov-str) (catch 'done (if folder (if (null (elmo-nntp-goto-folder server folder user port ssl)) (progn (setq errmsg (format "group %s not found." folder)) (throw 'done nil)))) - (elmo-nntp-send-command buffer process + (elmo-nntp-send-command buffer process (format "xover %s-%s" beg end)) (if (null (setq response (elmo-nntp-read-response buffer process t))) @@ -819,20 +819,20 @@ Don't cache if nil.") (setq ov-str response) ) (if errmsg - (progn + (progn (message errmsg) nil) ov-str)))) (defun elmo-nntp-get-message (server user number folder outbuf port ssl) - "Get nntp message on FOLDER at SERVER. + "Get nntp message on FOLDER at SERVER. Returns message string." (save-excursion (let* ((connection (elmo-nntp-get-connection server user port ssl)) (buffer (car connection)) (process (cadr connection)) - (cwf (caddr connection)) + (cwf (caddr connection)) response errmsg) (catch 'done (if (and folder @@ -841,7 +841,7 @@ Returns message string." (progn (setq errmsg (format "group %s not found." folder)) (throw 'done nil)))) - (elmo-nntp-send-command buffer process + (elmo-nntp-send-command buffer process (format "article %s" number)) (if (null (setq response (elmo-nntp-read-response buffer process t))) @@ -859,7 +859,7 @@ Returns message string." (forward-line)) ) (if errmsg - (progn + (progn (message errmsg) nil)) response))) @@ -870,7 +870,7 @@ Returns message string." (let* ((connection (elmo-nntp-get-connection server user port ssl)) (buffer (car connection)) (process (cadr connection))) - (elmo-nntp-send-command buffer process + (elmo-nntp-send-command buffer process (format "head %s" msgid)) (if (elmo-nntp-read-response buffer process) (elmo-nntp-read-contents buffer process)) @@ -878,7 +878,7 @@ Returns message string." (std11-field-body "Newsgroups")))) (defun elmo-nntp-open-connection (server user portnum ssl) - "Open NNTP connection and returns + "Open NNTP connection and returns the list of (process session-buffer current-working-folder). Return nil if connection failed." (let ((process nil) @@ -954,9 +954,9 @@ Return nil if connection failed." (defun elmo-nntp-read-msg (spec msg outbuf) (elmo-nntp-get-message (elmo-nntp-spec-hostname spec) (elmo-nntp-spec-username spec) - msg + msg (elmo-nntp-spec-group spec) - outbuf + outbuf (elmo-nntp-spec-port spec) (elmo-nntp-spec-ssl spec))) @@ -970,9 +970,9 @@ Return nil if connection failed." (defun elmo-nntp-post (hostname content-buf) (let* (;(folder (nth 1 spec)) - (connection - (elmo-nntp-get-connection - hostname + (connection + (elmo-nntp-get-connection + hostname elmo-default-nntp-user elmo-default-nntp-port elmo-default-nntp-ssl)) (buffer (car connection)) @@ -986,8 +986,8 @@ Return nil if connection failed." (delete-region (match-beginning 0)(match-end 0))) (setq has-message-id (std11-field-body "message-id")) (elmo-nntp-send-command buffer process "post") - (if (string-match "^340" (setq response - (elmo-nntp-read-raw-response + (if (string-match "^340" (setq response + (elmo-nntp-read-raw-response buffer process))) (if (string-match "recommended ID \\(<[^@]+@[^>]+>\\)" response) (unless has-message-id @@ -1002,7 +1002,7 @@ Return nil if connection failed." (elmo-nntp-send-data process content-buf) (elmo-nntp-send-command buffer process ".") ;(elmo-nntp-read-response buffer process t) - (if (not (string-match + (if (not (string-match "^2" (setq response (elmo-nntp-read-raw-response buffer process)))) (error (concat "NNTP error: " response)))))) @@ -1088,8 +1088,8 @@ Return nil if connection failed." (setq key (cons (cons buffer process) (vector 0 server user port ssl))) (setq connection-keys (nconc connection-keys (list key)))) - (elmo-nntp-send-command buffer - process + (elmo-nntp-send-command buffer + process (format "group %s" folder) t ;; don't erase-buffer ) @@ -1264,7 +1264,7 @@ Return nil if connection failed." ;; end of from Gnus -(defun elmo-nntp-msgdb-create-message (buffer len folder new-mark +(defun elmo-nntp-msgdb-create-message (buffer len folder new-mark already-mark seen-mark seen-list) (save-excursion (let (beg @@ -1279,7 +1279,7 @@ Return nil if connection failed." (setq beg (save-excursion (forward-line 1) (point))) (setq num (and (looking-at "^2[0-9]*[ ]+\\([0-9]+\\)") - (string-to-int + (string-to-int (elmo-match-buffer 1)))) (elmo-nntp-next-result-arrived-p) (when num @@ -1290,7 +1290,7 @@ Return nil if connection failed." (setq entity (elmo-msgdb-create-overview-from-buffer num)) (when entity - (setq overview + (setq overview (elmo-msgdb-append-element overview entity)) (setq number-alist @@ -1299,7 +1299,7 @@ Return nil if connection failed." (car entity))) (setq message-id (car entity)) (setq seen (member message-id seen-list)) - (if (setq gmark + (if (setq gmark (or (elmo-msgdb-global-mark-get message-id) (if (elmo-cache-exists-p message-id);; XXX (if seen @@ -1309,8 +1309,8 @@ Return nil if connection failed." seen-mark new-mark)))) (setq mark-alist - (elmo-msgdb-mark-append - mark-alist + (elmo-msgdb-mark-append + mark-alist num gmark))) )))) (setq i (1+ i)) @@ -1333,7 +1333,7 @@ Return nil if connection failed." (if (elmo-nntp-spec-ssl spec) "!ssl" ""))) (defsubst elmo-nntp-portinfo (spec) - (list (elmo-nntp-spec-hostname spec) + (list (elmo-nntp-spec-hostname spec) (elmo-nntp-spec-port spec))) (defun elmo-nntp-plugged-p (spec) @@ -1346,7 +1346,7 @@ Return nil if connection failed." (append (elmo-nntp-portinfo spec) (list nil nil (quote (elmo-nntp-port-label spec)) add)))) -(defalias 'elmo-nntp-list-folder-unread +(defalias 'elmo-nntp-list-folder-unread 'elmo-generic-list-folder-unread) (defalias 'elmo-nntp-list-folder-important 'elmo-generic-list-folder-important) diff --git a/elmo/elmo-pipe.el b/elmo/elmo-pipe.el index aacdb35..04a0688 100644 --- a/elmo/elmo-pipe.el +++ b/elmo/elmo-pipe.el @@ -40,7 +40,7 @@ (defalias 'elmo-pipe-msgdb-create 'elmo-pipe-msgdb-create-as-numlist) (defun elmo-pipe-msgdb-create-as-numlist (spec numlist new-mark already-mark - seen-mark important-mark + seen-mark important-mark seen-list) (elmo-msgdb-create-as-numlist (elmo-pipe-spec-dst spec) numlist new-mark already-mark @@ -54,7 +54,7 @@ (defun elmo-pipe-read-msg (spec number outbuf) (elmo-call-func (elmo-pipe-spec-dst spec) - "read-msg" + "read-msg" number outbuf)) (defun elmo-pipe-delete-msgs (spec msgs) @@ -64,7 +64,7 @@ (defun elmo-pipe-drain (src dst) (let ((msgdb (elmo-msgdb-load src)) - elmo-nntp-use-cache + elmo-nntp-use-cache elmo-imap4-use-cache elmo-pop3-use-cache) ; Inhibit caching while moving messages. (message "Checking %s..." src) @@ -130,7 +130,7 @@ (elmo-get-msg-filename (elmo-pipe-spec-dst spec) number loc-alist)) (defun elmo-pipe-sync-number-alist (spec number-alist) - (elmo-call-func (elmo-pipe-spec-src spec) + (elmo-call-func (elmo-pipe-spec-src spec) "sync-number-alist" number-alist)) ; ?? (defun elmo-pipe-server-diff (spec) diff --git a/elmo/elmo-pop3.el b/elmo/elmo-pop3.el index bdf4e52..494784a 100644 --- a/elmo/elmo-pop3.el +++ b/elmo/elmo-pop3.el @@ -38,8 +38,8 @@ (require 'sasl)) (error)) (defun-maybe md5 (a)) - (defun-maybe sasl-digest-md5-digest-response - (digest-challenge username passwd serv-type host &optional realm)) + (defun-maybe sasl-digest-md5-digest-response + (digest-challenge username passwd serv-type host &optional realm)) (defun-maybe sasl-scram-md5-client-msg-1 (authenticate-id &optional authorize-id)) (defun-maybe sasl-scram-md5-client-msg-2 @@ -75,8 +75,8 @@ (setq buffer (car (cdr (car cache)))) (setq process (car (cdr (cdr (car cache))))) (if (and process - (not (or (eq (setq proc-stat - (process-status process)) + (not (or (eq (setq proc-stat + (process-status process)) 'closed) (eq proc-stat 'exit)))) (condition-case () @@ -99,26 +99,26 @@ user-at-host-on-port) (if (not (elmo-plugged-p server port)) (error "Unplugged")) - (setq user-at-host-on-port + (setq user-at-host-on-port (concat user-at-host ":" (int-to-string port) (if (eq ssl 'starttls) "!!" (if ssl "!")))) (setq ret-val (assoc user-at-host-on-port elmo-pop3-connection-cache)) - (if (and ret-val - (or (eq (setq proc-stat - (process-status (cadr (cdr ret-val)))) + (if (and ret-val + (or (eq (setq proc-stat + (process-status (cadr (cdr ret-val)))) 'closed) (eq proc-stat 'exit))) ;; connection is closed... (progn (kill-buffer (car (cdr ret-val))) - (setq elmo-pop3-connection-cache + (setq elmo-pop3-connection-cache (delete ret-val elmo-pop3-connection-cache)) (setq ret-val nil) )) (if ret-val (cdr ret-val) (setq result - (elmo-pop3-open-connection + (elmo-pop3-open-connection server user port auth (elmo-get-passwd user-at-host) ssl)) (if (null result) @@ -130,9 +130,9 @@ (delete-process process) (error "Login failed") ) - (setq elmo-pop3-connection-cache - (append elmo-pop3-connection-cache - (list + (setq elmo-pop3-connection-cache + (append elmo-pop3-connection-cache + (list (cons user-at-host-on-port (setq ret-val (list buffer process)))))) ret-val))) @@ -173,24 +173,24 @@ (buffer-substring elmo-pop3-read-point (- match-end 2))) (goto-char elmo-pop3-read-point) (if (looking-at "\\+.*$") - (progn + (progn (setq response-continue nil) (setq elmo-pop3-read-point match-end) - (setq return-value - (if return-value + (setq return-value + (if return-value (concat return-value "\n" response-string) response-string ))) (if (looking-at "\\-.*$") - (progn + (progn (setq response-continue nil) (setq elmo-pop3-read-point match-end) (setq return-value nil)) (setq elmo-pop3-read-point match-end) (if not-command (setq response-continue nil)) - (setq return-value - (if return-value + (setq return-value + (if return-value (concat return-value "\n" response-string) response-string))) (setq elmo-pop3-read-point match-end))) @@ -212,7 +212,7 @@ (get-buffer-create (format " *POP session to %s:%d" host port))) (save-excursion (set-buffer process-buffer) - (elmo-set-buffer-multibyte nil) + (elmo-set-buffer-multibyte nil) (erase-buffer)) (setq process (elmo-open-network-stream "POP" process-buffer host port ssl)) @@ -229,8 +229,8 @@ (throw 'done nil)) (when (eq ssl 'starttls) (elmo-pop3-send-command process-buffer process "stls") - (string-match "^\+OK" - (elmo-pop3-read-response + (string-match "^\+OK" + (elmo-pop3-read-response process-buffer process)) (starttls-negotiate process)) (cond ((string= auth "apop") @@ -239,18 +239,18 @@ ;; good, APOP ready server (progn (require 'md5) - (elmo-pop3-send-command - process-buffer process - (format "apop %s %s" + (elmo-pop3-send-command + process-buffer process + (format "apop %s %s" user - (md5 + (md5 (concat (match-string 1 response) passphrase))))) ;; otherwise, fail (only APOP authentication) (setq ret-val (cons nil process)) (throw 'done nil))) ((string= auth "cram-md5") - (elmo-pop3-send-command + (elmo-pop3-send-command process-buffer process "auth cram-md5") (when (null (setq response (elmo-pop3-read-response @@ -260,11 +260,11 @@ (elmo-pop3-send-command process-buffer process (elmo-base64-encode-string - (sasl-cram-md5 user passphrase + (sasl-cram-md5 user passphrase (elmo-base64-decode-string (cadr (split-string response " "))))))) ((string= auth "digest-md5") - (elmo-pop3-send-command + (elmo-pop3-send-command process-buffer process "auth digest-md5") (when (null (setq response (elmo-pop3-read-response @@ -309,7 +309,7 @@ server-msg-1 client-msg-1 (setq salted-pass - (sasl-scram-md5-make-salted-pass + (sasl-scram-md5-make-salted-pass server-msg-1 passphrase))))) (when (null (setq response (elmo-pop3-read-response @@ -329,12 +329,12 @@ process-buffer process "") )) (t ;; try USER/PASS - (elmo-pop3-send-command process-buffer process + (elmo-pop3-send-command process-buffer process (format "user %s" user)) (when (null (elmo-pop3-read-response process-buffer process t)) (setq ret-val (cons nil process)) (throw 'done nil)) - (elmo-pop3-send-command process-buffer process + (elmo-pop3-send-command process-buffer process (format "pass %s" passphrase)))) ;; read PASS or APOP response (when (null (elmo-pop3-read-response process-buffer process t)) @@ -354,7 +354,7 @@ (goto-char elmo-pop3-read-point)) (setq match-end (point)) (elmo-delete-cr - (buffer-substring elmo-pop3-read-point + (buffer-substring elmo-pop3-read-point (- match-end 3)))))) ;; dummy functions @@ -503,11 +503,11 @@ (process (nth 1 connection)) response errmsg ret-val) (elmo-pop3-msgdb-create-by-header buffer process numlist - new-mark already-mark + new-mark already-mark seen-mark seen-list)))) (defun elmo-pop3-msgdb-create-by-header (buffer process numlist - new-mark already-mark + new-mark already-mark seen-mark seen-list) (let ((tmp-buffer (get-buffer-create " *ELMO Overview TMP*")) @@ -516,15 +516,15 @@ buffer tmp-buffer process numlist) (setq ret-val (elmo-pop3-msgdb-create-message - tmp-buffer + tmp-buffer (length numlist) numlist new-mark already-mark seen-mark seen-list)) (kill-buffer tmp-buffer) ret-val)) -(defun elmo-pop3-msgdb-create-message (buffer - num numlist new-mark already-mark +(defun elmo-pop3-msgdb-create-message (buffer + num numlist new-mark already-mark seen-mark seen-list) (save-excursion @@ -544,11 +544,11 @@ (save-restriction (narrow-to-region beg (point)) (setq entity - (elmo-msgdb-create-overview-from-buffer + (elmo-msgdb-create-overview-from-buffer (car numlist))) (setq numlist (cdr numlist)) (when entity - (setq overview + (setq overview (elmo-msgdb-append-element overview entity)) (setq number-alist @@ -558,7 +558,7 @@ (setq message-id (car entity)) (setq seen (member message-id seen-list)) (if (setq gmark (or (elmo-msgdb-global-mark-get message-id) - (if (elmo-cache-exists-p + (if (elmo-cache-exists-p message-id) ; XXX (if seen nil @@ -568,7 +568,7 @@ seen-mark) new-mark)))) (setq mark-alist - (elmo-msgdb-mark-append + (elmo-msgdb-mark-append mark-alist (elmo-msgdb-overview-entity-get-number entity) gmark))) @@ -602,9 +602,9 @@ (let* ((connection (elmo-pop3-get-connection spec)) (buffer (car connection)) (process (cadr connection)) - (cwf (caddr connection)) + (cwf (caddr connection)) response errmsg msg) - (elmo-pop3-send-command buffer process + (elmo-pop3-send-command buffer process (format "retr %s" number)) (when (null (setq response (elmo-pop3-read-response buffer process t))) @@ -619,7 +619,7 @@ (defun elmo-pop3-delete-msg (buffer process number) (let (response errmsg msg) - (elmo-pop3-send-command buffer process + (elmo-pop3-send-command buffer process (format "dele %s" number)) (when (null (setq response (elmo-pop3-read-response buffer process t))) @@ -630,7 +630,7 @@ (let* ((connection (elmo-pop3-get-connection spec)) (buffer (car connection)) (process (cadr connection))) - (mapcar '(lambda (msg) (elmo-pop3-delete-msg + (mapcar '(lambda (msg) (elmo-pop3-delete-msg buffer process msg)) msgs)))) @@ -648,7 +648,7 @@ (if (elmo-pop3-spec-ssl spec) "!ssl" ""))) (defsubst elmo-pop3-portinfo (spec) - (list (elmo-pop3-spec-hostname spec) + (list (elmo-pop3-spec-hostname spec) (elmo-pop3-spec-port spec))) (defun elmo-pop3-plugged-p (spec) @@ -661,9 +661,9 @@ (append (elmo-pop3-portinfo spec) (list nil nil (quote (elmo-pop3-port-label spec)) add)))) -(defalias 'elmo-pop3-sync-number-alist +(defalias 'elmo-pop3-sync-number-alist 'elmo-generic-sync-number-alist) -(defalias 'elmo-pop3-list-folder-unread +(defalias 'elmo-pop3-list-folder-unread 'elmo-generic-list-folder-unread) (defalias 'elmo-pop3-list-folder-important 'elmo-generic-list-folder-important) diff --git a/elmo/elmo-util.el b/elmo/elmo-util.el index 84f7df7..362a361 100644 --- a/elmo/elmo-util.el +++ b/elmo/elmo-util.el @@ -36,8 +36,8 @@ (require 'eword-decode) (require 'utf7) -(eval-when-compile - (condition-case nil +(eval-when-compile + (condition-case nil (progn (require 'ssl) (require 'starttls)) @@ -69,7 +69,7 @@ ;; base64 encoding/decoding (require 'mel) -(fset 'elmo-base64-encode-string +(fset 'elmo-base64-encode-string (mel-find-function 'mime-encode-string "base64")) (fset 'elmo-base64-decode-string (mel-find-function 'mime-decode-string "base64")) @@ -78,7 +78,7 @@ ;; Check make-symbolic-link() instead. -- 981002 by Fuji (if (fboundp 'make-symbolic-link) ;; xxx (defalias 'elmo-add-name-to-file 'add-name-to-file) - (defun elmo-add-name-to-file + (defun elmo-add-name-to-file (filename newname &optional ok-if-already-exists) (copy-file filename newname ok-if-already-exists t))) @@ -86,7 +86,7 @@ (broken-facility timezone-y2k "timezone.el does not clear Y2K." (or (not (featurep 'timezone)) - (string= (aref (timezone-parse-date "Sat, 1 Jan 00 07:00:00 JST") 0) + (string= (aref (timezone-parse-date "Sat, 1 Jan 00 07:00:00 JST") 0) "2000"))) (when-broken timezone-y2k @@ -151,7 +151,7 @@ Understands the following styles: (if year (progn (setq year - (substring date (match-beginning year) + (substring date (match-beginning year) (match-end year))) (if (< (length year) 4) (let ((yr (string-to-int year))) @@ -167,16 +167,16 @@ Understands the following styles: (+ (match-beginning month) 3)))) (setq month (int-to-string - (cdr (assoc (upcase string) + (cdr (assoc (upcase string) timezone-months-assoc))))) (setq day (substring date (match-beginning day) (match-end day))) (setq time - (substring date (match-beginning time) + (substring date (match-beginning time) (match-end time))))) (if zone (setq zone - (substring date (match-beginning zone) + (substring date (match-beginning zone) (match-end zone)))) (if year (vector year month day time zone) @@ -208,7 +208,7 @@ Understands the following styles: (defmacro elmo-match-substring (pos string from) "Substring of POSth matched string of STRING. " - (` (substring (, string) + (` (substring (, string) (+ (match-beginning (, pos)) (, from)) (match-end (, pos))))) @@ -243,7 +243,7 @@ File content is decoded with MIME-CHARSET." (elmo-set-buffer-multibyte default-enable-multibyte-characters) (decode-mime-charset-region (point-min) (point-max) mime-charset)) (condition-case nil - (read (current-buffer)) + (read (current-buffer)) (error (unless no-err (message "Warning: Loading object from %s failed." filename) @@ -295,7 +295,7 @@ File content is encoded with MIME-CHARSET." (setq server (elmo-match-substring 1 folder 1)) (setq server default-server)) (if (match-beginning 2) - (setq port + (setq port (string-to-int (elmo-match-substring 2 folder 1))) (setq port default-port)) (setq tls (elmo-match-string 3 folder)) @@ -317,18 +317,18 @@ File content is encoded with MIME-CHARSET." (default-tls elmo-default-imap4-ssl) spec mailbox user auth) (when (string-match "\\(.*\\)@\\(.*\\)" default-server) - ;; case: default-imap4-server is specified like + ;; case: default-imap4-server is specified like ;; "hoge%imap.server@gateway". (setq default-user (elmo-match-string 1 default-server)) (setq default-server (elmo-match-string 2 default-server))) - (setq spec (elmo-network-get-spec + (setq spec (elmo-network-get-spec folder default-server default-port default-tls)) (setq folder (car spec)) (when (string-match "^\\(%\\)\\([^:@!]*\\)\\(:[^/!]+\\)?\\(/[^/:@!]+\\)?" folder) (progn - (setq mailbox (if (match-beginning 2) + (setq mailbox (if (match-beginning 2) (elmo-match-string 2 folder) elmo-default-imap4-mailbox)) (setq user (if (match-beginning 3) @@ -337,7 +337,7 @@ File content is encoded with MIME-CHARSET." (setq auth (if (match-beginning 4) (elmo-match-substring 4 folder 1) elmo-default-imap4-authenticate-type)) - (append (list 'imap4 + (append (list 'imap4 (elmo-imap4-encode-folder-string mailbox) user auth) (cdr spec)))))) @@ -382,11 +382,11 @@ File content is encoded with MIME-CHARSET." (when (string-match "^\\(-\\)\\([^:@!]*\\)\\(:[^/!]+\\)?\\(/[^/:@!]+\\)?" folder) - (setq group + (setq group (if (match-beginning 2) (elmo-match-string 2 folder))) - (setq user - (if (match-beginning 3) + (setq user + (if (match-beginning 3) (elmo-match-substring 3 folder 1) elmo-default-nntp-user)) (append (list 'nntp group user) @@ -395,7 +395,7 @@ File content is encoded with MIME-CHARSET." (defsubst elmo-nntp-spec-group (spec) (nth 1 spec)) -(defsubst elmo-nntp-spec-username (spec) +(defsubst elmo-nntp-spec-username (spec) (nth 2 spec)) ;; future use? @@ -458,7 +458,7 @@ File content is encoded with MIME-CHARSET." (elmo-match-string 2 folder))) 0) (setq fld-name "") ) - (list 'localnews + (list 'localnews (elmo-replace-in-string fld-name "\\." "/"))))) (defun elmo-cache-get-spec (folder) @@ -587,7 +587,7 @@ File content is encoded with MIME-CHARSET." term ret-val) (while terms (setq term (car terms)) - (cond + (cond ((string-match "^\\([a-zA-Z\\-]+\\)=\\(.*\\)$" term) (if (save-match-data (string-match "tocc" (elmo-match-string 1 term))) ;; syntax sugar @@ -597,7 +597,7 @@ File content is encoded with MIME-CHARSET." (elmo-match-string 2 term)) (vector 'match "cc" (elmo-match-string 2 term))))) - (setq ret-val (cons (vector 'match + (setq ret-val (cons (vector 'match (elmo-match-string 1 term) (elmo-match-string 2 term)) ret-val)))) @@ -610,7 +610,7 @@ File content is encoded with MIME-CHARSET." (elmo-match-string 2 term)) (vector 'unmatch "cc" (elmo-match-string 2 term))))) - (setq ret-val (cons (vector 'unmatch + (setq ret-val (cons (vector 'unmatch (elmo-match-string 1 term) (elmo-match-string 2 term)) ret-val)))) @@ -692,12 +692,12 @@ File content is encoded with MIME-CHARSET." (elmo-set-work-buf (as-binary-output-file (insert string) - (write-region (point-min) (point-max) + (write-region (point-min) (point-max) filename nil 'no-msg)) ))) (defun elmo-max-of-list (nlist) - (let ((l nlist) + (let ((l nlist) (max-num 0)) (while l (if (< max-num (car l)) @@ -720,7 +720,7 @@ File content is encoded with MIME-CHARSET." elmo-msgdb-dir)) (tmp-buffer (get-buffer-create " *elmo-passwd-alist-tmp*")) insert-file-contents-pre-hook ; To avoid autoconv-xmas... - insert-file-contents-post-hook + insert-file-contents-post-hook ret-val) (if (not (file-readable-p filename)) () @@ -728,7 +728,7 @@ File content is encoded with MIME-CHARSET." (insert-file-contents filename) (setq ret-val (condition-case nil - (read (current-buffer)) + (read (current-buffer)) (error nil nil)))) (kill-buffer tmp-buffer) ret-val))) @@ -749,7 +749,7 @@ File content is encoded with MIME-CHARSET." ; (error "%s is not safe.chmod 600 %s!" filename filename)) (if (file-writable-p filename) (progn - (write-region (point-min) (point-max) + (write-region (point-min) (point-max) filename nil 'no-msg) (set-file-modes filename 384)) (message (format "%s is not writable." filename))) @@ -763,11 +763,11 @@ File content is encoded with MIME-CHARSET." (setq data (assoc user-at-host elmo-passwd-alist)) (if data (elmo-base64-decode-string (cdr data)) - (setq pass (elmo-read-passwd (format "Password for %s: " + (setq pass (elmo-read-passwd (format "Password for %s: " user-at-host) t)) (setq elmo-passwd-alist (append elmo-passwd-alist - (list (cons user-at-host + (list (cons user-at-host (elmo-base64-encode-string pass))))) pass))) @@ -981,7 +981,7 @@ Otherwise treat \\ in NEWTEXT string as special: (defun elmo-delete-plugged (&optional server port alist) (let* ((alist (or alist elmo-plugged-alist)) (alist2 alist)) - (cond ((and (not port) (not server)) + (cond ((and (not port) (not server)) (setq alist nil)) ((not port) ;; delete plugged all port of server @@ -997,11 +997,11 @@ Otherwise treat \\ in NEWTEXT string as special: (defun elmo-disk-usage (path) "Get disk usage (bytes) in PATH." - (let ((file-attr + (let ((file-attr (condition-case () (file-attributes path) (error nil)))) (if file-attr (if (nth 0 file-attr) ; directory - (let ((files (condition-case () + (let ((files (condition-case () (directory-files path t "^[^\\.]") (error nil))) (result 0.0)) @@ -1085,14 +1085,14 @@ Otherwise treat \\ in NEWTEXT string as special: (while numbers (setq cur-number (+ cur-number 1)) (setq one-list nil) - (while (and numbers + (while (and numbers (eq 0 (/ (- (car numbers) (* elmo-multi-divide-number cur-number)) elmo-multi-divide-number))) (setq one-list (nconc - one-list - (list + one-list + (list (if as-is (car numbers) (% (car numbers) @@ -1110,7 +1110,7 @@ Otherwise treat \\ in NEWTEXT string as special: ret-val)) (defun elmo-list-diff (list1 list2 &optional mes) - (if mes + (if mes (message mes)) (let ((clist1 (copy-sequence list1)) (clist2 (copy-sequence list2))) @@ -1158,7 +1158,7 @@ Otherwise treat \\ in NEWTEXT string as special: result dels news) (while (or list1-list list2-list) - (setq result (elmo-list-bigger-diff (car list1-list) (car list2-list) + (setq result (elmo-list-bigger-diff (car list1-list) (car list2-list) mes)) (setq dels (append dels (car result))) (setq news (append news (cadr result))) @@ -1219,17 +1219,17 @@ Otherwise treat \\ in NEWTEXT string as special: (while condition (goto-char (point-min)) (setq term (car condition)) - (cond + (cond ((and (eq (elmo-filter-type term) 'date) (string= (elmo-filter-key term) "since")) (let ((date (elmo-date-get-datevec (elmo-filter-value term)))) (if (string< - (timezone-make-sortable-date (aref date 0) + (timezone-make-sortable-date (aref date 0) (aref date 1) (aref date 2) (timezone-make-time-string - (aref date 3) - (aref date 4) + (aref date 3) + (aref date 4) (aref date 5))) (timezone-make-date-sortable (std11-field-body "date"))) (throw 'done t)))) @@ -1238,12 +1238,12 @@ Otherwise treat \\ in NEWTEXT string as special: (let ((date (elmo-date-get-datevec (elmo-filter-value term)))) (if (string< (timezone-make-date-sortable (std11-field-body "date")) - (timezone-make-sortable-date (aref date 0) + (timezone-make-sortable-date (aref date 0) (aref date 1) (aref date 2) (timezone-make-time-string - (aref date 3) - (aref date 4) + (aref date 3) + (aref date 4) (aref date 5)))) (throw 'done t)))) ((eq (elmo-filter-type term) 'match) @@ -1368,18 +1368,18 @@ Otherwise treat \\ in NEWTEXT string as special: (defvar elmo-msgid-replace-chars nil) (defsubst elmo-replace-msgid-as-filename (msgid) - "Replace message-id string as filename." + "Replace message-id string as filename." (setq msgid (elmo-replace-in-string msgid " " " ")) (if (null elmo-msgid-replace-chars) - (setq elmo-msgid-replace-chars - (regexp-quote (mapconcat + (setq elmo-msgid-replace-chars + (regexp-quote (mapconcat 'car elmo-msgid-replace-string-alist "")))) (while (string-match (concat "[" elmo-msgid-replace-chars "]") msgid) - (setq msgid (concat + (setq msgid (concat (substring msgid 0 (match-beginning 0)) - (cdr (assoc - (substring msgid + (cdr (assoc + (substring msgid (match-beginning 0) (match-end 0)) elmo-msgid-replace-string-alist)) (substring msgid (match-end 0))))) @@ -1389,15 +1389,15 @@ Otherwise treat \\ in NEWTEXT string as special: "Recover Message-ID from filename." (let (tmp result) (while (string-match " " filename) - (setq tmp (substring filename + (setq tmp (substring filename (match-beginning 0) (+ (match-end 0) 1))) (if (string= tmp " ") (setq tmp " ") - (setq tmp (car (rassoc tmp + (setq tmp (car (rassoc tmp elmo-msgid-replace-string-alist)))) (setq result - (concat result + (concat result (substring filename 0 (match-beginning 0)) tmp)) (setq filename (substring filename (+ (match-end 0) 1)))) @@ -1439,7 +1439,7 @@ Otherwise treat \\ in NEWTEXT string as special: "Any element of list1 is deleted from list2." (while list1 (setq list2 (delete (car list1) list2)) - (setq list1 (cdr list1))) + (setq list1 (cdr list1))) list2) (defun elmo-list-member (list1 list2) @@ -1466,7 +1466,7 @@ Otherwise treat \\ in NEWTEXT string as special: (errobj error-object) err-mes) (while errobj - (setq err-mes (concat err-mes (format + (setq err-mes (concat err-mes (format (if (stringp (car errobj)) "%s" (if (boundp 'nemacs-version) diff --git a/elmo/elmo-vars.el b/elmo/elmo-vars.el index 450b6a7..b2f6faf 100644 --- a/elmo/elmo-vars.el +++ b/elmo/elmo-vars.el @@ -48,18 +48,18 @@ "*Default IMAP4 server.") (defvar elmo-default-imap4-authenticate-type "auth" "*Default Authentication type for IMAP4.") ; "auth" or "login" -(defvar elmo-default-imap4-user (or (getenv "USER") - (getenv "LOGNAME") +(defvar elmo-default-imap4-user (or (getenv "USER") + (getenv "LOGNAME") (user-login-name)) "*Default username for IMAP4") -(defvar elmo-default-imap4-port 143 +(defvar elmo-default-imap4-port 143 "*Default Port number of IMAP.") (defvar elmo-default-imap4-ssl nil "*Non-nil forces using SSL by default.") ;; POP3 -(defvar elmo-default-pop3-user (or (getenv "USER") - (getenv "LOGNAME") +(defvar elmo-default-pop3-user (or (getenv "USER") + (getenv "LOGNAME") (user-login-name)) "*Default username for POP3") (defvar elmo-default-pop3-server "localhost" @@ -76,7 +76,7 @@ "*Default NNTP server.") (defvar elmo-default-nntp-user nil "*Default User of NNTP. nil means no user authentication.") -(defvar elmo-default-nntp-port 119 +(defvar elmo-default-nntp-port 119 "*Default Port number of NNTP") (defvar elmo-default-nntp-ssl nil "*Non-nil forces using SSL by default.") @@ -126,12 +126,12 @@ Each elements are regexp of folder name (This is obsolete).") (defvar elmo-msgdb-finfo-filename "finfo" "Folder information cache...list of '(filename . '(new unread all)).") (defvar elmo-msgdb-append-list-filename "append" - "Appended messages...Structure is same as number-alist. + "Appended messages...Structure is same as number-alist. For disconnected operations.") (defvar elmo-msgdb-resume-list-filename "resume" "Resumed messages. For disconnected operations.") (defvar elmo-msgdb-lock-list-filename "lock" - "Locked messages...list of message-id. + "Locked messages...list of message-id. For disconnected operations.") (defvar elmo-msgdb-global-mark-filename "global-mark" "Alist of global mark .") @@ -158,7 +158,7 @@ For disconnected operations.") (defvar elmo-imap4-overview-fetch-chop-length 200 "*Number of overviews to fetch in one request in imap4.") (defvar elmo-nntp-overview-fetch-chop-length 200 - "*Number of overviews to fetch in one request in nntp.") + "*Number of overviews to fetch in one request in nntp.") (defvar elmo-localdir-header-chop-length 2048 "*Number of bytes to get header in one reading from file.") (defvar elmo-imap4-force-login nil @@ -316,12 +316,12 @@ If function, return value of function.") (defvar elmo-localdir-lockfile-list nil) (defvar elmo-nntp-max-number-precedes-list-active nil - "If non-nil, max number of the msgdb is set as the max number of + "If non-nil, max number of the msgdb is set as the max number of 'list active' (needed for inn 2.3 or later?). ") (defvar elmo-pop3-send-command-synchronously nil "If non-nil, commands are send synchronously. -If server doesn't accept asynchronous commands, this variable should be +If server doesn't accept asynchronous commands, this variable should be set as non-nil.") (provide 'elmo-vars) diff --git a/elmo/elmo2.el b/elmo/elmo2.el index 99ec770..195ca02 100644 --- a/elmo/elmo2.el +++ b/elmo/elmo2.el @@ -152,18 +152,18 @@ without cacheing." cache-file) (with-temp-buffer (elmo-call-func folder "read-msg" number (current-buffer)) - (as-binary-output-file + (as-binary-output-file (write-region (point-min) (point-max) cache-file nil 'no-msg))))))) (defun elmo-prefetch-msg (folder msg outbuf msgdb) "Read message into outbuf with cacheing." (save-excursion - (let* ((number-alist (elmo-msgdb-get-number-alist + (let* ((number-alist (elmo-msgdb-get-number-alist (or msgdb (elmo-msgdb-load folder)))) (dir (elmo-msgdb-expand-path folder)) (message-id (cdr (assq msg number-alist))) type - cache-status + cache-status ret-val part-num real-fld-num) (set-buffer outbuf) (if (elmo-cache-exists-p message-id) @@ -173,13 +173,13 @@ without cacheing." folder msg)) (setq type (elmo-folder-get-type (car real-fld-num))) (cond ((eq type 'imap4) - (setq ret-val (elmo-imap4-prefetch-msg + (setq ret-val (elmo-imap4-prefetch-msg (elmo-folder-get-spec (car real-fld-num)) - (cdr real-fld-num) + (cdr real-fld-num) outbuf))) ((elmo-folder-local-p (car real-fld-num))) - (t (setq ret-val (elmo-call-func (car real-fld-num) - "read-msg" + (t (setq ret-val (elmo-call-func (car real-fld-num) + "read-msg" (cdr real-fld-num) outbuf)))) (if ret-val (elmo-cache-save message-id @@ -204,7 +204,7 @@ without cacheing." (setq msgs (cdr msgs))))) ;; elmo-read-msg (folder msg outbuf msgdb) -;;; read message +;;; read message (defun elmo-read-msg (folder msg outbuf msgdb &optional force-reload) "Read message into outbuf." (let ((inhibit-read-only t)) @@ -212,27 +212,27 @@ without cacheing." (elmo-read-msg-no-cache folder msg outbuf) (elmo-read-msg-with-cache folder msg outbuf msgdb force-reload)))) -(defun elmo-read-msg-with-cache (folder msg outbuf msgdb +(defun elmo-read-msg-with-cache (folder msg outbuf msgdb &optional force-reload) "Read message into outbuf with cacheing." - (let* ((number-alist (elmo-msgdb-get-number-alist + (let* ((number-alist (elmo-msgdb-get-number-alist (or msgdb (elmo-msgdb-load folder)))) (dir (elmo-msgdb-expand-path folder)) (message-id (cdr (assq msg number-alist))) (type (elmo-folder-number-get-type folder msg)) - cache-status + cache-status ret-val part-num real-fld-num) (set-buffer outbuf) (if (and (not force-reload) (not (elmo-local-file-p folder msg))) (setq ret-val (elmo-cache-read message-id folder msg))) - (if ret-val + (if ret-val t ;; cache doesn't exist. (setq real-fld-num (elmo-get-real-folder-number folder msg)) - (if (setq ret-val (elmo-call-func (car real-fld-num) - "read-msg" + (if (setq ret-val (elmo-call-func (car real-fld-num) + "read-msg" (cdr real-fld-num) outbuf)) (if (not (elmo-local-file-p folder msg)) (elmo-cache-save message-id @@ -253,7 +253,7 @@ without cacheing." (elmo-call-func dst-folder "copy-msgs" msgs src-spec loc-alist same-number)))) -(defun elmo-move-msgs (src-folder msgs dst-folder +(defun elmo-move-msgs (src-folder msgs dst-folder &optional msgdb all done no-delete-info no-delete @@ -302,9 +302,9 @@ without cacheing." dst-folder)) ;; online and identical system...so copy 'em! (unless - (elmo-copy-msgs (car real-fld-num) + (elmo-copy-msgs (car real-fld-num) (list (cdr real-fld-num)) - dst-folder + dst-folder db same-number) (error "Copy message to %s failed" dst-folder)) @@ -313,7 +313,7 @@ without cacheing." (unless (elmo-append-msg dst-folder (buffer-string) message-id (if same-number (car messages)) ;; null means all unread. - (or (null unread-marks) + (or (null unread-marks) unseen)) (error "move: append message to %s failed" dst-folder)))) ;; delete src cache if it is partial. @@ -321,7 +321,7 @@ without cacheing." (setq ret-val (append ret-val (list (car messages)))) (setq i (+ i 1)) (setq percent (/ (* i 100) all-msg-num)) - (if no-delete + (if no-delete (elmo-display-progress 'elmo-move-msgs "Copying messages..." percent) @@ -337,7 +337,7 @@ without cacheing." (kill-buffer tmp-buf) (if (and (not no-delete) ret-val) (progn - (if (not no-delete-info) + (if (not no-delete-info) (message "Cleaning up src folder...")) (if (and (elmo-delete-msgs src-folder ret-val db) (elmo-msgdb-delete-msgs src-folder ret-val db t)) @@ -376,10 +376,10 @@ without cacheing." (elmo-call-func folder "search" condition from-msgs) (elmo-cache-search-all folder condition from-msgs)))) -(defun elmo-msgdb-create (folder numlist new-mark already-mark +(defun elmo-msgdb-create (folder numlist new-mark already-mark seen-mark important-mark seen-list) (if (elmo-folder-plugged-p folder) - (elmo-call-func folder "msgdb-create" numlist new-mark already-mark + (elmo-call-func folder "msgdb-create" numlist new-mark already-mark seen-mark important-mark seen-list) (elmo-dop-msgdb-create folder numlist new-mark already-mark seen-mark important-mark seen-list))) @@ -402,9 +402,9 @@ without cacheing." (let ((folder-numbers (elmo-make-folder-numbers-list folder msgs)) type) (while folder-numbers - (if (or (eq + (if (or (eq (setq type (car - (elmo-folder-get-spec + (elmo-folder-get-spec (car (car folder-numbers))))) 'imap4) (memq type '(maildir internal))) @@ -412,9 +412,9 @@ without cacheing." (elmo-call-func (car (car folder-numbers)) func-name (cdr (car folder-numbers))) (if elmo-enable-disconnected-operation - (elmo-dop-call-func-on-msgs + (elmo-dop-call-func-on-msgs (car (car folder-numbers)) ; real folder - func-name + func-name (cdr (car folder-numbers)) ; real number msgdb) (error "Unplugged")))) @@ -432,12 +432,12 @@ without cacheing." (defun elmo-mark-as-unread (folder msgs msgdb) (elmo-call-func-on-markable-msgs folder "mark-as-unread" msgs msgdb)) -(defun elmo-msgdb-create-as-numlist (folder numlist new-mark already-mark +(defun elmo-msgdb-create-as-numlist (folder numlist new-mark already-mark seen-mark important-mark seen-list) (if (elmo-folder-plugged-p folder) - (elmo-call-func folder "msgdb-create-as-numlist" numlist + (elmo-call-func folder "msgdb-create-as-numlist" numlist new-mark already-mark seen-mark important-mark seen-list) - (elmo-dop-msgdb-create-as-numlist + (elmo-dop-msgdb-create-as-numlist folder numlist new-mark already-mark seen-mark important-mark seen-list))) @@ -445,7 +445,7 @@ without cacheing." (defun elmo-msgdb-load (folder &optional spec) (message "Loading msgdb for %s..." folder) (let* ((path (elmo-msgdb-expand-path folder spec)) - (ret-val + (ret-val (list (elmo-msgdb-overview-load path) (elmo-msgdb-number-load path) (elmo-msgdb-mark-load path) @@ -513,7 +513,7 @@ without cacheing." (elmo-call-func folder "append-msg" string msg no-see))))) (defun elmo-check-validity (folder) - (elmo-call-func folder "check-validity" + (elmo-call-func folder "check-validity" (expand-file-name elmo-msgdb-validity-filename (elmo-msgdb-expand-path folder)))) @@ -524,7 +524,7 @@ without cacheing." (error "pack-number not supported"))) (defun elmo-sync-validity (folder) - (elmo-call-func folder "sync-validity" + (elmo-call-func folder "sync-validity" (expand-file-name elmo-msgdb-validity-filename (elmo-msgdb-expand-path folder)))) @@ -556,9 +556,9 @@ without cacheing." number-alist) (defun elmo-generic-list-folder-unread (spec mark-alist unread-marks) - (elmo-delete-if + (elmo-delete-if 'null - (mapcar + (mapcar (function (lambda (x) (if (member (cadr (assq (car x) mark-alist)) unread-marks) (car x)))) @@ -573,7 +573,7 @@ without cacheing." (let* ((numlist (elmo-msgdb-get-number-alist msgdb)) (len (length numlist)) new-numlist) - (if (eq (length (setq + (if (eq (length (setq new-numlist (elmo-call-func folder "sync-number-alist" numlist))) len) @@ -586,10 +586,10 @@ without cacheing." "Available if elmo-local-file-p is t." (elmo-call-func folder "get-msg-filename" number loc-alist)) -(defun elmo-strict-folder-diff (fld &optional number-alist) +(defun elmo-strict-folder-diff (fld &optional number-alist) (interactive) (let* ((dir (elmo-msgdb-expand-path fld)) - (nalist (or number-alist + (nalist (or number-alist (elmo-msgdb-number-load dir))) (in-db (sort (mapcar 'car nalist) '<)) (in-folder (elmo-list-folder fld)) @@ -602,7 +602,7 @@ without cacheing." )) (setq append-list (car diff)) (setq delete-list (cadr diff)) - (if append-list + (if append-list (length append-list) (if delete-list (- 0 (length delete-list)) @@ -627,7 +627,7 @@ without cacheing." (car overview) (if (assoc (elmo-msgdb-overview-entity-get-id (car overview)) elmo-msgdb-global-mark-alist) - (setq importants (cons + (setq importants (cons (elmo-msgdb-overview-entity-get-number (car overview)) importants))) @@ -648,16 +648,16 @@ without cacheing." (elmo-multi-folder-diff fld)) ((and (eq type 'filter) (or (elmo-multi-p fld) - (not + (not (vectorp (nth 1 (elmo-folder-get-spec fld))))) ;; not partial...unsync number is unknown. - (cons nil - (cdr (elmo-folder-diff + (cons nil + (cdr (elmo-folder-diff (nth 2 (elmo-folder-get-spec fld))))))) ((and (eq type 'imap4) elmo-use-server-diff) (elmo-call-func fld "server-diff")) ;; imap4 server side diff. - (t + (t (let ((cached-in-db-max (elmo-folder-get-info-max fld)) (in-folder (elmo-max-of-folder fld)) (in-db t) @@ -666,7 +666,7 @@ without cacheing." (if (or number-alist (not cached-in-db-max)) (let* ((dir (elmo-msgdb-expand-path fld)) - (nalist (or number-alist + (nalist (or number-alist (elmo-msgdb-number-load dir)))) ;; No info-cache. (setq in-db (sort (mapcar 'car nalist) '<)) @@ -676,13 +676,13 @@ without cacheing." ;; Number-alist is not used. (elmo-folder-set-info-hashtb fld in-db-max nil)) -;; (or -;; (and in-db (length in-db)) +;; (or +;; (and in-db (length in-db)) ;; 0))) ) ;; info-cache exists. (setq in-db-max cached-in-db-max)) - (setq unsync (if (and in-db + (setq unsync (if (and in-db (car in-folder)) (- (car in-folder) in-db-max) (if (and in-folder @@ -724,7 +724,7 @@ without cacheing." (* elmo-multi-divide-number cur-number)) elmo-multi-divide-number))) (setq one-alist (nconc - one-alist + one-alist (list (cons (% num (* elmo-multi-divide-number cur-number)) @@ -736,13 +736,13 @@ without cacheing." (defun elmo-multi-folder-diff (fld) (let ((flds (cdr (elmo-folder-get-spec fld))) (num-alist-list - (elmo-multi-get-number-alist-list + (elmo-multi-get-number-alist-list (elmo-msgdb-number-load (elmo-msgdb-expand-path fld)))) (count 0) diffs (unsync 0) (nomif 0)) (while flds - (setq diffs (nconc diffs (list (elmo-folder-diff (car flds) - (nth count + (setq diffs (nconc diffs (list (elmo-folder-diff (car flds) + (nth count num-alist-list) )))) (setq count (+ 1 count)) @@ -892,7 +892,7 @@ without cacheing." ((eq type 'multi) (elmo-multi-get-real-folder-number folder number)) ((eq type 'pipe) - (elmo-get-real-folder-number + (elmo-get-real-folder-number (elmo-pipe-spec-dst (elmo-folder-get-spec folder) ) number)) ((eq type 'filter) @@ -948,7 +948,7 @@ without cacheing." (let ((cur-spec (elmo-folder-get-spec folder))) (catch 'done (while cur-spec - (cond + (cond ((eq (car cur-spec) 'filter) (setq cur-spec (elmo-folder-get-spec (nth 2 cur-spec)))) ((eq (car cur-spec) 'pipe) @@ -960,7 +960,7 @@ without cacheing." (defun elmo-folder-contains-type (folder type) (let ((spec (elmo-folder-get-spec folder))) - (cond + (cond ((eq (car spec) 'filter) (elmo-folder-contains-type (nth 2 spec) type)) ((eq (car spec) 'pipe) diff --git a/elmo/mmelmo-1.el b/elmo/mmelmo-1.el index 0f9b25e..27b8fe0 100644 --- a/elmo/mmelmo-1.el +++ b/elmo/mmelmo-1.el @@ -43,7 +43,7 @@ (mm-define-backend elmo (buffer)) (mm-define-method initialize-instance ((entity elmo)) - (mime-entity-set-buffer-internal + (mime-entity-set-buffer-internal entity (get-buffer-create (concat mmelmo-entity-buffer-name "0"))) (save-excursion @@ -62,7 +62,7 @@ (setq header-start (point-min)) (setq body-end (point-max)) (goto-char header-start) - (if (re-search-forward + (if (re-search-forward (concat "^" (regexp-quote mail-header-separator) "$\\|^$" ) nil t) (setq header-end (match-beginning 0) diff --git a/elmo/mmelmo-imap4-1.el b/elmo/mmelmo-imap4-1.el index de012f4..8ccdccf 100644 --- a/elmo/mmelmo-imap4-1.el +++ b/elmo/mmelmo-imap4-1.el @@ -39,12 +39,12 @@ (let ((i (length node-id)) result) (while (> i 0) - (setq result - (concat result - (if result - (concat "." (int-to-string + (setq result + (concat result + (if result + (concat "." (int-to-string (+ 1 (nth (- i 1) node-id)))) - (int-to-string (or + (int-to-string (or (+ 1 (nth (- i 1) node-id)) 0))))) (setq i (- i 1))) @@ -85,41 +85,41 @@ ) (mime-entity-set-children-internal ret-val children) (setq content-type (list (cons 'type 'multipart))) - (setq content-type (append content-type - (list (cons 'subtype - (intern + (setq content-type (append content-type + (list (cons 'subtype + (intern (downcase (car entity))))))) - (setq content-type (append content-type + (setq content-type (append content-type (mime-parse-parameters-from-list (elmo-imap4-nth 1 entity)))) (mime-entity-set-content-type-internal ret-val content-type) ret-val)) (t ;; singlepart (let (content-type result) - ;; append size information into location + ;; append size information into location (setq location (append location (list (nth 6 entity)))) (setq content-type (list (cons 'type (intern (downcase (car entity)))))) (if (elmo-imap4-nth 1 entity) (setq content-type (append content-type - (list - (cons 'subtype - (intern + (list + (cons 'subtype + (intern (downcase (elmo-imap4-nth 1 entity)))))))) (if (elmo-imap4-nth 2 entity) - (setq content-type (append content-type + (setq content-type (append content-type (mime-parse-parameters-from-list (elmo-imap4-nth 2 entity))))) (setq result (make-mime-entity-internal 'elmo-imap4 location content-type ; content-type nil ; children - parent ; parent + parent ; parent node-id ; node-id )) - (mime-entity-set-encoding-internal result + (mime-entity-set-encoding-internal result (and (elmo-imap4-nth 5 entity) - (downcase + (downcase (elmo-imap4-nth 5 entity)))) result)))) @@ -136,13 +136,13 @@ (when (search-forward "FETCH" nil t) (narrow-to-region (match-end 0) (point-max)) (while (re-search-forward "{\\([0-9]+\\)}\r\n" nil t) - (goto-char (+ (point) + (goto-char (+ (point) (string-to-int (elmo-match-buffer 1)))) (setq str (buffer-substring (match-end 0) (point))) (delete-region (match-beginning 0) (point)) (insert (prin1-to-string str))); (insert "\"")) - (setq entity - (nth 1 (memq 'BODYSTRUCTURE + (setq entity + (nth 1 (memq 'BODYSTRUCTURE (read (buffer-string))))) (set-buffer raw-buffer) (mmelmo-imap4-parse-bodystructure-entity location nil entity nil) @@ -172,18 +172,18 @@ (save-excursion (when (not (string= (elmo-imap4-connection-get-cwf connection) (elmo-imap4-spec-folder spec))) - (if (null (setq response - (elmo-imap4-select-folder + (if (null (setq response + (elmo-imap4-select-folder (elmo-imap4-spec-folder spec) connection))) (error "Select folder failed"))) (elmo-imap4-send-command (process-buffer process) process - (format "uid fetch %s bodystructure" + (format "uid fetch %s bodystructure" msg)) (if (null (setq response (elmo-imap4-read-contents (process-buffer process) process))) (error "Fetching body structure failed"))) - (mmelmo-imap4-parse-bodystructure-string location + (mmelmo-imap4-parse-bodystructure-string location response); make mime-entity )))) @@ -191,21 +191,21 @@ (if (or (not mmelmo-imap4-threshold) (not (nth 4 location)) (and (nth 4 location) - mmelmo-imap4-threshold + mmelmo-imap4-threshold (<= (nth 4 location) mmelmo-imap4-threshold))) (cond ((mmelmo-imap4-multipart-p entity)) ; noop (t - (insert (elmo-imap4-read-part + (insert (elmo-imap4-read-part (nth 0 location) (nth 1 location) - (mmelmo-imap4-node-id-to-string + (mmelmo-imap4-node-id-to-string (nth 3 location)))) (mime-entity-set-body-start-internal entity (point-min)) (mime-entity-set-body-end-internal entity (point-max)))) - (setq mmelmo-imap4-skipped-parts + (setq mmelmo-imap4-skipped-parts (append mmelmo-imap4-skipped-parts - (list (mmelmo-imap4-node-id-to-string + (list (mmelmo-imap4-node-id-to-string (nth 3 location))))))) (defun mmelmo-imap4-read-body (entity) @@ -214,32 +214,32 @@ (if (or (not mmelmo-imap4-threshold) (not (nth 4 location)) (and (nth 4 location) - mmelmo-imap4-threshold + mmelmo-imap4-threshold (<= (nth 4 location) mmelmo-imap4-threshold))) (insert (elmo-imap4-read-part (nth 0 location) (nth 1 location) "1" )) - (setq mmelmo-imap4-skipped-parts + (setq mmelmo-imap4-skipped-parts (append mmelmo-imap4-skipped-parts - (list - (mmelmo-imap4-node-id-to-string + (list + (mmelmo-imap4-node-id-to-string (nth 3 location)))))))) ;;; mm-backend definitions for elmo-imap4 (mm-define-backend elmo-imap4 (elmo)) (mm-define-method initialize-instance ((entity elmo-imap4)) - (let ((new-entity (mmelmo-imap4-get-mime-entity + (let ((new-entity (mmelmo-imap4-get-mime-entity (mime-entity-location-internal entity)))) ;; ... (aset entity 1 (mime-entity-location-internal new-entity)) - (mime-entity-set-content-type-internal + (mime-entity-set-content-type-internal entity (mime-entity-content-type-internal new-entity)) - (mime-entity-set-encoding-internal + (mime-entity-set-encoding-internal entity (mime-entity-encoding-internal new-entity)) (mime-entity-set-children-internal @@ -253,9 +253,9 @@ (mime-entity-body-end-internal new-entity)))) (mm-define-method entity-buffer ((entity elmo-imap4)) - (let ((buffer (get-buffer-create + (let ((buffer (get-buffer-create (concat mmelmo-entity-buffer-name - (mmelmo-imap4-node-id-to-string + (mmelmo-imap4-node-id-to-string (mime-entity-node-id-internal entity))))) (location (mime-entity-location-internal entity))) (set-buffer buffer) @@ -332,13 +332,13 @@ (mm-define-method fetch-field ((entity elmo-imap4) field-name) (save-excursion (let ((buf (mime-entity-buffer-internal entity))) - (when buf + (when buf (set-buffer buf) (save-restriction (if (and (mime-entity-header-start-internal entity) (mime-entity-header-end-internal entity)) (progn - (narrow-to-region + (narrow-to-region (mime-entity-header-start-internal entity) (mime-entity-header-end-internal entity)) (std11-fetch-field field-name)) diff --git a/elmo/mmelmo-imap4-2.el b/elmo/mmelmo-imap4-2.el index 773f79a..a9c9636 100644 --- a/elmo/mmelmo-imap4-2.el +++ b/elmo/mmelmo-imap4-2.el @@ -42,19 +42,19 @@ (let ((i (length node-id)) result) (while (> i 0) - (setq result - (concat result - (if result - (concat "." (int-to-string + (setq result + (concat result + (if result + (concat "." (int-to-string (+ 1 (nth (- i 1) node-id)))) - (int-to-string (or + (int-to-string (or (+ 1 (nth (- i 1) node-id)) 0))))) (setq i (- i 1))) (or result "0"))) ;; parse IMAP4 body structure entity recursively. -(defun mmelmo-imap4-parse-bodystructure-object (folder +(defun mmelmo-imap4-parse-bodystructure-object (folder number msgdb node-id object parent) (cond @@ -84,14 +84,14 @@ (mime-entity-set-children-internal ret-val children) (setq content-type (list (cons 'type 'multipart))) (if (elmo-imap4-nth 0 object) - (setq content-type (append content-type - (list (cons 'subtype - (intern + (setq content-type (append content-type + (list (cons 'subtype + (intern (downcase (elmo-imap4-nth 0 object)))))))) - (setq content-type (append content-type + (setq content-type (append content-type (mime-parse-parameters-from-list (elmo-imap4-nth 1 object)))) (mime-entity-set-content-type-internal ret-val content-type) @@ -102,16 +102,16 @@ (setq content-type (list (cons 'type (intern (downcase (car object)))))) (if (elmo-imap4-nth 1 object) (setq content-type (append content-type - (list - (cons 'subtype - (intern + (list + (cons 'subtype + (intern (downcase (elmo-imap4-nth 1 object)))))))) (if (elmo-imap4-nth 2 object) - (setq content-type (append content-type + (setq content-type (append content-type (mime-parse-parameters-from-list (elmo-imap4-nth 2 object))))) - (setq ret-val + (setq ret-val (luna-make-entity (mm-expand-class-name 'elmo-imap4) :folder folder @@ -122,7 +122,7 @@ :node-id node-id)) (mime-entity-set-encoding-internal ret-val (and (elmo-imap4-nth 5 object) - (downcase + (downcase (elmo-imap4-nth 5 object)))) ret-val)))) @@ -134,13 +134,13 @@ (narrow-to-region (match-end 0) (point-max)) (while (re-search-forward "{\\([0-9]+\\)}\r\n" nil t) (let (str) - (goto-char (+ (point) + (goto-char (+ (point) (string-to-int (elmo-match-buffer 1)))) (setq str (buffer-substring (match-end 0) (point))) (delete-region (match-beginning 0) (point)) (insert (prin1-to-string str)))) (goto-char (point-min)) - (mmelmo-imap4-parse-bodystructure-object + (mmelmo-imap4-parse-bodystructure-object folder ; folder number ; number msgdb ; msgdb @@ -174,7 +174,7 @@ connection) (elmo-imap4-connection-get-process connection) - (format + (format (if elmo-imap4-use-uid "uid fetch %s bodystructure" "fetch %s bodystructure") @@ -197,10 +197,10 @@ mmelmo-imap4-threshold))) (progn (cond ((mmelmo-imap4-multipart-p entity)) ; noop - (t (insert (elmo-imap4-read-part + (t (insert (elmo-imap4-read-part (mime-elmo-entity-folder-internal entity) (mime-elmo-entity-number-internal entity) - (mmelmo-imap4-node-id-to-string + (mmelmo-imap4-node-id-to-string (mime-entity-node-id-internal entity)))))) (setq mmelmo-imap4-fetched t) (mime-buffer-entity-set-body-start-internal entity (point-min)) @@ -208,10 +208,10 @@ (setq mmelmo-imap4-fetched nil) (mime-buffer-entity-set-body-start-internal entity (point-min)) (mime-buffer-entity-set-body-end-internal entity (point-min)) - (setq mmelmo-imap4-skipped-parts + (setq mmelmo-imap4-skipped-parts (append mmelmo-imap4-skipped-parts - (list (mmelmo-imap4-node-id-to-string + (list (mmelmo-imap4-node-id-to-string (mime-entity-node-id-internal entity))))))) (defun mmelmo-imap4-insert-body (entity) @@ -219,16 +219,16 @@ (if (or (not mmelmo-imap4-threshold) (not (mime-elmo-entity-size-internal entity)) (and (mime-elmo-entity-size-internal entity) - mmelmo-imap4-threshold + mmelmo-imap4-threshold (<= (mime-elmo-entity-size-internal entity) mmelmo-imap4-threshold))) (insert (elmo-imap4-read-part (mime-elmo-entity-folder-internal entity) (mime-elmo-entity-number-internal entity) "1")) - (setq mmelmo-imap4-skipped-parts + (setq mmelmo-imap4-skipped-parts (append mmelmo-imap4-skipped-parts - (list (mmelmo-imap4-node-id-to-string + (list (mmelmo-imap4-node-id-to-string (mime-entity-node-id-internal entity))))))) ;;; mime-elmo-imap4-entity class definitions. @@ -239,9 +239,9 @@ (luna-define-method initialize-instance ((entity mime-elmo-imap4-entity) &rest init-args) "The initialization method for elmo-imap4. -mime-elmo-entity has its own instance variable +mime-elmo-entity has its own instance variable `imap', `folder', `msgdb', and `size'. -These value must be specified as argument for `luna-make-entity'." +These value must be specified as argument for `luna-make-entity'." (apply (car (luna-class-find-functions (luna-find-class 'standard-object) 'initialize-instance)) @@ -263,9 +263,9 @@ These value must be specified as argument for `luna-make-entity'." (setq mmelmo-imap4-fetched t))) (mime-buffer-entity-buffer-internal entity)) (save-excursion - (set-buffer (get-buffer-create + (set-buffer (get-buffer-create (concat mmelmo-entity-buffer-name - (mmelmo-imap4-node-id-to-string + (mmelmo-imap4-node-id-to-string (mime-entity-node-id-internal entity))))) (mmelmo-original-mode) (mime-buffer-entity-set-buffer-internal entity (current-buffer)) @@ -279,24 +279,24 @@ These value must be specified as argument for `luna-make-entity'." (setq mime-message-structure entity) (setq mmelmo-imap4-skipped-parts nil) ;; insert header - (insert (elmo-imap4-read-part - (mime-elmo-entity-folder-internal + (insert (elmo-imap4-read-part + (mime-elmo-entity-folder-internal entity) (mime-elmo-entity-number-internal entity) "header")) - (mime-buffer-entity-set-header-start-internal + (mime-buffer-entity-set-header-start-internal entity (point-min)) (mime-buffer-entity-set-header-end-internal entity (max (- (point) 1) 1)) (if (null (mime-entity-children-internal entity)) (progn - (mime-buffer-entity-set-body-start-internal + (mime-buffer-entity-set-body-start-internal entity (point)) ;; insert body if size is OK. (mmelmo-imap4-insert-body entity) - (mime-buffer-entity-set-body-end-internal + (mime-buffer-entity-set-body-end-internal entity (point))))) - (setq mime-message-structure + (setq mime-message-structure mmelmo-imap4-current-message-structure) (mmelmo-imap4-read-part entity))) (current-buffer)))) @@ -333,7 +333,7 @@ These value must be specified as argument for `luna-make-entity'." (mime-parse-encapsulated entity))))) ;; override generic function for dynamic body fetching. -(luna-define-method mime-entity-content ((entity +(luna-define-method mime-entity-content ((entity mime-elmo-imap4-entity)) (save-excursion (set-buffer (mime-entity-buffer entity)) @@ -342,7 +342,7 @@ These value must be specified as argument for `luna-make-entity'." (mime-buffer-entity-body-end-internal entity)) (mime-entity-encoding entity)))) -(luna-define-method mime-entity-fetch-field ((entity mime-elmo-imap4-entity) +(luna-define-method mime-entity-fetch-field ((entity mime-elmo-imap4-entity) field-name) (save-excursion (save-restriction @@ -351,14 +351,14 @@ These value must be specified as argument for `luna-make-entity'." (if (and (mime-buffer-entity-header-start-internal entity) (mime-buffer-entity-header-end-internal entity)) (progn - (narrow-to-region + (narrow-to-region (mime-buffer-entity-header-start-internal entity) (mime-buffer-entity-header-end-internal entity)) (std11-fetch-field field-name)) nil))))) (luna-define-method mime-insert-header ((entity mime-elmo-imap4-entity) - &optional invisible-fields + &optional invisible-fields visible-fields) (mmelmo-insert-sorted-header-from-buffer (mime-entity-buffer entity) diff --git a/elmo/mmelmo.el b/elmo/mmelmo.el index 44942d6..ebd64e4 100644 --- a/elmo/mmelmo.el +++ b/elmo/mmelmo.el @@ -49,7 +49,7 @@ If function is specified, its return value is used.") (if (not ret-val) (save-excursion (set-buffer (setq ret-val - (get-buffer-create + (get-buffer-create (concat mmelmo-entity-buffer-name "0")))) (mmelmo-original-mode))) ret-val)) @@ -61,7 +61,7 @@ If function is specified, its return value is used.") (kill-buffer x))) (mapcar 'buffer-name (buffer-list)))) -(defun mmelmo-insert-sorted-header-from-buffer (buffer +(defun mmelmo-insert-sorted-header-from-buffer (buffer start end &optional invisible-fields visible-fields