| •1 |
;; -*- Mode: Emacs-Lisp -*- |
| 2 |
;; |
| 3 |
;; mew-nmz.el --- Namazu interfaces for Mew |
| 4 |
;; |
| 5 |
;; Author: Hideyuki SHIRAI |
| 6 |
;; Created: Dec 24, 2004 |
| 7 |
;; |
| 8 |
;; Put your ~/.mew.el |
| 9 |
;; (require 'mew-nmz) |
| 10 |
;; (setq mew-search-method 'namazu) |
| 11 |
;; |
| 12 |
|
| 13 |
(require 'mew) |
| 14 |
|
| 15 |
(eval-when-compile |
| 16 |
(condition-case nil |
| 17 |
(require 'w3m-namazu) |
| 18 |
(error nil))) |
| 19 |
|
| 20 |
;; Variables |
| 21 |
(defconst mew-nmz-version "2010-06-08") |
| 22 |
|
| 23 |
(defgroup mew-nmz nil |
| 24 |
"Namazu support with Mew." |
| 25 |
:group 'mew) |
| 26 |
|
| 27 |
(defcustom mew-nmz-index-path "~/Namazu" |
| 28 |
"*Namazu index top directory." |
| 29 |
:group 'mew-nmz |
| 30 |
:type 'directory) |
| 31 |
|
| 32 |
(defcustom mew-nmz-index-mail "Mail" |
| 33 |
"*Namazu index mail directory name." |
| 34 |
:group 'mew-nmz |
| 35 |
:type 'string) |
| 36 |
|
| 37 |
(defcustom mew-nmz-setup-hook nil |
| 38 |
"*Hook called on mew-nmz-setup." |
| 39 |
:group 'mew-nmz |
| 40 |
:type 'hook) |
| 41 |
|
| 42 |
(defcustom mew-nmz-prog "namazu" |
| 43 |
"*Namazu program name." |
| 44 |
:group 'mew-nmz |
| 45 |
:type 'string) |
| 46 |
|
| 47 |
(defcustom mew-nmz-prog-args nil |
| 48 |
"*Namazu's arguments." |
| 49 |
:group 'mew-nmz |
| 50 |
:type '(repeat string)) |
| 51 |
|
| 52 |
(defcustom mew-nmz-prog-mknmz "mknmz" |
| 53 |
"*Namazu make index program." |
| 54 |
:group 'mew-nmz |
| 55 |
:type 'string) |
| 56 |
|
| 57 |
(defcustom mew-nmz-prog-mknmz-args '("--decode-base64") |
| 58 |
"*Mknmz's argument, in addition to \"--no-encode-uri\", \"--mailnews\"." |
| 59 |
:group 'mew-nmz |
| 60 |
:type '(repeat string)) |
| 61 |
|
| 62 |
(defcustom mew-nmz-prog-mknmz-include "~/Namazu/mknmz-inc.pl" |
| 63 |
"*Include file for mknmz." |
| 64 |
:group 'mew-nmz |
| 65 |
:type 'file) |
| 66 |
|
| 67 |
(defcustom mew-nmz-mknmz-skip-folders-regexp |
| 68 |
(mapcar 'regexp-quote |
| 69 |
(delq nil |
| 70 |
`(,mew-draft-folder ,mew-trash-folder ,mew-queue-folder ,mew-attach-folder |
| 71 |
,mew-imap-queue-folder ,mew-imap-trash-folder ,mew-postq-folder |
| 72 |
,@mew-trash-folder-list ,@mew-imap-trash-folder-list |
| 73 |
"+schedule"))) |
| 74 |
"*Folders regexp to skip the index creating." |
| 75 |
:group 'mew-nmz |
| 76 |
:type '(repeat regexp)) |
| 77 |
|
| 78 |
(defcustom mew-nmz-mknmz-use-mode-line t |
| 79 |
"*Display indicator of namazu in mode line." |
| 80 |
:group 'mew-nmz |
| 81 |
:type 'boolean) |
| 82 |
|
| 83 |
(defcustom mew-nmz-line-id '("Mew(nmz): %7b") |
| 84 |
"*A value of mode-line-buffer-identification for Mew summary mode, when mknmzing." |
| 85 |
:group 'mew-nmz |
| 86 |
:type '(list string)) |
| 87 |
|
| 88 |
(defcustom mew-nmz-mknmz-timer-interval 0.1 |
| 89 |
"*Seconds of interval to execute next mknmz." |
| 90 |
:group 'mew-nmz |
| 91 |
:type 'number) |
| 92 |
|
| 93 |
(defcustom mew-nmz-pick-default-field nil |
| 94 |
"*Default prefix string to be appeared when inputting a namazu pick pattern. |
| 95 |
A good example is \"+from:\"." |
| 96 |
:group 'mew-nmz |
| 97 |
:type '(choice string (const nil))) |
| 98 |
|
| 99 |
(defcustom mew-nmz-pick-field-list |
| 100 |
'("subject=" "from=" "to=" "newsgroups=" "date=" |
| 101 |
"message-id=" "cc=" "in-reply-to=" "references=") |
| 102 |
"*A list of key for namazu pick pattern." |
| 103 |
:group 'mew-nmz |
| 104 |
:type '(repeat string)) |
| 105 |
|
| 106 |
(defcustom mew-nmz-pick-gather-field-list |
| 107 |
`((,mew-from: address "from=" "to=" "cc=") |
| 108 |
(,mew-to: address "from=" "to=" "cc=") |
| 109 |
(,mew-cc: address "from=" "to=" "cc=") |
| 110 |
(,mew-message-id: msgid "message-id=" "in-reply-to=" "references=") |
| 111 |
(,mew-in-reply-to: msgid "message-id=" "in-reply-to=" "references=") |
| 112 |
(,mew-references: msgid "message-id=" "in-reply-to=" "references=")) |
| 113 |
"*A list of completion keyword from message." |
| 114 |
:group 'mew-nmz |
| 115 |
:type '(repeat (list string |
| 116 |
(choice (const address) (const msgid)) |
| 117 |
string string string))) |
| 118 |
|
| 119 |
(defcustom mew-nmz-search-parent-folder `(,mew-inbox-folder) |
| 120 |
"*Search folder for parent or child, " |
| 121 |
:group 'mew-nmz |
| 122 |
:type '(repeat string)) |
| 123 |
|
| 124 |
(defcustom mew-nmz-db-max 64 |
| 125 |
"*Namazu max index. |
| 126 |
This value MUST be less then equal `INDEX_MAX' of libnamazu.h." |
| 127 |
:group 'mew-nmz |
| 128 |
:type 'integer) |
| 129 |
|
| 130 |
(defcustom mew-nmz-query-max-length 256 |
| 131 |
"*Namazu query string max length. |
| 132 |
This value MUST be less then equal `QUERY_MAX' of libnamazu.h." |
| 133 |
:group 'mew-nmz |
| 134 |
:type 'integer) |
| 135 |
|
| 136 |
(defcustom mew-nmz-mark-pick mew-mark-review |
| 137 |
"*Mark for Namazu pick." |
| 138 |
:group 'mew-nmz |
| 139 |
:type 'character) |
| 140 |
|
| 141 |
(defcustom mew-nmz-mark-unindexed mew-mark-review |
| 142 |
"*Mark for type unindexed messages." |
| 143 |
:group 'mew-nmz |
| 144 |
:type 'character) |
| 145 |
|
| 146 |
(defcustom mew-ask-virtual-folder-name nil |
| 147 |
"*If *non-nil*, ask a virtual folder name." |
| 148 |
:group 'mew-summary |
| 149 |
:type 'boolean) |
| 150 |
|
| 151 |
(defcustom mew-nmz-cache-file-prefix ".mew-nmz-" |
| 152 |
"*Prefix of the cache filename. Expand with mew-conf-path when use it." |
| 153 |
:group 'mew-nmz |
| 154 |
:type 'string) |
| 155 |
|
| 156 |
(defcustom mew-nmz-mknmz-index-file ".mewmknmz" |
| 157 |
"*File name of the input file of mewmknmz. Expand with mew-conf-path when use it." |
| 158 |
:group 'mew-nmz |
| 159 |
:type 'string) |
| 160 |
|
| 161 |
(defcustom mew-nmz-input-folders-asterisk t |
| 162 |
"*Add \"*\" at the end of input folder name." |
| 163 |
:group 'mew-nmz |
| 164 |
:type 'boolean) |
| 165 |
|
| 166 |
(defcustom mew-nmz-prog-gcnmz "gcnmz" |
| 167 |
"*Program name for the garbage collection." |
| 168 |
:group 'mew-nmz |
| 169 |
:type 'string) |
| 170 |
|
| 171 |
(defcustom mew-nmz-use-gcnmz-folders-regexp `(,(regexp-quote mew-inbox-folder)) |
| 172 |
"*Folders regexp to execute gcnmz." |
| 173 |
:group 'mew-nmz |
| 174 |
:type '(repeat regexp)) |
| 175 |
|
| 176 |
(defcustom mew-nmz-gcnmz-line-id '("Mew(gcn): %7b") |
| 177 |
"*A value of mode-line-buffer-identification for Mew summary mode, when gcnmzing." |
| 178 |
:group 'mew-nmz |
| 179 |
:type '(list string)) |
| 180 |
|
| 181 |
(defcustom mew-nmz-prog-rfnmz "rfnmz" |
| 182 |
"*Program name for the re-index." |
| 183 |
:group 'mew-nmz |
| 184 |
:type 'string) |
| 185 |
|
| 186 |
(defcustom mew-nmz-mknmz-index-file-coding-system |
| 187 |
(when (boundp 'default-file-name-coding-system) |
| 188 |
default-file-name-coding-system) |
| 189 |
"*Coding system of index-file." |
| 190 |
:group 'mew-nmz |
| 191 |
:type '(coding-system :size 0)) |
| 192 |
|
| 193 |
;; internal variable, don't modify. |
| 194 |
(defvar mew-nmz-gather-header-list nil) |
| 195 |
(defvar mew-nmz-indexed-folders nil) |
| 196 |
|
| 197 |
(defvar mew-nmz-input-folder-hist nil) |
| 198 |
|
| 199 |
(defvar mew-nmz-mknmz-process nil) |
| 200 |
(defvar mew-nmz-mknmz-process-folder nil) |
| 201 |
(defvar mew-nmz-mknmz-process-file nil) |
| 202 |
|
| 203 |
(make-variable-buffer-local 'mew-nmz-mknmz-process) |
| 204 |
(make-variable-buffer-local 'mew-nmz-mknmz-process-folder) |
| 205 |
(make-variable-buffer-local 'mew-nmz-mknmz-process-file) |
| 206 |
|
| 207 |
(defconst mew-nmz-namazu-index-alias "_mew-namazu" |
| 208 |
"*Alias name for mew-nmz-namazu.") |
| 209 |
(defvar mew-nmz-namazu-content-type "message/mew") |
| 210 |
(defvar mew-nmz-namazu-pattern nil) |
| 211 |
(defvar mew-nmz-namazu-miss-folders nil) |
| 212 |
|
| 213 |
(defvar mew-nmz-setup-p nil) |
| 214 |
(defvar mew-nmz-imap-case-alist nil) |
| 215 |
(defvar mew-nmz-nntp-case-alist nil) |
| 216 |
(defvar mew-nmz-pop-case-alist nil) |
| 217 |
(defvar mew-nmz-fld-index-alist nil) |
| 218 |
(defvar mew-nmz-url-fld-alist nil) |
| 219 |
(defvar mew-nmz-mknmz-all-folders nil) |
| 220 |
(defvar mew-nmz-mknmz-continue-timer nil) |
| 221 |
|
| 222 |
(defvar mew-nmz-mknmz-lang-alist |
| 223 |
'(("Japanese" "ja"))) |
| 224 |
|
| 225 |
(defvar mew-nmz-cs-index (cond |
| 226 |
((mew-coding-system-p 'euc-japan-unix) |
| 227 |
'euc-japan-unix) |
| 228 |
((mew-coding-system-p 'euc-jp-unix) |
| 229 |
'euc-jp-unix) |
| 230 |
(t mew-cs-text-for-write)) |
| 231 |
"*Coding system to write 'NMZ.field.uri'.") |
| 232 |
|
| 233 |
(defconst mew-nmz-result-regex |
| 234 |
(concat "^\\(.*\\)" (regexp-quote mew-path-separator) "\\([0-9]+\\)")) |
| 235 |
|
| 236 |
(defconst mew-nmz-use-drive-letter |
| 237 |
(memq system-type '(OS/2 emx windows-nt cygwin))) |
| 238 |
|
| 239 |
;; Set up |
| 240 |
(defvar mew-nmz-search-method `(namazu "Namazu" ,mew-nmz-prog |
| 241 |
mew-nmz-search |
| 242 |
mew-nmz-search-virtual |
| 243 |
mew-nmz-mknmz |
| 244 |
mew-nmz-mknmz-all-folders |
| 245 |
mew-nmz-pick-canonicalize-pattern)) |
| 246 |
|
| 247 |
(eval-after-load "mew-search" |
| 248 |
`(setq mew-search-switch |
| 249 |
(cons mew-nmz-search-method mew-search-switch))) |
| 250 |
|
| 251 |
;; (define-key mew-summary-mode-map "k" (make-sparse-keymap)) |
| 252 |
;; (define-key mew-summary-mode-map "kc" 'mew-summary-search-change-method) |
| 253 |
;; (define-key mew-summary-mode-map "k?" 'mew-summary-search) |
| 254 |
;; (define-key mew-summary-mode-map "k/" 'mew-summary-selection-by-search) |
| 255 |
;; (define-key mew-summary-mode-map "km" 'mew-summary-make-index-folder) |
| 256 |
;; (define-key mew-summary-mode-map "kM" 'mew-summary-make-index-all) |
| 257 |
|
| 258 |
(add-hook 'mew-summary-mode-hook |
| 259 |
(lambda () |
| 260 |
(define-key mew-summary-mode-map "kg" 'mew-nmz-gcnmz) |
| 261 |
(define-key mew-summary-mode-map "ks" 'mew-nmz-mknmz-save-mewmknmz) |
| 262 |
(define-key mew-summary-mode-map "kK" 'mew-nmz-mknmz-kill-process) |
| 263 |
(define-key mew-summary-mode-map "ku" 'mew-nmz-mark-unindexed) |
| 264 |
(define-key mew-summary-mode-map "k^" 'mew-nmz-search-parent) |
| 265 |
(define-key mew-summary-mode-map "kp" 'mew-nmz-search-parent) |
| 266 |
(define-key mew-summary-mode-map "kn" 'mew-nmz-search-child) |
| 267 |
(define-key mew-summary-mode-map "kN" 'mew-nmz-namazu) |
| 268 |
(define-key mew-summary-mode-map "kj" 'mew-nmz-jump-message))) |
| 269 |
|
| 270 |
(add-hook 'mew-message-mode-hook |
| 271 |
(lambda () |
| 272 |
(define-key mew-message-mode-map "k" (make-sparse-keymap)) |
| 273 |
(define-key mew-message-mode-map "kp" 'mew-nmz-search-msgid-at-point) |
| 274 |
(define-key mew-message-mode-map "kr" 'mew-nmz-search-msgid-region))) |
| 275 |
|
| 276 |
(defun mew-nmz-pick-field-list () |
| 277 |
(let ((lst (append mew-pick-field-list |
| 278 |
mew-nmz-pick-field-list |
| 279 |
(mew-nmz-pick-pattern-gather-header)))) |
| 280 |
(mew-uniq-list lst))) |
| 281 |
|
| 282 |
(defadvice mew-summary-search (around mew-nmz activate compile) |
| 283 |
"Use mew-nmz gather-header." |
| 284 |
(if (eq mew-search-method 'namazu) |
| 285 |
(let ((mew-pick-field-list (mew-nmz-pick-field-list))) |
| 286 |
ad-do-it) |
| 287 |
ad-do-it)) |
| 288 |
|
| 289 |
(defadvice mew-summary-selection-by-search (around mew-nmz activate compile) |
| 290 |
"Use mew-nmz gather-header." |
| 291 |
(if (eq mew-search-method 'namazu) |
| 292 |
(let ((mew-pick-field-list (mew-nmz-pick-field-list))) |
| 293 |
ad-do-it) |
| 294 |
ad-do-it)) |
| 295 |
|
| 296 |
(add-hook 'mew-summary-rename-folder-hook 'mew-nmz-folder-index-rename) |
| 297 |
(add-hook 'mew-summary-delete-folder-hook 'mew-nmz-folder-index-delete) |
| 298 |
(add-hook 'mew-status-update-hook 'mew-nmz-status-update) |
| 299 |
(add-hook 'mew-quit-hook 'mew-nmz-cleanup) |
| 300 |
|
| 301 |
(when (and (featurep 'mw32script) |
| 302 |
(fboundp 'define-process-argument-editing)) |
| 303 |
;; Argument setting for mknmz.bat, gcnmz.bat, rfnmz.bat |
| 304 |
(let ((progs '("mknmz" "gcnmz" "rfnmz")) |
| 305 |
prog) |
| 306 |
(while progs |
| 307 |
(setq prog (mew-which-exec (car progs))) |
| 308 |
(setq progs (cdr progs)) |
| 309 |
(when (and prog (string-match "\\.bat$" prog)) |
| 310 |
(setq prog (regexp-quote prog)) |
| 311 |
;; (general-process-argument-editing-function |
| 312 |
;; ARGUMENT QUOTING ARGV0ISP &optional EP H2SP QP S2ISP) |
| 313 |
(define-process-argument-editing |
| 314 |
prog |
| 315 |
(lambda (x) (general-process-argument-editing-function x nil nil)) |
| 316 |
'first))))) |
| 317 |
|
| 318 |
;; macro |
| 319 |
(defmacro mew-nmz-imap-directory-file-name (fld case) |
| 320 |
`(condition-case nil |
| 321 |
(mew-imap-directory-file-name ,fld ,case) |
| 322 |
(error ,fld))) |
| 323 |
|
| 324 |
(defmacro mew-nmz-cache-file-name (part) |
| 325 |
`(expand-file-name (concat mew-nmz-cache-file-prefix |
| 326 |
(symbol-name ,part) |
| 327 |
"-alist") |
| 328 |
mew-conf-path)) |
| 329 |
|
| 330 |
(defmacro mew-nmz-cache-alist-name (part) |
| 331 |
`(intern (concat "mew-nmz-" (symbol-name ,part) "-alist"))) |
| 332 |
|
| 333 |
(defsubst mew-nmz-expand-folder (case:folder) |
| 334 |
"Convert case:folder to the directory name of namazu's index." |
| 335 |
(let* ((fld (mew-case:folder-folder case:folder)) |
| 336 |
(imapp (mew-folder-imapp fld)) |
| 337 |
(mew-mail-path (concat (file-name-as-directory mew-nmz-index-path) |
| 338 |
mew-nmz-index-mail)) |
| 339 |
(nmzdir (directory-file-name (mew-expand-folder case:folder)))) |
| 340 |
(if (not imapp) |
| 341 |
nmzdir |
| 342 |
(while (string-match "[][]" nmzdir) |
| 343 |
(setq nmzdir (concat (substring nmzdir 0 (match-beginning 0)) |
| 344 |
"%%" |
| 345 |
(substring nmzdir (match-end 0))))) |
| 346 |
nmzdir))) |
| 347 |
|
| 348 |
(defsubst mew-nmz-case-folder-normalize (case:folder) |
| 349 |
(let ((case (mew-case:folder-case case:folder)) |
| 350 |
(fld (mew-case:folder-folder case:folder)) |
| 351 |
(newcase "")) |
| 352 |
(setq fld (directory-file-name fld)) |
| 353 |
(when (mew-folder-imapp fld) |
| 354 |
(setq fld (mew-nmz-imap-directory-file-name fld case))) |
| 355 |
(cond |
| 356 |
((or (string= fld "") |
| 357 |
(string= fld "*") |
| 358 |
(mew-folder-imapp fld)) |
| 359 |
(setq newcase (or (cdr (assoc case mew-nmz-imap-case-alist)) ""))) |
| 360 |
((mew-folder-popp fld) |
| 361 |
(setq newcase (or (cdr (assoc case mew-nmz-pop-case-alist)) ""))) |
| 362 |
((mew-folder-nntpp fld) |
| 363 |
(setq newcase (or (cdr (assoc case mew-nmz-nntp-case-alist)) "")))) |
| 364 |
(if (string= newcase "") |
| 365 |
fld |
| 366 |
(concat newcase ":" fld)))) |
| 367 |
|
| 368 |
(defsubst mew-nmz-case-normalize (case:folder) |
| 369 |
(let ((case (mew-case:folder-case case:folder)) |
| 370 |
(fld (mew-case:folder-folder case:folder)) |
| 371 |
(newcase "")) |
| 372 |
(cond |
| 373 |
((or (string= fld "") |
| 374 |
(string= fld "*") |
| 375 |
(mew-folder-imapp fld)) |
| 376 |
(setq newcase (or (cdr (assoc case mew-nmz-imap-case-alist)) ""))) |
| 377 |
((mew-folder-popp fld) |
| 378 |
(setq newcase (or (cdr (assoc case mew-nmz-pop-case-alist)) ""))) |
| 379 |
((mew-folder-nntpp fld) |
| 380 |
(setq newcase (or (cdr (assoc case mew-nmz-nntp-case-alist)) "")))) |
| 381 |
newcase)) |
| 382 |
|
| 383 |
(defsubst mew-nmz-folder-to-nmzdir (folder) |
| 384 |
(mew-nmz-setup) |
| 385 |
(cdr (assoc (directory-file-name folder) mew-nmz-fld-index-alist))) |
| 386 |
|
| 387 |
(defsubst mew-nmz-url-to-folder (url) |
| 388 |
(mew-nmz-setup) |
| 389 |
(when (and mew-nmz-use-drive-letter |
| 390 |
(string-match "^/\\([a-zA-Z]\\)|\\(/.*\\)" url)) |
| 391 |
(setq url (concat |
| 392 |
(substring url (match-beginning 1) (match-end 1)) |
| 393 |
":" |
| 394 |
(substring url (match-beginning 2) (match-end 2))))) |
| 395 |
(cdr (assoc (expand-file-name url) mew-nmz-url-fld-alist))) |
| 396 |
|
| 397 |
(defsubst mew-nmz-indexed-folder-p (fld) |
| 398 |
(let ((nmzdir (mew-nmz-expand-folder fld))) |
| 399 |
(and nmzdir |
| 400 |
(file-directory-p nmzdir) |
| 401 |
(file-exists-p (expand-file-name "NMZ.i" nmzdir))))) |
| 402 |
|
| 403 |
;; Mew interface |
| 404 |
(defun mew-nmz-search (pattern folder &rest args) |
| 405 |
(mew-nmz-multi-pick |
| 406 |
(list (mew-nmz-expand-folder folder)) pattern nil 'single)) |
| 407 |
|
| 408 |
(defun mew-nmz-search-virtual (pattern flds &rest args) |
| 409 |
(mew-nmz-setup) |
| 410 |
(let* ((nmzdirs (mew-nmz-flds-to-indexs (or flds (list "*:*")))) |
| 411 |
(fldmsgs (mew-nmz-multi-pick nmzdirs pattern nil)) |
| 412 |
(file (mew-make-temp-name)) |
| 413 |
(rttl 0) |
| 414 |
fld) |
| 415 |
(with-temp-buffer |
| 416 |
(dolist (fldmsg fldmsgs) |
| 417 |
(setq fld (car fldmsg)) |
| 418 |
(unless (mew-folder-localp fld) |
| 419 |
(setq fld (mew-path-to-folder (mew-expand-folder fld)))) |
| 420 |
(insert (format "CD:%s\n" fld)) |
| 421 |
(dolist (msg (cdr fldmsg)) |
| 422 |
(insert msg "\n") |
| 423 |
(setq rttl (1+ rttl)))) |
| 424 |
(mew-frwlet |
| 425 |
mew-cs-text-for-read mew-cs-text-for-write |
| 426 |
(write-region (point-min) (point-max) file nil 'no-msg))) |
| 427 |
(list file rttl))) |
| 428 |
|
| 429 |
;; codes |
| 430 |
(defun mew-nmz-jump-message () |
| 431 |
"Jump to physical folder and message from virtual folder |
| 432 |
or jump to virtual folder from physical folder." |
| 433 |
(interactive) |
| 434 |
(let ((disp (mew-sinfo-get-disp-msg)) |
| 435 |
fld msg) |
| 436 |
(cond |
| 437 |
((mew-thread-p) |
| 438 |
(mew-summary-goto-message) |
| 439 |
(setq fld (or (mew-vinfo-get-original-folder) |
| 440 |
(mew-vinfo-get-physical-folder))) |
| 441 |
(setq msg (mew-summary-message-number))) |
| 442 |
((mew-virtual-p) |
| 443 |
(mew-summary-goto-message) |
| 444 |
(setq fld (mew-summary-folder-name)) |
| 445 |
(setq msg (mew-summary-message-number))) |
| 446 |
(t |
| 447 |
(setq fld (mew-summary-folder-name)) |
| 448 |
(setq msg (mew-summary-message-number)) |
| 449 |
(save-excursion |
| 450 |
(let ((regex (format "\r %s %s[^0-9]" (regexp-quote fld) msg))) |
| 451 |
(setq fld (catch 'detect |
| 452 |
(dolist (buf (delq (current-buffer) (buffer-list))) |
| 453 |
(set-buffer buf) |
| 454 |
(save-excursion |
| 455 |
(when (and (mew-virtual-p) |
| 456 |
(or (re-search-forward regex nil t) |
| 457 |
(re-search-backward regex nil t))) |
| 458 |
(throw 'detect (buffer-name buf))))) |
| 459 |
nil)))))) |
| 460 |
(if (not fld) |
| 461 |
(message "Nothing to do") |
| 462 |
(mew-nmz-goto-folder-msg fld msg nil disp) |
| 463 |
(message "Jump to %s/%s" fld msg)))) |
| 464 |
|
| 465 |
(defun mew-nmz-mknmz-lang-arg () |
| 466 |
(when (boundp 'current-language-environment) |
| 467 |
(let* ((env current-language-environment) |
| 468 |
(alist mew-nmz-mknmz-lang-alist) |
| 469 |
(lang (nth 1 (assoc env alist)))) |
| 470 |
(if lang (format "--indexing-lang=%s" lang))))) |
| 471 |
|
| 472 |
;; "Make Index" functions. |
| 473 |
(defun mew-nmz-mknmz (&optional fld all disp) |
| 474 |
"Make namazu index for mew-nmz. |
| 475 |
If executed with '\\[universal-argument]', make indices without the check of timestamp files. |
| 476 |
If executed with '\\[universal-argument] 0', remove indices before make index." |
| 477 |
(interactive |
| 478 |
(list (directory-file-name |
| 479 |
(mew-input-folder (mew-sinfo-get-case) |
| 480 |
(or (mew-sinfo-get-folder) mew-inbox-folder))) |
| 481 |
nil)) |
| 482 |
(save-excursion |
| 483 |
(let ((msgenb (or (interactive-p) |
| 484 |
(eq this-command 'mew-summary-make-index-folder) |
| 485 |
disp)) |
| 486 |
(force (and current-prefix-arg |
| 487 |
(not (eq current-prefix-arg 0)))) |
| 488 |
(remove (eq current-prefix-arg 0)) |
| 489 |
(flddir (mew-expand-folder fld)) |
| 490 |
(nmzdir (mew-nmz-expand-folder fld)) |
| 491 |
(bufname (format "%s*Mew* mknmz*%s" |
| 492 |
(if (memq mew-debug '(namazu t)) "" " ") |
| 493 |
fld)) |
| 494 |
(args mew-nmz-prog-mknmz-args) |
| 495 |
(procname (concat mew-nmz-prog-mknmz "-" fld)) |
| 496 |
(procname2 (concat mew-nmz-prog-gcnmz "-" fld)) |
| 497 |
(incfile (and mew-nmz-prog-mknmz-include |
| 498 |
(expand-file-name mew-nmz-prog-mknmz-include))) |
| 499 |
(tmpfile (mew-make-temp-name)) |
| 500 |
flist continue) |
| 501 |
(unless fld |
| 502 |
(setq fld (directory-file-name |
| 503 |
(mew-input-folder (mew-sinfo-get-case) (mew-sinfo-get-folder))))) |
| 504 |
(cond |
| 505 |
((not (mew-which-exec mew-nmz-prog-mknmz)) |
| 506 |
(message "Please install mknmz")) |
| 507 |
((or (mew-folder-virtualp fld) (mew-nmz-skip-folder-p fld)) |
| 508 |
(and msgenb (message "Cannot make namazu index in %s" fld)) |
| 509 |
(setq continue t)) |
| 510 |
((or (get-process procname) (get-process procname2)) |
| 511 |
(and msgenb (message "Detect running mknmz/gcnmz process in %s" fld)) |
| 512 |
(setq continue t)) |
| 513 |
((and (not remove) (not force) (mew-nmz-index-new-p fld)) |
| 514 |
(and msgenb (message "%s has a newer namazu index" fld)) |
| 515 |
(setq continue t)) |
| 516 |
((and (not remove) (file-exists-p (expand-file-name "NMZ.lock2" nmzdir))) |
| 517 |
(message "Something error in %s's index" fld) |
| 518 |
(setq continue t)) |
| 519 |
((not (setq flist (mew-dir-messages (file-chase-links flddir) |
| 520 |
nil 'full))) |
| 521 |
(and msgenb (message "%s has no message" fld)) |
| 522 |
(mew-nmz-index-delete nmzdir) |
| 523 |
(setq continue t)) |
| 524 |
((and flddir nmzdir (file-directory-p flddir)) |
| 525 |
(with-temp-buffer |
| 526 |
(dolist (file flist) |
| 527 |
(insert file "\n")) |
| 528 |
(mew-frwlet |
| 529 |
mew-cs-autoconv mew-cs-text-for-write |
| 530 |
(write-region (point-min) (point-max) tmpfile nil 'nomsg))) |
| 531 |
(setq args (delq nil |
| 532 |
(append args |
| 533 |
(list "--no-encode-uri" |
| 534 |
;; "--mailnews" |
| 535 |
(mew-nmz-mknmz-lang-arg) |
| 536 |
(when (and incfile (file-exists-p incfile)) |
| 537 |
(format "--include=%s" incfile)) |
| 538 |
(format "--target-list=%s" tmpfile) |
| 539 |
;; (format "--exclude=%s" |
| 540 |
;; (expand-file-name ".+/" flddir)) |
| 541 |
(format "--output-dir=%s" nmzdir))))) |
| 542 |
;; flddir)))) |
| 543 |
(unless (file-directory-p nmzdir) |
| 544 |
(mew-make-directory nmzdir)) |
| 545 |
(when remove |
| 546 |
(mew-nmz-index-delete nmzdir)) |
| 547 |
(set-buffer (get-buffer-create bufname)) |
| 548 |
(erase-buffer) |
| 549 |
;; folder set |
| 550 |
(and msgenb (message "Namazu indexing for %s..." fld)) |
| 551 |
(insert (format "mew-mknmz-prog: %s\nmew-mknmz-args: %s\n" |
| 552 |
(mew-which-exec mew-nmz-prog-mknmz) |
| 553 |
(mapconcat 'identity args " "))) |
| 554 |
(mew-nmz-timestamp-new fld) |
| 555 |
(mew-piolet |
| 556 |
mew-cs-autoconv mew-cs-text-for-write |
| 557 |
(setq mew-nmz-mknmz-process |
| 558 |
(apply (function start-process) |
| 559 |
procname (current-buffer) mew-nmz-prog-mknmz args))) |
| 560 |
(setq mew-nmz-mknmz-process-folder fld) |
| 561 |
(setq mew-nmz-mknmz-process-file tmpfile) |
| 562 |
(set-process-sentinel mew-nmz-mknmz-process 'mew-nmz-mknmz-sentinel) |
| 563 |
(when (and mew-nmz-mknmz-use-mode-line |
| 564 |
fld (get-buffer fld) (buffer-name (get-buffer fld))) |
| 565 |
(save-excursion |
| 566 |
(set-buffer (get-buffer fld)) |
| 567 |
(setq mode-line-buffer-identification mew-nmz-line-id) |
| 568 |
(set-buffer-modified-p nil))))) |
| 569 |
(when (and continue all mew-nmz-mknmz-all-folders) |
| 570 |
(mew-nmz-mknmz-continue-with-timer))))) |
| 571 |
|
| 572 |
(defun mew-nmz-mknmz-continue-with-timer () |
| 573 |
(unless mew-nmz-mknmz-continue-timer |
| 574 |
(setq mew-nmz-mknmz-continue-timer |
| 575 |
(run-at-time mew-nmz-mknmz-timer-interval nil 'mew-nmz-mknmz-continue)))) |
| 576 |
|
| 577 |
(defun mew-nmz-mknmz-continue () |
| 578 |
(when mew-nmz-mknmz-continue-timer |
| 579 |
(cancel-timer mew-nmz-mknmz-continue-timer) |
| 580 |
(setq mew-nmz-mknmz-continue-timer nil)) |
| 581 |
(setq mew-nmz-mknmz-all-folders (cdr mew-nmz-mknmz-all-folders)) |
| 582 |
(if mew-nmz-mknmz-all-folders |
| 583 |
(mew-nmz-mknmz (car mew-nmz-mknmz-all-folders) 'all) |
| 584 |
(ding) |
| 585 |
(message "All mknmz done"))) |
| 586 |
|
| 587 |
(defun mew-nmz-mknmz-sentinel (process event) |
| 588 |
(save-excursion |
| 589 |
(set-buffer (process-buffer process)) |
| 590 |
(let* ((fld mew-nmz-mknmz-process-folder) |
| 591 |
(nmzdir (mew-nmz-expand-folder fld)) |
| 592 |
msg success) |
| 593 |
(when (and (file-exists-p mew-nmz-mknmz-process-file) |
| 594 |
(file-writable-p mew-nmz-mknmz-process-file)) |
| 595 |
(delete-file mew-nmz-mknmz-process-file)) |
| 596 |
(goto-char (point-min)) |
| 597 |
(if (search-forward-regexp "^ERROR:.*$" nil t) |
| 598 |
(progn |
| 599 |
(setq msg (format "Mew mknmz (%s)...%s" fld (match-string 0))) |
| 600 |
(condition-case nil |
| 601 |
(progn |
| 602 |
(mew-nmz-index-delete nmzdir 'tmpfiles) |
| 603 |
(delete-file (expand-file-name "NMZ.lock2" nmzdir)) |
| 604 |
(delete-file (expand-file-name "NMZ.stamp.new" nmzdir))) |
| 605 |
(error nil))) |
| 606 |
(setq success t) |
| 607 |
(mew-nmz-timestamp-rename fld) |
| 608 |
(setq msg (format "Namazu indexing %s...done" fld)) |
| 609 |
(when mew-nmz-setup-p |
| 610 |
(setq fld (mew-nmz-case-folder-normalize fld)) |
| 611 |
(unless (mew-nmz-folder-to-nmzdir fld) |
| 612 |
(setq mew-nmz-fld-index-alist |
| 613 |
(cons (cons fld nmzdir) mew-nmz-fld-index-alist)) |
| 614 |
(setq mew-nmz-url-fld-alist |
| 615 |
(cons (cons (mew-expand-folder fld) fld) |
| 616 |
mew-nmz-url-fld-alist)) |
| 617 |
(mew-nmz-cache-save)))) |
| 618 |
(setq mew-nmz-mknmz-process nil) |
| 619 |
(setq mew-nmz-mknmz-process-folder nil) |
| 620 |
(when (and mew-nmz-mknmz-use-mode-line |
| 621 |
fld (get-buffer fld) (buffer-name (get-buffer fld))) |
| 622 |
(save-excursion |
| 623 |
(set-buffer (get-buffer fld)) |
| 624 |
(setq mode-line-buffer-identification |
| 625 |
(if (fboundp 'mew-mode-line-id) |
| 626 |
(mew-mode-line-id) |
| 627 |
mew-mode-line-id)) |
| 628 |
(set-buffer-modified-p nil))) |
| 629 |
(set-buffer-modified-p nil) |
| 630 |
(unless (memq mew-debug '(namazu t)) |
| 631 |
(kill-buffer (current-buffer))) |
| 632 |
(message "%s" msg) |
| 633 |
(when (and success (mew-nmz-gcnmz-folder-p fld)) |
| 634 |
(mew-nmz-gcnmz fld nmzdir)) |
| 635 |
(when mew-nmz-mknmz-all-folders |
| 636 |
(mew-nmz-mknmz-continue-with-timer))))) |
| 637 |
|
| 638 |
(defun mew-nmz-gcnmz (&optional fld nmzdir) |
| 639 |
"Garbage collection for mew-nmz." |
| 640 |
(interactive |
| 641 |
(list (directory-file-name |
| 642 |
(mew-input-folder (mew-sinfo-get-case) |
| 643 |
(or (mew-sinfo-get-folder) mew-inbox-folder))) |
| 644 |
nil)) |
| 645 |
(unless nmzdir |
| 646 |
(setq nmzdir (mew-nmz-expand-folder fld))) |
| 647 |
(if (and (mew-which-exec mew-nmz-prog-gcnmz) |
| 648 |
(file-directory-p nmzdir) |
| 649 |
(file-exists-p (expand-file-name "NMZ.i" nmzdir))) |
| 650 |
(let ((buf (get-buffer-create |
| 651 |
(format "%s*Mew* gcnmz*%s" |
| 652 |
(if (memq mew-debug '(namazu t)) "" " ") |
| 653 |
fld))) |
| 654 |
(procname (concat mew-nmz-prog-gcnmz "-" fld)) |
| 655 |
(args `("--no-backup" ,nmzdir)) |
| 656 |
process) |
| 657 |
(save-excursion |
| 658 |
(set-buffer buf) |
| 659 |
(erase-buffer) |
| 660 |
(setq mew-nmz-mknmz-process-folder fld) |
| 661 |
(message "Mew gcnmz (%s)..." mew-nmz-mknmz-process-folder) |
| 662 |
(insert (format "mew-gcnmz-prog: %s\nmew-gcnmz-args: %s\n" |
| 663 |
(mew-which-exec mew-nmz-prog-gcnmz) |
| 664 |
(mapconcat 'identity args " "))) |
| 665 |
(setq process |
| 666 |
(apply (function start-process) |
| 667 |
procname (current-buffer) mew-nmz-prog-gcnmz args)) |
| 668 |
(set-process-sentinel process 'mew-nmz-gcnmz-sentinel) |
| 669 |
(when (and mew-nmz-mknmz-use-mode-line |
| 670 |
fld (get-buffer fld) (buffer-name (get-buffer fld))) |
| 671 |
(save-excursion |
| 672 |
(set-buffer (get-buffer fld)) |
| 673 |
(setq mode-line-buffer-identification mew-nmz-gcnmz-line-id) |
| 674 |
(set-buffer-modified-p nil))))) |
| 675 |
(when (interactive-p) |
| 676 |
(message "gcnmz cannot run on %s" fld)))) |
| 677 |
|
| 678 |
(defun mew-nmz-gcnmz-sentinel (process event) |
| 679 |
(when (buffer-name (process-buffer process)) |
| 680 |
(set-buffer (process-buffer process)) |
| 681 |
(let ((fld mew-nmz-mknmz-process-folder)) |
| 682 |
(if (and fld event (stringp event) (string= event "kill")) |
| 683 |
(progn |
| 684 |
(message "Mew gcnmz (%s)...kill from user" fld) |
| 685 |
(condition-case nil |
| 686 |
(mew-nmz-index-delete (mew-nmz-expand-folder fld) 'tmpfiles) |
| 687 |
(error nil))) |
| 688 |
(message "Mew gcnmz (%s)...done" fld)) |
| 689 |
(when (and mew-nmz-mknmz-use-mode-line |
| 690 |
fld (get-buffer fld) (buffer-name (get-buffer fld))) |
| 691 |
(save-excursion |
| 692 |
(set-buffer (get-buffer fld)) |
| 693 |
(setq mode-line-buffer-identification |
| 694 |
(if (fboundp 'mew-mode-line-id) |
| 695 |
(mew-mode-line-id) |
| 696 |
mew-mode-line-id)) |
| 697 |
(set-buffer-modified-p nil))) |
| 698 |
(unless (memq mew-debug '(namazu t)) |
| 699 |
(kill-buffer (current-buffer)))))) |
| 700 |
|
| 701 |
(defun mew-nmz-mknmz-kill-process () |
| 702 |
"Kill the all processes of mknmz." |
| 703 |
(interactive) |
| 704 |
(when mew-nmz-mknmz-continue-timer |
| 705 |
(cancel-timer mew-nmz-mknmz-continue-timer) |
| 706 |
(setq mew-nmz-mknmz-continue-timer nil)) |
| 707 |
(let ((proc-list (process-list)) |
| 708 |
(regex1 (concat "^" mew-nmz-prog-mknmz "-")) |
| 709 |
(regex2 (concat "^" mew-nmz-prog-gcnmz "-")) |
| 710 |
buf kill) |
| 711 |
(dolist (process proc-list) |
| 712 |
(cond |
| 713 |
((string-match regex1 (process-name process)) |
| 714 |
;; mknmz |
| 715 |
(setq buf (process-buffer process)) |
| 716 |
(when (buffer-name buf) |
| 717 |
(save-excursion |
| 718 |
(set-buffer buf) |
| 719 |
(set-process-sentinel process 'ignore) |
| 720 |
(goto-char (point-max)) |
| 721 |
(insert "\nERROR: Kill from user.\n") |
| 722 |
(kill-process process) |
| 723 |
(mew-nmz-mknmz-sentinel process "kill") |
| 724 |
(setq kill t)))) |
| 725 |
((string-match regex2 (process-name process)) |
| 726 |
;; gcnmz |
| 727 |
(setq buf (process-buffer process)) |
| 728 |
(when (buffer-name buf) |
| 729 |
(set-process-sentinel process 'ignore) |
| 730 |
(kill-process process) |
| 731 |
(mew-nmz-gcnmz-sentinel process "kill") |
| 732 |
(setq kill t))))) |
| 733 |
(setq mew-nmz-mknmz-all-folders nil) |
| 734 |
(when (interactive-p) |
| 735 |
(if kill |
| 736 |
(message "All process of mknmz killed") |
| 737 |
(message "No process of mknmz"))))) |
| 738 |
|
| 739 |
(defun mew-nmz-mknmz-get-all-folders () |
| 740 |
(let ((protos (delq mew-folder-virtual (copy-sequence mew-folder-prefixes))) |
| 741 |
(allcases (or mew-config-cases '(""))) |
| 742 |
flist cases donecases flds fld dir) |
| 743 |
(message "mew-nmz getting all folders...") |
| 744 |
(dolist (proto protos) |
| 745 |
(setq flds nil) |
| 746 |
(setq cases allcases) |
| 747 |
(setq donecases nil) |
| 748 |
(dolist (case cases) |
| 749 |
(if (or (string= case mew-case-default) |
| 750 |
(string= case "")) |
| 751 |
(setq case (mew-nmz-case-normalize proto)) |
| 752 |
(setq case (mew-nmz-case-normalize |
| 753 |
(concat case ":" proto)))) |
| 754 |
(unless (member case donecases) |
| 755 |
(setq donecases (cons case donecases)) |
| 756 |
(setq flds |
| 757 |
(cond |
| 758 |
((mew-folder-imapp proto) |
| 759 |
(mapcar (lambda (x) (car x)) |
| 760 |
(mew-imap-folder-alist case))) |
| 761 |
((mew-folder-nntpp proto) |
| 762 |
(mapcar (lambda (x) (car x)) |
| 763 |
(mew-nntp-folder-alist case))) |
| 764 |
((mew-folder-popp proto) |
| 765 |
(mapcar (lambda (x) (car x)) |
| 766 |
(mew-pop-folder-alist))) |
| 767 |
(t |
| 768 |
(mapcar (lambda (x) (car x)) |
| 769 |
(mew-local-folder-alist))))) |
| 770 |
(setq case (if (string= case "") |
| 771 |
"" |
| 772 |
(concat case ":"))) |
| 773 |
(dolist (fld flds) |
| 774 |
(setq fld (concat case fld)) |
| 775 |
(setq dir (mew-expand-folder fld)) |
| 776 |
(when (and dir |
| 777 |
(file-exists-p dir) |
| 778 |
(file-directory-p dir) |
| 779 |
(file-exists-p (expand-file-name mew-summary-touch-file dir))) |
| 780 |
(setq flist (cons (directory-file-name fld) flist))))))) |
| 781 |
(prog1 |
| 782 |
(setq flist (nreverse flist)) |
| 783 |
(with-temp-buffer |
| 784 |
(dolist (fld flist) |
| 785 |
(unless (mew-nmz-skip-folder-p fld) |
| 786 |
(insert (format "%s\t%s\t%s\n" |
| 787 |
fld |
| 788 |
(mew-expand-folder fld) |
| 789 |
(mew-nmz-expand-folder fld)))) |
| 790 |
(setq flist (cdr flist))) |
| 791 |
(mew-frwlet |
| 792 |
mew-cs-text-for-read mew-nmz-mknmz-index-file-coding-system |
| 793 |
(write-region (point-min) (point-max) |
| 794 |
(expand-file-name mew-nmz-mknmz-index-file mew-conf-path) |
| 795 |
nil 'nomsg))) |
| 796 |
(message "mew-nmz getting all folders...done")))) |
| 797 |
|
| 798 |
(defun mew-nmz-mknmz-all-folders (&optional args) |
| 799 |
"Make namazu index all folders." |
| 800 |
(interactive "P") |
| 801 |
(setq args (or args current-prefix-arg)) |
| 802 |
(when (or (null mew-nmz-mknmz-all-folders) |
| 803 |
(and mew-nmz-mknmz-all-folders |
| 804 |
(prog1 |
| 805 |
(y-or-n-p "Another mew-nmz-mknmz-all-folders() detect. Kill it? ") |
| 806 |
(mew-nmz-mknmz-kill-process)))) |
| 807 |
(when (y-or-n-p (format "Make index in all %s? " |
| 808 |
(if args "folders" "indexed folders"))) |
| 809 |
(let (alist flist) |
| 810 |
(if args |
| 811 |
(progn |
| 812 |
;; all exist folder |
| 813 |
(mew-nmz-cleanup 'remove) |
| 814 |
(setq flist (mew-nmz-mknmz-get-all-folders))) |
| 815 |
;; all indexed folder |
| 816 |
(mew-nmz-setup) |
| 817 |
(setq alist mew-nmz-fld-index-alist) |
| 818 |
(while alist |
| 819 |
(setq flist (cons (car (car alist)) flist)) |
| 820 |
(setq alist (cdr alist)))) |
| 821 |
(setq flist (nreverse flist)) |
| 822 |
;; for mew-nmz-mknmz() |
| 823 |
(setq current-prefix-arg nil) |
| 824 |
(setq mew-nmz-mknmz-all-folders flist) |
| 825 |
(when flist |
| 826 |
(mew-nmz-mknmz (car flist) 'all)))))) |
| 827 |
|
| 828 |
(defun mew-nmz-mknmz-save-mewmknmz () |
| 829 |
"Save the information for mknmz." |
| 830 |
(interactive) |
| 831 |
(mew-nmz-cleanup 'remove) |
| 832 |
(mew-nmz-setup) |
| 833 |
(mew-nmz-mknmz-get-all-folders)) |
| 834 |
|
| 835 |
(defun mew-nmz-mark-unindexed () |
| 836 |
"Mark unindexed messages." |
| 837 |
(interactive) |
| 838 |
(mew-summary-only |
| 839 |
(if (mew-summary-exclusive-p) |
| 840 |
(save-excursion |
| 841 |
(if (and (mew-summary-mark-collect |
| 842 |
mew-nmz-mark-unindexed (point-min) (point-max)) |
| 843 |
(y-or-n-p (format "Unmark '%c'? " mew-nmz-mark-unindexed))) |
| 844 |
(mew-mark-undo-mark mew-nmz-mark-unindexed 'nomsg)) |
| 845 |
(let* ((ufname |
| 846 |
(expand-file-name "NMZ.field.uri" |
| 847 |
(mew-nmz-expand-folder (buffer-name)))) |
| 848 |
(mmsgs 0) |
| 849 |
(umsgs 0) |
| 850 |
msgnums) |
| 851 |
(if (not (file-exists-p ufname)) |
| 852 |
(message "%s has no index file" (buffer-name)) |
| 853 |
(with-temp-buffer |
| 854 |
(message "checking %s..." (file-name-nondirectory ufname)) |
| 855 |
(insert-file-contents ufname) |
| 856 |
(while (re-search-forward "/\\([0-9]+\\)$" nil t) |
| 857 |
(setq msgnums (cons (string-to-number (match-string 1)) msgnums)))) |
| 858 |
(message "checking %s..." (buffer-name)) |
| 859 |
(goto-char (point-min)) |
| 860 |
(while (not (eobp)) |
| 861 |
(if (and (mew-sumsyn-match mew-regex-sumsyn-short) |
| 862 |
(not (memq (string-to-number (mew-sumsyn-message-number)) msgnums)) |
| 863 |
(not (mew-in-decode-syntax-p))) |
| 864 |
(progn |
| 865 |
(setq umsgs (1+ umsgs)) |
| 866 |
(when (mew-summary-markable) |
| 867 |
(mew-summary-mark-as mew-nmz-mark-unindexed) |
| 868 |
(setq mmsgs (1+ mmsgs))))) |
| 869 |
(forward-line)) |
| 870 |
(cond |
| 871 |
((= umsgs 1) |
| 872 |
(message "%d message does not have index, %d marked" |
| 873 |
umsgs mmsgs)) |
| 874 |
((> umsgs 1) |
| 875 |
(message "%d messages do not have index, %d marked" |
| 876 |
umsgs mmsgs)) |
| 877 |
(t |
| 878 |
(message "all messages have index"))))))))) |
| 879 |
|
| 880 |
;; "search Message-ID" functions. |
| 881 |
(defun mew-nmz-search-parent (&optional child mid) |
| 882 |
"Search *parent* message and jump to that. |
| 883 |
If executed with '\\[universal-argument]', search *child* message." |
| 884 |
(interactive "P") |
| 885 |
(when (memq major-mode '(mew-summary-mode mew-virtual-mode)) |
| 886 |
(mew-summary-goto-message)) |
| 887 |
(let ((fld (mew-summary-folder-name)) |
| 888 |
(msg (mew-summary-message-number)) |
| 889 |
(idh (list (list mew-in-reply-to: mew-references:) |
| 890 |
(list mew-message-id:))) |
| 891 |
(message (if child "children" "parent")) |
| 892 |
(refilefld (copy-sequence mew-nmz-search-parent-folder)) |
| 893 |
(proto (or (mew-proto-to-refile (or (mew-sinfo-get-folder) |
| 894 |
(mew-minfo-get-summary) |
| 895 |
"+")) |
| 896 |
"+")) |
| 897 |
(case (mew-sinfo-get-case)) |
| 898 |
refiledir mess ref pid pos killbuff) |
| 899 |
(if mid |
| 900 |
(setq pid (list mid) idh nil) |
| 901 |
(if (not (or msg (mew-syntax-number))) |
| 902 |
(message "No message here") |
| 903 |
(save-excursion |
| 904 |
(mew-nmz-setup) |
| 905 |
(mew-summary-display) |
| 906 |
(if (setq mess (mew-cache-hit fld msg)) |
| 907 |
(set-buffer mess) |
| 908 |
(setq mess (generate-new-buffer mew-buffer-prefix)) |
| 909 |
(setq killbuff t) |
| 910 |
(set-buffer mess) |
| 911 |
(mew-erase-buffer) |
| 912 |
(mew-insert-message |
| 913 |
fld msg mew-cs-text-for-read mew-header-reasonable-size)) |
| 914 |
(let ((mew-inherit-refile-proto proto) |
| 915 |
(mew-inherit-refile-case case)) |
| 916 |
(setq refilefld (append (car (mew-refile-guess nil t)) refilefld))) |
| 917 |
(if child |
| 918 |
(setq idh (car (cdr idh))) |
| 919 |
(setq idh (car idh))) |
| 920 |
(dolist (rh idh) |
| 921 |
(setq ref (mew-header-get-value rh)) |
| 922 |
(while (and ref (string-match "<\\([^>]+\\)>" ref)) |
| 923 |
(setq pid (cons (concat "\"" (match-string 1 ref) "\"") pid)) |
| 924 |
(setq refilefld |
| 925 |
(cons (nth 1 (assoc (car pid) mew-refile-msgid-alist)) refilefld)) |
| 926 |
(setq ref (substring ref (match-end 0))))) |
| 927 |
(setq refilefld (cons fld refilefld)) |
| 928 |
(setq refilefld (mew-uniq-list (delete nil refilefld))) |
| 929 |
(setq refiledir |
| 930 |
(delete nil (mapcar |
| 931 |
(lambda (x) |
| 932 |
(mew-nmz-expand-folder x)) |
| 933 |
refilefld)))))) |
| 934 |
(when killbuff (mew-kill-buffer mess)) |
| 935 |
(if (null pid) |
| 936 |
(message "No required header") |
| 937 |
(if (mew-syntax-number) |
| 938 |
(while (not (mew-summary-message-number)) |
| 939 |
(forward-line -1))) |
| 940 |
(mew-sinfo-set-ret-pos (point)) |
| 941 |
(let ((pattern1 "") |
| 942 |
(pattern2 "") |
| 943 |
(addpattern (if child "+in-reply-to:" "+message-id:")) |
| 944 |
(range nil)) |
| 945 |
(if (not child) |
| 946 |
(setq pattern1 (concat addpattern (car pid))) |
| 947 |
(setq pattern1 (concat addpattern (car pid))) |
| 948 |
(setq addpattern "+references:") |
| 949 |
(setq pattern1 (concat pattern1 " | " addpattern (car pid)))) |
| 950 |
(setq pid (delete (car pid) pid)) |
| 951 |
(while pid |
| 952 |
(if (> (length (concat pattern2 addpattern (car pid))) |
| 953 |
mew-nmz-query-max-length) |
| 954 |
(setq pid nil) |
| 955 |
(setq pattern2 (concat pattern2 addpattern (car pid))) |
| 956 |
(setq addpattern (if child " | +references:" " | +message-id:")) |
| 957 |
(setq pid (delete (car pid) pid)))) |
| 958 |
(message "Searching %s..." message) |
| 959 |
(let ((pattern (list pattern1 pattern2))) |
| 960 |
(while (and (null range) pattern) |
| 961 |
(if mid |
| 962 |
() |
| 963 |
(message "Searching %s...%s" message (mew-join ", " refilefld)) |
| 964 |
(setq range (mew-nmz-multi-pick refiledir (car pattern))) |
| 965 |
(when range |
| 966 |
(catch 'detect |
| 967 |
(dolist (ref refilefld) |
| 968 |
(if (null (setq idh (assoc ref range))) |
| 969 |
() |
| 970 |
(setq fld (car idh)) |
| 971 |
(if child |
| 972 |
(setq range (cdr idh)) |
| 973 |
(setq range (nreverse (cdr idh)))) |
| 974 |
(throw 'detect t))) |
| 975 |
nil))) |
| 976 |
(unless range |
| 977 |
;; all folder search |
| 978 |
(message "Searching %s...all folders" message) |
| 979 |
(setq range (mew-nmz-multi-pick |
| 980 |
(mew-nmz-expand-folder-regexp "*:*") |
| 981 |
(car pattern) 'catch)) |
| 982 |
(if (null range) |
| 983 |
(setq pattern (cdr pattern)) |
| 984 |
(setq fld (car (car range))) |
| 985 |
(setq range (cdr (car range))) |
| 986 |
(if (not child) (setq range (nreverse range))) |
| 987 |
)))) |
| 988 |
(if (null range) |
| 989 |
(message "No message found") |
| 990 |
(when (or (and (mew-thread-p) |
| 991 |
(string= (mew-summary-folder-name) fld)) |
| 992 |
(and (mew-virtual-p) |
| 993 |
(not (mew-thread-p)))) |
| 994 |
(save-excursion |
| 995 |
(goto-char (point-min)) |
| 996 |
(when (re-search-forward |
| 997 |
(concat "\r \\(" (regexp-quote fld) "\\)? +" (car range) " ") nil t) |
| 998 |
(setq fld (buffer-name)) |
| 999 |
(goto-char (match-beginning 0)) |
| 1000 |
(beginning-of-line) |
| 1001 |
(setq pos (point))))) |
| 1002 |
(if (listp (car range)) |
| 1003 |
(setq fld (car (car range)) |
| 1004 |
mess (car (cdr (car range)))) |
| 1005 |
(setq mess (car range))) |
| 1006 |
(mew-nmz-goto-folder-msg fld mess pos) |
| 1007 |
(message "Searching %s...%s/%s" message fld mess)))))) |
| 1008 |
|
| 1009 |
(defun mew-nmz-search-child (&optional arg) |
| 1010 |
(interactive "P") |
| 1011 |
(mew-nmz-search-parent (not arg))) |
| 1012 |
|
| 1013 |
(defun mew-nmz-search-msgid-at-point () |
| 1014 |
(interactive) |
| 1015 |
(let (start end) |
| 1016 |
(if (and (re-search-backward "<" (save-excursion (beginning-of-line) (point)) t) |
| 1017 |
(setq start (point)) |
| 1018 |
(re-search-forward ">" (save-excursion (end-of-line) (point)) t) |
| 1019 |
(setq end (point))) |
| 1020 |
(mew-nmz-search-msgid (buffer-substring start end)) |
| 1021 |
(message "No Message-ID")))) |
| 1022 |
|
| 1023 |
(defun mew-nmz-search-msgid-region (start end) |
| 1024 |
(interactive "r") |
| 1025 |
(mew-nmz-search-msgid (buffer-substring start end))) |
| 1026 |
|
| 1027 |
(defun mew-nmz-search-msgid (mid) |
| 1028 |
(interactive "sMessage-ID: ") |
| 1029 |
(if (string-match "<\\([^>]+\\)>" mid) |
| 1030 |
(let ((mew-use-full-window t) |
| 1031 |
(pattern (concat "\"" (mew-match-string 1 mid) "\""))) |
| 1032 |
(when (eq major-mode 'mew-message-mode) |
| 1033 |
(mew-message-goto-summary)) |
| 1034 |
(mew-nmz-search-parent nil pattern)) |
| 1035 |
(message "No Message-ID"))) |
| 1036 |
|
| 1037 |
;; "Namazu virtual" function. |
| 1038 |
(defun mew-nmz-input-folders () |
| 1039 |
(mew-input-clear) |
| 1040 |
(mew-input-folder-clean-up) |
| 1041 |
(let ((map (copy-keymap mew-input-folder-map)) |
| 1042 |
(case:folder (concat (or (mew-summary-folder-name) "+") |
| 1043 |
(if mew-nmz-input-folders-asterisk "*" "")))) |
| 1044 |
(define-key map "*" 'mew-input-folder-self-insert) |
| 1045 |
(let* ((init "+*") ;; (mew-canonicalize-case-folder case:folder)) |
| 1046 |
(mew-input-complete-function 'mew-complete-folder) |
| 1047 |
(mew-circular-complete-function 'mew-circular-complete-case:) |
| 1048 |
(mew-input-folder-search-multi t) |
| 1049 |
(minibuffer-setup-hook (cons 'backward-char minibuffer-setup-hook)) |
| 1050 |
;; mew-inherit-case must be nil |
| 1051 |
(ret (read-from-minibuffer "Namazu folder name: " |
| 1052 |
init map nil |
| 1053 |
'mew-nmz-input-folder-hist))) |
| 1054 |
(when (string= ret "") |
| 1055 |
(setq ret init)) |
| 1056 |
(setq ret (mapcar 'mew-chop (mew-split ret ?,)))))) |
| 1057 |
|
| 1058 |
;; Use namazu-mode. |
| 1059 |
;; (setq w3m-namazu-arguments |
| 1060 |
;; '("-r" "-h" "-H" "-n" w3m-namazu-page-max "-w" whence)) |
| 1061 |
|
| 1062 |
(defun mew-nmz-namazu (&optional pattern indexs) |
| 1063 |
"Execute w3m-namazu. |
| 1064 |
If executed with '\\[universal-argument]', search result indexes." |
| 1065 |
(interactive) |
| 1066 |
(if (not (or (featurep 'w3m-namazu) |
| 1067 |
(condition-case nil |
| 1068 |
(require 'w3m-namazu) |
| 1069 |
(error nil)))) |
| 1070 |
(message "Please install \"emacs-w3m\"") |
| 1071 |
(mew-nmz-setup) |
| 1072 |
(if current-prefix-arg |
| 1073 |
;; rest indexes |
| 1074 |
(let (current-prefix-arg) |
| 1075 |
(mew-nmz-namazu mew-nmz-namazu-pattern mew-nmz-namazu-miss-folders)) |
| 1076 |
(let ((i mew-nmz-db-max) |
| 1077 |
flds nmzdirs fldmsgs pickflds overmsg) |
| 1078 |
(setq flds (or indexs (mew-nmz-input-folders))) |
| 1079 |
(setq mew-nmz-namazu-pattern |
| 1080 |
(setq pattern |
| 1081 |
(or pattern |
| 1082 |
(let ((mew-pick-field-list (mew-nmz-pick-field-list))) |
| 1083 |
(mew-nmz-pick-canonicalize-pattern |
| 1084 |
(mew-input-pick-pattern "Namazu pick")))))) |
| 1085 |
(setq mew-nmz-namazu-miss-folders nil) |
| 1086 |
(setq nmzdirs (mew-nmz-flds-to-indexs flds)) |
| 1087 |
(when (> (length nmzdirs) mew-nmz-db-max) |
| 1088 |
(setq fldmsgs (mew-nmz-multi-pick nmzdirs pattern)) |
| 1089 |
(when fldmsgs |
| 1090 |
(dolist (fldmsg fldmsgs) |
| 1091 |
(setq pickflds (cons (car fldmsg) pickflds))) |
| 1092 |
(when (> (length pickflds) mew-nmz-db-max) |
| 1093 |
(setq mew-nmz-namazu-miss-folders |
| 1094 |
(nthcdr mew-nmz-db-max (nreverse pickflds))) |
| 1095 |
(setq overmsg (format "Warning: %d indexes over" |
| 1096 |
(length mew-nmz-namazu-miss-folders)))) |
| 1097 |
(setq nmzdirs nil) |
| 1098 |
(while (and pickflds (> i 0)) |
| 1099 |
(setq nmzdirs (cons (mew-nmz-expand-folder (car pickflds)) |
| 1100 |
nmzdirs)) |
| 1101 |
(setq pickflds (cdr pickflds)) |
| 1102 |
(setq i (1- i))))) |
| 1103 |
;; message viewer set |
| 1104 |
(unless (assoc mew-nmz-namazu-content-type w3m-content-type-alist) |
| 1105 |
(setq w3m-content-type-alist |
| 1106 |
(cons `(,mew-nmz-namazu-content-type "/[0-9]+$" nil "text/plain") |
| 1107 |
w3m-content-type-alist))) |
| 1108 |
(add-hook 'w3m-display-hook 'w3m-mew-message-view t) |
| 1109 |
;; remove pre mew-nmz-namazu's alist |
| 1110 |
(when (assoc mew-nmz-namazu-index-alias w3m-namazu-index-alist) |
| 1111 |
(setq w3m-namazu-index-alist |
| 1112 |
(delete (assoc mew-nmz-namazu-index-alias w3m-namazu-index-alist) |
| 1113 |
w3m-namazu-index-alist))) |
| 1114 |
;; for next page |
| 1115 |
(setq w3m-namazu-index-alist |
| 1116 |
(append (list (cons mew-nmz-namazu-index-alias nmzdirs)) |
| 1117 |
w3m-namazu-index-alist)) |
| 1118 |
(w3m-namazu mew-nmz-namazu-index-alias pattern 'reload) |
| 1119 |
(when overmsg (message overmsg)))))) |
| 1120 |
|
| 1121 |
(defun w3m-mew-message-view (url) |
| 1122 |
(if (and (boundp 'mew-mail-path) |
| 1123 |
(w3m-url-local-p url) |
| 1124 |
(string-match (concat (file-name-as-directory |
| 1125 |
(expand-file-name mew-mail-path)) |
| 1126 |
".+/[0-9]+$") |
| 1127 |
(expand-file-name (w3m-url-to-file-name url)))) |
| 1128 |
(unless (get-text-property (point-min) 'w3m-mew-namazu) |
| 1129 |
(mew-elet |
| 1130 |
(goto-char (point-min)) |
| 1131 |
(condition-case nil |
| 1132 |
(let (pos) |
| 1133 |
(mew-decode-rfc822-header) |
| 1134 |
(mew-header-goto-end) |
| 1135 |
(mew-header-arrange (point-min) (point)) |
| 1136 |
(mew-highlight-body-region (point) (point-max)) |
| 1137 |
;; for emacs-w3m |
| 1138 |
(remove-text-properties (point-min) (point-max) |
| 1139 |
'(read-only nil)) |
| 1140 |
(setq pos (if (get-text-property (point-min) 'mew-visible) |
| 1141 |
(point-min) |
| 1142 |
(or (next-single-property-change (point-min) 'mew-visible) |
| 1143 |
(point-min)))) |
| 1144 |
(set-window-start (selected-window) pos)) |
| 1145 |
(error nil)) |
| 1146 |
(put-text-property (point-min) (point-min) 'w3m-mew-namazu t) |
| 1147 |
(set-buffer-modified-p nil))) |
| 1148 |
(remove-text-properties (point-min) (point-min) '(w3m-mew-namazu nil)))) |
| 1149 |
|
| 1150 |
;; Input "Namazu pattern" functions. |
| 1151 |
|
| 1152 |
;; Mew pickpattern converter |
| 1153 |
(defun mew-nmz-pick-canonicalize-pattern (pattern) |
| 1154 |
(let ((mew-inherit-pick-omit-and t)) |
| 1155 |
(mapconcat |
| 1156 |
'mew-nmz-pick-native-text-namazu |
| 1157 |
(mew-pick-parse (mew-pick-lex pattern)) |
| 1158 |
" "))) |
| 1159 |
|
| 1160 |
(defun mew-nmz-pick-native-text-namazu (token) |
| 1161 |
(mew-pick-native-text "mew-nmz-pick-pattern-namazu-" token)) |
| 1162 |
|
| 1163 |
(defun mew-nmz-pick-pattern-namazu-and (sym) "and") |
| 1164 |
(defun mew-nmz-pick-pattern-namazu-or (sym) "or") |
| 1165 |
(defun mew-nmz-pick-pattern-namazu-open (sym) "(") |
| 1166 |
(defun mew-nmz-pick-pattern-namazu-close (sym) ")") |
| 1167 |
(defun mew-nmz-pick-pattern-namazu-not (sym) "not") |
| 1168 |
(defun mew-nmz-pick-pattern-namazu-key (key) key) |
| 1169 |
(defun mew-nmz-pick-pattern-namazu-kyvl (kyvl) |
| 1170 |
(when (string= (nth 0 kyvl) "=") |
| 1171 |
(format "+%s:%s" (nth 1 kyvl) (nth 2 kyvl)))) |
| 1172 |
|
| 1173 |
(defun mew-nmz-pick-pattern-gather-header () |
| 1174 |
(when mew-nmz-pick-gather-field-list |
| 1175 |
(save-excursion |
| 1176 |
(let* ((fld (mew-summary-folder-name)) |
| 1177 |
(msg (mew-summary-message-number)) |
| 1178 |
(buf (mew-cache-hit fld msg)) |
| 1179 |
(gathers mew-nmz-pick-gather-field-list) |
| 1180 |
killbuff retlst gather header duplchk mid addrs addr prefix) |
| 1181 |
(when (and (not buf) fld msg) |
| 1182 |
(setq buf (generate-new-buffer mew-buffer-prefix)) |
| 1183 |
(setq killbuff t) |
| 1184 |
(set-buffer buf) |
| 1185 |
(mew-erase-buffer) |
| 1186 |
(mew-insert-message |
| 1187 |
fld msg mew-cs-text-for-read mew-header-reasonable-size)) |
| 1188 |
(when (and buf (get-buffer buf) (buffer-name (get-buffer buf))) |
| 1189 |
(set-buffer buf) |
| 1190 |
(while gathers |
| 1191 |
(setq gather (car gathers)) |
| 1192 |
(setq header (mew-header-get-value (car gather))) |
| 1193 |
(when (and header (car (cdr gather))) |
| 1194 |
(cond |
| 1195 |
((eq (car (cdr gather)) 'msgid) |
| 1196 |
(while (and header (string-match "<\\([^>]+\\)>" header)) |
| 1197 |
(setq mid (match-string 1 header)) |
| 1198 |
(setq header (substring header (match-end 0))) |
| 1199 |
(if (member mid duplchk) |
| 1200 |
() |
| 1201 |
(setq prefix (nthcdr 2 gather)) |
| 1202 |
(setq duplchk (cons mid duplchk)) |
| 1203 |
(while prefix |
| 1204 |
(setq retlst (cons (concat (car prefix) mid) retlst)) |
| 1205 |
(setq prefix (cdr prefix)))))) |
| 1206 |
((eq (car (cdr gather)) 'address) |
| 1207 |
(setq addrs (mew-addrstr-parse-address-list header)) |
| 1208 |
(while (setq addr (car addrs)) |
| 1209 |
(setq addr (downcase addr)) |
| 1210 |
(if (not (member addr duplchk)) |
| 1211 |
(let ((prefix (nthcdr 2 gather))) |
| 1212 |
(setq duplchk (cons addr duplchk)) |
| 1213 |
(while prefix |
| 1214 |
(setq retlst (cons (concat (car prefix) addr) retlst)) |
| 1215 |
(setq prefix (cdr prefix))))) |
| 1216 |
(setq addrs (cdr addrs)))))) |
| 1217 |
(setq gathers (cdr gathers))) |
| 1218 |
(when killbuff (mew-kill-buffer buf)) |
| 1219 |
(when retlst |
| 1220 |
(setq retlst (append |
| 1221 |
retlst |
| 1222 |
(list |
| 1223 |
(concat " " (make-string (- (window-width) 10) ?-)))))) |
| 1224 |
(nreverse retlst)))))) |
| 1225 |
|
| 1226 |
;; "Namazu search engine" functions. |
| 1227 |
(defun mew-nmz-multi-pick (nmzdirs pattern &optional catch single) |
| 1228 |
"Get message numbers with many folders." |
| 1229 |
(let ((tmpdirs nmzdirs) |
| 1230 |
(defaultregex |
| 1231 |
(concat "^" (regexp-opt |
| 1232 |
(delq mew-folder-virtual (copy-sequence mew-folder-prefixes))))) |
| 1233 |
nxt prog-args intmsgs retmsgs sortfld defmsgs casemsgs cell) |
| 1234 |
(setq pattern (mew-cs-encode-arg pattern)) |
| 1235 |
(setq nmzdirs nil) |
| 1236 |
(while tmpdirs |
| 1237 |
(setq nxt (nthcdr mew-nmz-db-max tmpdirs)) |
| 1238 |
(if nxt (setcdr (nthcdr (1- mew-nmz-db-max) tmpdirs) nil)) |
| 1239 |
(setq nmzdirs (cons tmpdirs nmzdirs)) |
| 1240 |
(setq tmpdirs nxt)) |
| 1241 |
(setq nmzdirs (nreverse nmzdirs)) |
| 1242 |
(with-temp-buffer |
| 1243 |
(while (and nmzdirs |
| 1244 |
(or (not catch) |
| 1245 |
(and catch (null intmsgs)))) |
| 1246 |
(setq prog-args (delq nil (append mew-nmz-prog-args |
| 1247 |
(list "--all" "--list" "--no-decode-uri") |
| 1248 |
(list pattern) |
| 1249 |
(car nmzdirs)))) |
| 1250 |
(erase-buffer) |
| 1251 |
(mew-piolet |
| 1252 |
mew-cs-text-for-read mew-cs-text-for-write |
| 1253 |
(let ((file-name-coding-system nil)) |
| 1254 |
(apply (function call-process) |
| 1255 |
mew-nmz-prog nil t nil prog-args))) |
| 1256 |
(goto-char (point-min)) |
| 1257 |
(let (dir msgnum) |
| 1258 |
(while (not (eobp)) |
| 1259 |
(when (looking-at mew-nmz-result-regex) |
| 1260 |
(setq dir (mew-buffer-substring (match-beginning 1) (match-end 1))) |
| 1261 |
(setq msgnum (string-to-number |
| 1262 |
(mew-buffer-substring (match-beginning 2) (match-end 2)))) |
| 1263 |
(if (not (setq cell (assoc dir intmsgs))) |
| 1264 |
(setq intmsgs (cons (list dir (list msgnum)) intmsgs)) |
| 1265 |
(unless (memq msgnum (car (cdr cell))) |
| 1266 |
(nconc (car (cdr cell)) (list msgnum))))) |
| 1267 |
(forward-line)) |
| 1268 |
(setq nmzdirs (cdr nmzdirs)))) |
| 1269 |
(when intmsgs |
| 1270 |
(if single |
| 1271 |
;; for search-mark |
| 1272 |
(mapcar 'number-to-string (sort (car (cdr (car intmsgs))) '<)) |
| 1273 |
;; for virtual or w3m-namazu |
| 1274 |
(setq retmsgs intmsgs) |
| 1275 |
(while retmsgs |
| 1276 |
(setq sortfld (cons (car (car retmsgs)) sortfld)) |
| 1277 |
(setq retmsgs (cdr retmsgs))) |
| 1278 |
;; no sort |
| 1279 |
;; (setq sortfld (sort sortfld 'string<)) |
| 1280 |
(while sortfld |
| 1281 |
(setq cell (assoc (car sortfld) intmsgs)) |
| 1282 |
(setq retmsgs |
| 1283 |
(cons |
| 1284 |
(cons (mew-nmz-url-to-folder (car cell)) |
| 1285 |
(mapcar 'number-to-string (sort (car (cdr cell)) '<))) |
| 1286 |
retmsgs)) |
| 1287 |
(setq sortfld (cdr sortfld))) |
| 1288 |
;; '((folder msg ...) (folder msg ...) ...) |
| 1289 |
(while retmsgs |
| 1290 |
(when (car (car retmsgs)) |
| 1291 |
(if (string-match defaultregex (car (car retmsgs))) |
| 1292 |
(setq defmsgs (cons (car retmsgs) defmsgs)) |
| 1293 |
(setq casemsgs (cons (car retmsgs) casemsgs)))) |
| 1294 |
(setq retmsgs (cdr retmsgs))) |
| 1295 |
(append defmsgs casemsgs)))))) |
| 1296 |
|
| 1297 |
;; miscellaneous functions |
| 1298 |
(defun mew-nmz-flds-to-indexs (flds) |
| 1299 |
(let ((suffix (append |
| 1300 |
'("*") |
| 1301 |
(delq mew-folder-virtual (copy-sequence mew-folder-prefixes)))) |
| 1302 |
nmzdirs tmp) |
| 1303 |
(setq suffix (concat (regexp-opt suffix) "$")) |
| 1304 |
(dolist (fld flds) |
| 1305 |
(setq fld (mew-nmz-case-folder-normalize fld)) |
| 1306 |
(cond |
| 1307 |
((or (string-match suffix fld) |
| 1308 |
(string-match "^\\*" fld)) |
| 1309 |
(setq nmzdirs (append nmzdirs |
| 1310 |
(mew-nmz-expand-folder-regexp fld)))) |
| 1311 |
((setq tmp (mew-nmz-folder-to-nmzdir fld)) |
| 1312 |
(setq nmzdirs (cons tmp nmzdirs))))) |
| 1313 |
(nreverse (mew-uniq-list nmzdirs)))) |
| 1314 |
|
| 1315 |
(defun mew-nmz-expand-folder-regexp (case:folder) |
| 1316 |
(mew-nmz-setup) |
| 1317 |
(let ((alist mew-nmz-fld-index-alist) |
| 1318 |
case fld caseregex nmzdirs tmpfld nmzdir protos newcase lst) |
| 1319 |
(if (string= case:folder "*:*") |
| 1320 |
;; all case, all proto, all folder |
| 1321 |
(dolist (lst alist) |
| 1322 |
(setq nmzdirs (cons (cdr lst) nmzdirs))) |
| 1323 |
(if (string-match "^\\([^:]+\\):\\(.*\\)$" case:folder) |
| 1324 |
(setq case (match-string 1 case:folder) |
| 1325 |
fld (match-string 2 case:folder)) |
| 1326 |
(setq case "") |
| 1327 |
(setq fld case:folder)) |
| 1328 |
(when (string-match "^.*\\*$" fld) |
| 1329 |
(setq fld (substring fld 0 -1)) |
| 1330 |
(setq fld (directory-file-name fld))) |
| 1331 |
(cond |
| 1332 |
((string= case "*") |
| 1333 |
;; all case |
| 1334 |
(setq caseregex "^\\([^:]+:\\)?")) |
| 1335 |
((or (string= case "") (string= mew-case-default case)) |
| 1336 |
;; default case |
| 1337 |
(setq caseregex "^")) |
| 1338 |
((string= fld "") |
| 1339 |
(setq protos (delq mew-folder-virtual (copy-sequence mew-folder-prefixes))) |
| 1340 |
(setq caseregex |
| 1341 |
(concat "^\\(\\(" |
| 1342 |
(mapconcat |
| 1343 |
(lambda (x) |
| 1344 |
(setq newcase (mew-nmz-case-normalize |
| 1345 |
(concat case ":" x))) |
| 1346 |
(if (string= newcase "") |
| 1347 |
(regexp-quote x) |
| 1348 |
(regexp-quote (concat case ":" x)))) |
| 1349 |
protos "\\)\\|\\(") |
| 1350 |
"\\)\\)"))) |
| 1351 |
(t |
| 1352 |
(setq case (mew-nmz-case-normalize (concat case ":" fld))) |
| 1353 |
(if (string= case "") |
| 1354 |
(setq caseregex "^") |
| 1355 |
(setq caseregex (concat "^" (regexp-quote case) ":"))))) |
| 1356 |
(if (string= fld "") |
| 1357 |
(setq caseregex (concat caseregex "[^:]+$")) |
| 1358 |
(setq caseregex (concat caseregex (regexp-quote fld)))) |
| 1359 |
(dolist (lst alist) |
| 1360 |
(setq tmpfld (car lst)) |
| 1361 |
(setq nmzdir (cdr lst)) |
| 1362 |
(when (string-match caseregex tmpfld) |
| 1363 |
(setq nmzdirs (cons nmzdir nmzdirs))))) |
| 1364 |
nmzdirs)) |
| 1365 |
|
| 1366 |
(defun mew-nmz-goto-folder-msg (fld msg &optional pos disp) |
| 1367 |
(when (string-match "^+#" fld) |
| 1368 |
(mew-nmz-setup) |
| 1369 |
(setq fld (or (cdr (assoc (mew-expand-folder fld) mew-nmz-url-fld-alist)) |
| 1370 |
fld))) |
| 1371 |
(mew-summary-visit-folder fld) |
| 1372 |
(if (mew-virtual-p) |
| 1373 |
(mew-summary-move-and-display msg disp) |
| 1374 |
(goto-char (point-min)) |
| 1375 |
(if (mew-nmz-re-search-message msg) |
| 1376 |
(setq pos (point)) |
| 1377 |
(setq pos |
| 1378 |
(catch 'det |
| 1379 |
(while mew-summary-buffer-process |
| 1380 |
(sit-for 0.1) |
| 1381 |
;; accept-process-output or sleep-for is not enough |
| 1382 |
(discard-input) |
| 1383 |
(unless pos |
| 1384 |
(goto-char (point-min)) |
| 1385 |
(when (mew-nmz-re-search-message msg) |
| 1386 |
(setq pos (point)) |
| 1387 |
(throw 'det t)))) |
| 1388 |
pos))) |
| 1389 |
(if pos (goto-char pos)) |
| 1390 |
(mew-thread-move-cursor) |
| 1391 |
(mew-summary-display disp))) |
| 1392 |
|
| 1393 |
(defun mew-nmz-index-new-p (fld) |
| 1394 |
(let ((touchtime (mew-file-get-time |
| 1395 |
(expand-file-name |
| 1396 |
mew-summary-touch-file |
| 1397 |
(file-chase-links (mew-expand-folder fld))))) |
| 1398 |
(stamptime (mew-file-get-time |
| 1399 |
(expand-file-name |
| 1400 |
"NMZ.stamp" (mew-nmz-expand-folder fld))))) |
| 1401 |
(cond |
| 1402 |
((null touchtime) nil) |
| 1403 |
((null stamptime) nil) |
| 1404 |
((> (nth 0 stamptime) (nth 0 touchtime)) t) |
| 1405 |
((and (= (nth 0 stamptime) (nth 0 touchtime)) |
| 1406 |
(> (nth 1 stamptime) (nth 1 touchtime))) t) |
| 1407 |
(t nil)))) |
| 1408 |
|
| 1409 |
(defun mew-nmz-index-delete (nmzdir &optional tmpfiles) |
| 1410 |
"Delete namazu index files." |
| 1411 |
(when (file-directory-p nmzdir) |
| 1412 |
(let* ((regex (if tmpfiles "^NMZ\..*tmp$" "^NMZ\.")) |
| 1413 |
(flist (directory-files nmzdir 'full regex 'nosort))) |
| 1414 |
(dolist (file flist) |
| 1415 |
(setq file (expand-file-name file nmzdir)) |
| 1416 |
(and (file-exists-p file) |
| 1417 |
(file-writable-p file) |
| 1418 |
(delete-file file)))))) |
| 1419 |
|
| 1420 |
(defun mew-nmz-skip-folder-p (fld) |
| 1421 |
(let ((skips mew-nmz-mknmz-skip-folders-regexp)) |
| 1422 |
(catch 'match |
| 1423 |
(setq fld (mew-nmz-case-folder-normalize fld)) |
| 1424 |
(dolist (skip skips) |
| 1425 |
(when (string-match skip fld) |
| 1426 |
(throw 'match t))) |
| 1427 |
nil))) |
| 1428 |
|
| 1429 |
(defun mew-nmz-gcnmz-folder-p (fld) |
| 1430 |
(let ((regexps mew-nmz-use-gcnmz-folders-regexp)) |
| 1431 |
(catch 'match |
| 1432 |
(setq fld (mew-nmz-case-folder-normalize fld)) |
| 1433 |
(while regexps |
| 1434 |
(when (string-match (car regexps) fld) |
| 1435 |
(throw 'match t)) |
| 1436 |
(setq regexps (cdr regexps))) |
| 1437 |
nil))) |
| 1438 |
|
| 1439 |
(defun mew-nmz-timestamp-new (fld) |
| 1440 |
(let ((file (expand-file-name "NMZ.stamp.new" (mew-nmz-expand-folder fld)))) |
| 1441 |
(if (file-writable-p file) |
| 1442 |
(write-region "touched by Mew." nil file nil 'no-msg)))) |
| 1443 |
|
| 1444 |
(defun mew-nmz-timestamp-rename (fld) |
| 1445 |
(let ((nfile (expand-file-name "NMZ.stamp.new" (mew-nmz-expand-folder fld))) |
| 1446 |
(tfile (expand-file-name "NMZ.stamp" (mew-nmz-expand-folder fld)))) |
| 1447 |
(if (and (file-readable-p nfile) (file-writable-p tfile)) |
| 1448 |
(rename-file nfile tfile 'ok) |
| 1449 |
(if (file-writable-p nfile) |
| 1450 |
(delete-file nfile))))) |
| 1451 |
|
| 1452 |
(defun mew-nmz-re-search-message (msg) |
| 1453 |
(let ((here (point))) |
| 1454 |
(if (not (re-search-forward (concat "^.*\r +" msg "[^0-9]") nil t)) |
| 1455 |
(progn (goto-char here) |
| 1456 |
nil) |
| 1457 |
(beginning-of-line) |
| 1458 |
t))) |
| 1459 |
|
| 1460 |
;; index delete/rename |
| 1461 |
;; call from mew-summary-delete-folder() |
| 1462 |
;; case:folder MUST not branch |
| 1463 |
(defun mew-nmz-folder-index-delete (case:folder) |
| 1464 |
(let ((nmzdir (mew-nmz-expand-folder case:folder)) |
| 1465 |
(fld (mew-nmz-case-folder-normalize case:folder))) |
| 1466 |
(when (and (file-exists-p nmzdir) (file-directory-p nmzdir)) |
| 1467 |
(mew-delete-directory-recursively nmzdir) |
| 1468 |
(setq mew-nmz-fld-index-alist |
| 1469 |
(delete (assoc fld mew-nmz-fld-index-alist) mew-nmz-fld-index-alist)) |
| 1470 |
(setq mew-nmz-url-fld-alist |
| 1471 |
(delete (assoc (mew-expand-folder fld) mew-nmz-url-fld-alist) |
| 1472 |
mew-nmz-url-fld-alist)) |
| 1473 |
(mew-nmz-cache-save)))) |
| 1474 |
|
| 1475 |
;; call from mew-summary-rename-folder() |
| 1476 |
(defun mew-nmz-folder-index-rename (case:folder case:new-folder) |
| 1477 |
(let ((nmzdir (mew-nmz-expand-folder case:folder)) |
| 1478 |
(new-nmzdir (mew-nmz-expand-folder case:new-folder)) |
| 1479 |
(dir (file-name-as-directory (mew-expand-folder case:folder))) |
| 1480 |
(new-dir (file-name-as-directory (mew-expand-folder case:new-folder)))) |
| 1481 |
(when (and (file-exists-p nmzdir) (file-directory-p nmzdir) |
| 1482 |
(not (file-exists-p new-nmzdir))) |
| 1483 |
(mew-nmz-cleanup 'remove) |
| 1484 |
(rename-file nmzdir new-nmzdir) |
| 1485 |
(when mew-nmz-use-drive-letter |
| 1486 |
(when (string-match "^\\([a-zA-Z]\\):\\(/.*\\)" dir) |
| 1487 |
(setq dir (concat "/" |
| 1488 |
(substring dir (match-beginning 1) (match-end 1)) |
| 1489 |
"|" |
| 1490 |
(substring dir (match-beginning 2) (match-end 2))))) |
| 1491 |
(when (string-match "^\\([a-zA-Z]\\):\\(/.*\\)" new-dir) |
| 1492 |
(setq new-dir (concat "/" |
| 1493 |
(substring new-dir (match-beginning 1) (match-end 1)) |
| 1494 |
"|" |
| 1495 |
(substring new-dir (match-beginning 2) (match-end 2)))))) |
| 1496 |
(mew-nmz-folder-reindex-recursively new-nmzdir dir new-dir)))) |
| 1497 |
|
| 1498 |
(defun mew-nmz-folder-reindex-recursively (dir from to) |
| 1499 |
(let ((files (directory-files dir 'full mew-regex-files 'no-sort)) |
| 1500 |
urifile) |
| 1501 |
(when (member (setq urifile (expand-file-name "NMZ.field.uri" dir)) files) |
| 1502 |
(mew-nmz-folder-index-reindex dir urifile from to)) |
| 1503 |
(dolist (file files) |
| 1504 |
(when (file-directory-p file) |
| 1505 |
(mew-nmz-folder-reindex-recursively file from to))))) |
| 1506 |
|
| 1507 |
(defun mew-nmz-folder-index-reindex (dir file from to) |
| 1508 |
(setq from (concat "^" (regexp-quote from))) |
| 1509 |
(when (and (file-readable-p file) (file-regular-p file)) |
| 1510 |
(message "mew-nmz: reindexing %s..." dir) |
| 1511 |
(with-temp-buffer |
| 1512 |
(mew-frwlet |
| 1513 |
mew-cs-autoconv mew-nmz-cs-index |
| 1514 |
(insert-file-contents file) |
| 1515 |
(goto-char (point-min)) |
| 1516 |
(while (not (eobp)) |
| 1517 |
(when (looking-at from) |
| 1518 |
(delete-region (match-beginning 0) (match-end 0)) |
| 1519 |
(insert to)) |
| 1520 |
(forward-line 1)) |
| 1521 |
(write-region (point-min) (point-max) file nil 'nomsg))) |
| 1522 |
(when (mew-which-exec mew-nmz-prog-rfnmz) |
| 1523 |
(call-process mew-nmz-prog-rfnmz nil nil nil dir)) |
| 1524 |
(message "mew-nmz: reindexing %s...done" dir))) |
| 1525 |
|
| 1526 |
;; mew-nmz-setup |
| 1527 |
(defun mew-nmz-gather-indexed-folder (case folders-alist &optional proto) |
| 1528 |
(let ((ocase case) |
| 1529 |
fld nmzdir fld-index-alist url-fld-alist) |
| 1530 |
(unless case (setq case "")) |
| 1531 |
(dolist (flds folders-alist) |
| 1532 |
(setq fld (car flds)) |
| 1533 |
(when fld |
| 1534 |
(when (eq proto 'imap) |
| 1535 |
(setq fld (mew-nmz-imap-directory-file-name fld ocase))) |
| 1536 |
(setq fld (directory-file-name (if (string= case "") |
| 1537 |
fld |
| 1538 |
(concat case ":" fld)))) |
| 1539 |
(when (and (or (not (eq proto 'nntp)) |
| 1540 |
(file-directory-p (mew-expand-folder fld))) |
| 1541 |
(setq nmzdir (mew-nmz-expand-folder fld)) |
| 1542 |
(file-directory-p nmzdir) |
| 1543 |
(file-exists-p (expand-file-name "NMZ.i" nmzdir))) |
| 1544 |
(setq fld-index-alist (cons (cons fld nmzdir) fld-index-alist)) |
| 1545 |
(setq url-fld-alist (cons (cons (mew-expand-folder fld) fld) url-fld-alist))))) |
| 1546 |
(setq mew-nmz-fld-index-alist |
| 1547 |
(append mew-nmz-fld-index-alist (nreverse fld-index-alist))) |
| 1548 |
(setq mew-nmz-url-fld-alist |
| 1549 |
(append mew-nmz-url-fld-alist (nreverse url-fld-alist))))) |
| 1550 |
|
| 1551 |
(defun mew-nmz-setup () |
| 1552 |
(unless mew-nmz-setup-p |
| 1553 |
(unless (and (mew-which-exec mew-nmz-prog-mknmz) |
| 1554 |
(mew-which-exec mew-nmz-prog)) |
| 1555 |
(error "Please install namazu")) |
| 1556 |
(message "mew-nmz setup...") |
| 1557 |
(unless (mew-nmz-cache-load) |
| 1558 |
(mew-nmz-cleanup) |
| 1559 |
(let ((prefixes (delq mew-folder-virtual (copy-sequence mew-folder-prefixes))) |
| 1560 |
nmzdir-case-alist |
| 1561 |
case-alist cases case ocase gcase nmzdir alst) |
| 1562 |
(dolist (prefix prefixes) |
| 1563 |
(setq cases (mapcar (lambda (x) |
| 1564 |
(if (string= x mew-case-default) "" x)) |
| 1565 |
mew-config-cases)) |
| 1566 |
(when (member "" cases) |
| 1567 |
(setq cases (cons "" (delete "" cases)))) |
| 1568 |
(setq nmzdir-case-alist nil) |
| 1569 |
(setq case-alist nil) |
| 1570 |
(setq gcase nil) |
| 1571 |
(while (setq case (car cases)) |
| 1572 |
(setq nmzdir (mew-nmz-expand-folder (if (string= case "") |
| 1573 |
prefix |
| 1574 |
(concat case ":" prefix)))) |
| 1575 |
(if (setq alst (assoc nmzdir nmzdir-case-alist)) |
| 1576 |
(progn |
| 1577 |
(setq ocase (car (assoc (cdr alst) case-alist))) |
| 1578 |
(setq case-alist (cons (cons case ocase) case-alist))) |
| 1579 |
(setq nmzdir-case-alist |
| 1580 |
(cons (cons nmzdir case) nmzdir-case-alist)) |
| 1581 |
(setq case-alist (cons (cons case case) case-alist)) |
| 1582 |
(setq gcase (cons case gcase))) |
| 1583 |
(setq cases (cdr cases))) |
| 1584 |
(setq gcase (nreverse gcase)) |
| 1585 |
(cond |
| 1586 |
((mew-folder-imapp prefix) |
| 1587 |
(setq mew-nmz-imap-case-alist (nreverse case-alist)) |
| 1588 |
(while (setq case (car gcase)) |
| 1589 |
(mew-nmz-gather-indexed-folder case (mew-imap-folder-alist case) 'imap) |
| 1590 |
(setq gcase (cdr gcase)))) |
| 1591 |
((mew-folder-popp prefix) |
| 1592 |
(setq mew-nmz-pop-case-alist (nreverse case-alist)) |
| 1593 |
(while (setq case (car gcase)) |
| 1594 |
(mew-nmz-gather-indexed-folder case `((,mew-pop-inbox-folder))) |
| 1595 |
(setq gcase (cdr gcase)))) |
| 1596 |
((mew-folder-nntpp prefix) |
| 1597 |
(setq mew-nmz-nntp-case-alist (nreverse case-alist)) |
| 1598 |
(while (setq case (car gcase)) |
| 1599 |
(mew-nmz-gather-indexed-folder case (mew-nntp-folder-alist case) 'nntp) |
| 1600 |
(setq gcase (cdr gcase)))) |
| 1601 |
(t ;; local |
| 1602 |
(mew-nmz-gather-indexed-folder nil (mew-local-folder-alist))))) |
| 1603 |
(mew-nmz-cache-save))) |
| 1604 |
(message "mew-nmz setup...done") |
| 1605 |
(setq mew-nmz-setup-p t) |
| 1606 |
(run-hooks 'mew-nmz-setup-hook))) |
| 1607 |
|
| 1608 |
(defun mew-nmz-status-update () |
| 1609 |
(mew-nmz-cleanup 'remove)) |
| 1610 |
|
| 1611 |
(defconst mew-nmz-cache-parts '(imap-case nntp-case pop-case fld-index url-fld)) |
| 1612 |
|
| 1613 |
(defun mew-nmz-cleanup (&optional remove) |
| 1614 |
(if remove (mew-nmz-cache-remove)) |
| 1615 |
(setq mew-nmz-setup-p nil) |
| 1616 |
(let ((parts (copy-sequence mew-nmz-cache-parts))) |
| 1617 |
(dolist (part parts) |
| 1618 |
(set (mew-nmz-cache-alist-name part) nil)))) |
| 1619 |
|
| 1620 |
(defun mew-nmz-cache-save () |
| 1621 |
(when (stringp mew-nmz-cache-file-prefix) |
| 1622 |
(let ((parts (copy-sequence mew-nmz-cache-parts)) |
| 1623 |
file alist) |
| 1624 |
(dolist (part parts) |
| 1625 |
(setq file (mew-nmz-cache-file-name part)) |
| 1626 |
(setq alist (symbol-value (mew-nmz-cache-alist-name part))) |
| 1627 |
(mew-lisp-save file alist 'nobackup 'unlimit))))) |
| 1628 |
|
| 1629 |
(defun mew-nmz-cache-load () |
| 1630 |
(when (stringp mew-nmz-cache-file-prefix) |
| 1631 |
(let ((parts (copy-sequence mew-nmz-cache-parts)) |
| 1632 |
file) |
| 1633 |
(catch 'noexist |
| 1634 |
(dolist (part parts) |
| 1635 |
(setq file (mew-nmz-cache-file-name part)) |
| 1636 |
(if (file-readable-p file) |
| 1637 |
(set (mew-nmz-cache-alist-name part) (mew-lisp-load file)) |
| 1638 |
(throw 'noexist nil))) |
| 1639 |
t)))) |
| 1640 |
|
| 1641 |
(defun mew-nmz-cache-remove () |
| 1642 |
(when (stringp mew-nmz-cache-file-prefix) |
| 1643 |
(let ((parts (copy-sequence mew-nmz-cache-parts)) |
| 1644 |
file) |
| 1645 |
(dolist (part parts) |
| 1646 |
(setq file (mew-nmz-cache-file-name part)) |
| 1647 |
(when (and (file-exists-p file) (file-writable-p file)) |
| 1648 |
(delete-file file)))))) |
| 1649 |
|
| 1650 |
;; mew-nmz-fixer |
| 1651 |
;; to be continue ... |
| 1652 |
|
| 1653 |
(provide 'mew-nmz) |
| 1654 |
|
| 1655 |
;;; Copyright Notice: |
| 1656 |
|
| 1657 |
;; Copyright (C) 1999-2007 Hideyuki SHIRAI |
| 1658 |
;; Copyright (C) 1994-2007 Mew developing team. |
| 1659 |
;; All rights reserved. |
| 1660 |
|
| 1661 |
;; Redistribution and use in source and binary forms, with or without |
| 1662 |
;; modification, are permitted provided that the following conditions |
| 1663 |
;; are met: |
| 1664 |
;; |
| 1665 |
;; 1. Redistributions of source code must retain the above copyright |
| 1666 |
;; notice, this list of conditions and the following disclaimer. |
| 1667 |
;; 2. Redistributions in binary form must reproduce the above copyright |
| 1668 |
;; notice, this list of conditions and the following disclaimer in the |
| 1669 |
;; documentation and/or other materials provided with the distribution. |
| 1670 |
;; 3. Neither the name of the team nor the names of its contributors |
| 1671 |
;; may be used to endorse or promote products derived from this software |
| 1672 |
;; without specific prior written permission. |
| 1673 |
;; |
| 1674 |
;; THIS SOFTWARE IS PROVIDED BY THE TEAM AND CONTRIBUTORS ``AS IS'' AND |
| 1675 |
;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 1676 |
;; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 1677 |
;; PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE TEAM OR CONTRIBUTORS BE |
| 1678 |
;; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 1679 |
;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 1680 |
;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 1681 |
;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 1682 |
;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 1683 |
;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
| 1684 |
;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 1685 |
|
| 1686 |
;;; mew-nmz.el ends here |