X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=elmo%2Felmo-nmz.el;h=bc46e716ee8a7b29b8a5cc80ff10e7906f7d1c72;hb=c6930bb696cf4a9e6f2d07c5620e4392f5a4773d;hp=cda62cb8469e6f4bfb97b5dccb225f2cda04945b;hpb=e22a69470365bb60089091d35a9879d55af4d611;p=elisp%2Fwanderlust.git diff --git a/elmo/elmo-nmz.el b/elmo/elmo-nmz.el index cda62cb..bc46e71 100644 --- a/elmo/elmo-nmz.el +++ b/elmo/elmo-nmz.el @@ -48,7 +48,7 @@ If the value is a list, all elements are used as index paths for namazu." :type 'symbol :group 'elmo) -(defcustom elmo-nmz-args '("--all" "--list" "--early") +(defcustom elmo-nmz-args '("--all" "--list" "--late") "*Argument list for namazu to list matched files." :type '(repeat string) :group 'elmo) @@ -60,6 +60,10 @@ If the value is a list, all elements are used as index paths for namazu." (repeat (directory :tag "Index Path"))))) :group 'elmo) +(defvar elmo-nmz-use-drive-letter (if (memq system-type + '(OS/2 emx windows-nt)) t nil) + "*If non-nil, do a drive letter conversion (e.g. /a|/ => a:/).") + ;;; "namazu search" (eval-and-compile (luna-define-class elmo-nmz-folder @@ -96,7 +100,7 @@ If the value is a list, all elements are used as index paths for namazu." (defun elmo-nmz-msgdb-create-entity (folder number) "Create msgdb entity for the message in the FOLDER with NUMBER." - (let ((location (elmo-map-message-location folder number)) + (let ((location (expand-file-name (elmo-map-message-location folder number))) entity uid) (setq entity (elmo-msgdb-create-overview-entity-from-file number location)) (unless (or (> (length (elmo-msgdb-overview-entity-get-to entity)) 0) @@ -152,7 +156,7 @@ If the value is a list, all elements are used as index paths for namazu." 'elmo-folder-msgdb-create "Creating msgdb..." percent)) (setq numlist (cdr numlist))) - (message "Creating msgdb...done.") + (message "Creating msgdb...done") (list overview number-alist mark-alist))) (luna-define-method elmo-folder-message-file-p ((folder elmo-nmz-folder)) @@ -189,29 +193,30 @@ If the value is a list, all elements are used as index paths for namazu." location strategy &optional section unseen) (when (file-exists-p location) - (insert-file-contents-as-binary location) - (unless (or (std11-field-body "To") - (std11-field-body "Cc") - (std11-field-body "Subject")) - (let (charset guess uid) - (erase-buffer) - (set-buffer-multibyte t) - (insert-file-contents location) - (setq charset (detect-mime-charset-region (point-min) - (point-max))) - (goto-char (point-min)) - (setq guess (mime-find-file-type location)) - (setq uid (nth 2 (file-attributes location))) - (insert "From: " (concat (user-full-name uid) - " <"(user-login-name uid) "@" - (system-name) ">") "\n") - (insert "Subject: " location "\n") - (insert "Content-Type: " - (concat (nth 0 guess) "/" (nth 1 guess)) - "; charset=" (upcase (symbol-name charset)) - "\nMIME-Version: 1.0\n\n") - (encode-mime-charset-region (point-min) (point-max) charset) - (set-buffer-multibyte nil))))) + (prog1 + (insert-file-contents-as-binary (expand-file-name location)) + (unless (or (std11-field-body "To") + (std11-field-body "Cc") + (std11-field-body "Subject")) + (let (charset guess uid) + (erase-buffer) + (set-buffer-multibyte t) + (insert-file-contents (expand-file-name location)) + (setq charset (detect-mime-charset-region (point-min) + (point-max))) + (goto-char (point-min)) + (setq guess (mime-find-file-type location)) + (setq uid (nth 2 (file-attributes location))) + (insert "From: " (concat (user-full-name uid) + " <"(user-login-name uid) "@" + (system-name) ">") "\n") + (insert "Subject: " location "\n") + (insert "Content-Type: " + (concat (nth 0 guess) "/" (nth 1 guess)) + "; charset=" (upcase (symbol-name charset)) + "\nMIME-Version: 1.0\n\n") + (encode-mime-charset-region (point-min) (point-max) charset) + (set-buffer-multibyte nil)))))) (luna-define-method elmo-map-folder-list-message-locations ((folder elmo-nmz-folder)) @@ -233,38 +238,22 @@ If the value is a list, all elements are used as index paths for namazu." (goto-char (point-min)) (while (not (eobp)) (beginning-of-line) - (setq bol (if (looking-at "^file://") (match-end 0)(point))) + ;; convert url to file path. + (when (looking-at "^file://") + (replace-match "")) + (when (and elmo-nmz-use-drive-letter + (looking-at "^/\\([A-Za-z]\\)|/")) + (replace-match "\\1:/") + (beginning-of-line)) + (setq bol (point)) (end-of-line) (setq locations (cons (buffer-substring bol (point)) locations)) (forward-line 1)) - locations))) + (nreverse locations)))) (luna-define-method elmo-folder-exists-p ((folder elmo-nmz-folder)) t) -(luna-define-method elmo-folder-search ((folder elmo-nmz-folder) - condition &optional from-msgs) - (let* ((msgs (or from-msgs (elmo-folder-list-messages folder))) - (orig msgs) - (i 0) - case-fold-search matches - percent num - (num (length msgs))) - (while msgs - (if (elmo-file-field-condition-match - (elmo-map-message-location folder (car msgs)) - condition - (car msgs) - orig) - (setq matches (cons (car msgs) matches))) - (setq i (1+ i)) - (setq percent (/ (* i 100) num)) - (elmo-display-progress - 'elmo-nmz-search "Searching..." - percent) - (setq msgs (cdr msgs))) - matches)) - ;;; To override elmo-map-folder methods. (luna-define-method elmo-folder-list-unreads-internal ((folder elmo-nmz-folder) unread-marks &optional mark-alist)