15
15
;;; along with this program; if not, write to the Free Software
16
16
;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18
;;(provide 'vm-summary)
20
20
(defun vm-summary-mode-internal ()
21
21
(setq mode-name "VM Summary"
22
22
major-mode 'vm-summary-mode
23
23
mode-line-format vm-mode-line-format
24
24
;; must come after the setting of major-mode
25
mode-popup-menu (and vm-use-menus vm-popup-menu-on-mouse-3
25
mode-popup-menu (and vm-use-menus
26
26
(vm-menu-support-possible-p)
27
27
(vm-menu-mode-menu))
342
342
(vm-decode-mime-encoded-words-in-string (eval (cdr match)))))))
344
344
(defun vm-summary-compile-format (format tokenize)
345
(let ((return-value (vm-summary-compile-format-1 format tokenize)))
345
(let ((return-value (nth 1 (vm-summary-compile-format-1 format tokenize))))
347
347
(setq vm-summary-tokenized-compiled-format-alist
348
348
(cons (cons format return-value)
354
354
(defun vm-tokenized-summary-insert (message tokens)
355
355
(if (stringp tokens)
357
(let (token group-list)
359
359
(setq token (car tokens))
360
360
(cond ((stringp token)
361
361
(if vm-display-using-mime
362
362
(insert (vm-decode-mime-encoded-words-in-string token))
364
((eq token 'group-begin)
365
(setq group-list (cons (list (point) (nth 1 tokens)
368
tokens (cdr (cdr tokens))))
369
((eq token 'group-end)
370
(let* ((space (string-to-char " "))
371
(blob (car group-list))
373
(field-width (nth 1 blob))
374
(precision (nth 2 blob))
375
(end (vm-marker (point))))
376
(if (integerp field-width)
377
(if (< (- end start) (vm-abs field-width))
378
(if (< field-width 0)
379
(insert-char space (vm-abs (+ field-width
383
(insert-char space (- field-width
385
(if (integerp precision)
386
(if (> (- end start) (vm-abs precision))
388
(delete-char (- precision (- end start)))
391
(delete-char (vm-abs (+ precision
393
(setq group-list (cdr group-list))))
364
394
((eq token 'number)
365
395
(insert (vm-padded-number-of message)))
366
396
((eq token 'mark)
372
402
(vm-th-thread-indentation message))))))
373
403
(setq tokens (cdr tokens))))))
375
(defun vm-summary-compile-format-1 (format &optional tokenize)
405
(defun vm-summary-compile-format-1 (format &optional tokenize start-index)
406
(or start-index (setq start-index 0))
376
407
(let ((case-fold-search nil)
408
(finished-parsing-format nil)
412
(saw-close-group nil)
413
(last-match-end start-index)
414
new-match-end token conv-spec splice)
383
415
(store-match-data nil)
416
(while (and (not saw-close-group) (not finished-parsing-format))
420
(and (not saw-close-group) (not token)
389
"%\\(-\\)?\\([0-9]+\\)?\\(\\.\\(-?[0-9]+\\)\\)?\\([aAcdfFhHiIlLmMnstTwyz*%]\\|U[A-Za-z]\\)"
390
format (match-end 0)))
422
"%\\(-\\)?\\([0-9]+\\)?\\(\\.\\(-?[0-9]+\\)\\)?\\([()aAcdfFhHiIlLmMnstTwyz*%]\\|U[A-Za-z]\\)"
423
format last-match-end))
391
424
(setq conv-spec (aref format (match-beginning 5)))
392
(if (memq conv-spec '(?a ?A ?c ?d ?f ?F ?h ?H ?i ?L ?I ?l ?M
393
?m ?n ?s ?t ?T ?U ?w ?y ?z ?* ))
425
(setq new-match-end (match-end 0))
426
(if (and (memq conv-spec '(?\( ?\) ?a ?A ?c ?d ?f ?F ?h ?H ?i ?I
427
?l ?L ?M ?m ?n ?s ?t ?T ?U ?w ?y ?z ?* ))
428
;; for the non-tokenized path, we don't want
429
;; the close group spcifier processed here, we
430
;; want to just bail out and return, which is
431
;; accomplished by setting a flag in the other
432
;; branch of this 'if'.
433
(or tokenize (not (= conv-spec ?\)))))
395
(cond ((= conv-spec ?a)
435
(cond ((= conv-spec ?\()
438
(let ((retval (vm-summary-compile-format-1
439
format tokenize (match-end 5))))
440
(setq sexp (cons (nth 1 retval) sexp)
441
new-match-end (car retval))))
442
(setq token `('group-begin
443
,(if (match-beginning 2)
445
(concat (match-string 1 format)
446
(match-string 2 format))))
448
(match-string 4 format)))
451
(setq token ''group-end))
396
453
(setq sexp (cons (list 'vm-su-attribute-indicators
397
454
'vm-su-message) sexp)))
398
455
((= conv-spec ?A)
520
577
(match-beginning 0))
580
(cons (if (eq conv-spec ?\))
581
(prog1 "" (setq saw-close-group t))
524
583
(cons (substring format
525
584
(or last-match-end 0)
526
585
(match-beginning 0))
528
(setq last-match-end (match-end 0)))
587
(setq last-match-end new-match-end))
588
(if (and (not saw-close-group) (not token))
531
590
(cons (substring format last-match-end (length format))
592
finished-parsing-format t))
534
593
(setq sexp-fmt (apply 'concat (nreverse sexp-fmt)))
536
595
(setq sexp (cons 'format (cons sexp-fmt (nreverse sexp))))
537
596
(setq sexp sexp-fmt))
539
598
(setq list (nconc list (if (equal sexp "") nil (list sexp))
540
(and token (list token)))
599
(and token (if splice token (list token))))
543
(if list (cons 'list list) sexp)))
602
(list last-match-end (if list (cons 'list list) sexp))))
545
604
(defun vm-get-header-contents (message header-name-regexp &optional clump-sep)
546
605
(let ((contents nil)
1089
1148
(vm-set-summary-of (car mp) nil)
1090
1149
(vm-mark-for-summary-update (car mp))
1091
(vm-set-modflag-of (car mp) t)
1150
(vm-set-stuff-flag-of (car mp) t)
1092
1151
(setq mp (cdr mp)))
1152
(message "Stuffing attributes...")
1093
1153
(vm-stuff-folder-attributes nil)
1154
(message "Stuffing attributes... done")
1094
1155
(set-buffer-modified-p t)
1095
1156
(vm-update-summary-and-mode-line))
1096
1157
(message "Fixing your summary... done"))
1098
1159
(defun vm-su-thread-indent (m)
1099
(if (natnump vm-summary-thread-indent-level)
1160
(if (and vm-summary-show-threads (natnump vm-summary-thread-indent-level))
1100
1161
(make-string (* (vm-th-thread-indentation m)
1101
1162
vm-summary-thread-indent-level)
1451
1512
major-mode 'vm-folders-summary-mode
1452
1513
mode-line-format '(" %b")
1453
1514
;; must come after the setting of major-mode
1454
mode-popup-menu (and vm-use-menus vm-popup-menu-on-mouse-3
1515
mode-popup-menu (and vm-use-menus
1455
1516
(vm-menu-support-possible-p)
1456
1517
(vm-menu-mode-menu))
1457
1518
buffer-read-only t