[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New default config



At Tue, 26 Jan 2010 16:30:35 +0000,
Eric S Fraga wrote:
>
> […]
>
> To your list, I would also add:
> 
>   * show number of total+unread messages in a thread in the summary
>     window when thread is collapsed.  This would be particularly
>     useful for nntp folders with large (mostly rubbish) volume.
> 
> Thunderbird may or may not do this but I'm not about to spend time on
> TB... ;-)

OK, done! Inspired by x/y/z format in summary. Use %u in your
wl-summary-line-format. This code may or may not be intolerably slow.

While I am at it, I also have some code that inserts a > or >>
(inspired by gmail) in the summary line if you are, respectively, a
recipient, or the *only* recipient of a message. Use %E in
wl-summary-line-format. (Ron Isaacson supplied the original version,
which inserted a * if the message was to/cc you.)

If there is agreement that these are useful and are not taking up
valuable % strings in wl-summary-line-format-spec-alist I can create
patches. Probably I should use another character for %E because that
is what Ron Isaacson originally used.

best,
Erik Hetzner

(defun egh:wl-thread-entity-get-new/unread/all-children-nums (entity)
  (let ((new-count 0)
        (unread-count 0)
        (all-count 0)
        children
        msgs-stack
        (msgs (list (car entity))))
   (while msgs
     (setq msgs (cdr msgs))
     (setq children (wl-thread-entity-get-children entity))
     (if (null children)
         (while (and (null msgs) msgs-stack)
           (setq msgs (wl-pop msgs-stack)))
       (mapcar (lambda (num)
                 (let ((flags (elmo-message-flags
                               wl-summary-buffer-elmo-folder num)))
                   (if (member 'unread flags)
                       (setq unread-count (+ unread-count 1)))
                   (if (member 'new flags)
                       (setq new-count (+ new-count 1)))
                   (setq all-count (+ all-count 1))))
                 children)
       (wl-push msgs msgs-stack)
       (setq msgs children))
     (setq entity (wl-thread-get-entity (car msgs))))
   (list new-count unread-count all-count)))

(setq wl-summary-line-format-spec-alist
      (put-alist '?u 
                 '((if wl-thr-children-number
                       (concat "+"
                               (mapconcat (lambda (n) (number-to-string n))
                                          (egh:wl-thread-entity-get-new/unread/all-children-nums
                                           (wl-thread-get-entity (elmo-message-entity-number wl-message-entity)))
                                          "/")
                               ":")
                     ""))
                 wl-summary-line-format-spec-alist))

;; Ron Isaacson supplied the original version.
(defun egh:wl-summary-line-to-me ()
  (let ((all-addresses
         (mapcar (lambda (a)
                   (downcase (wl-address-header-extract-address a)))
          (append
           (elmo-message-entity-field wl-message-entity 'to t)
           (elmo-message-entity-field wl-message-entity 'cc t))))
        (to-me nil))
    (if (eq 1 (length all-addresses))
        (if (member (car all-addresses) wl-user-mail-address-list)
            ">>" "  ") ; »
      (progn
        (while (and all-addresses
                    (not to-me))
          (setq to-me (member (car all-addresses) wl-user-mail-address-list))
          (setq all-addresses (cdr all-addresses)))
        (if to-me " >" "  ")))))

(setq wl-summary-line-format-spec-alist
      (put-alist '?E
		 '((egh:wl-summary-line-to-me))
		 wl-summary-line-format-spec-alist))

Attachment: pgpanARfM14HU.pgp
Description: PGP signature