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

Re: message lines



Thanks for all the replies.  Didn't realize this was mentioned in the
manual.  Blush.

[Forgive me, Kai, but isn't your From line a bit overkill (broken)?]

Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> writes:

> Jens-Ulrik Petersen <jens-ulrik.petersen@nokia.com> writes:
> 
> > How hard is it to get nnimap to display the total message size
> > (including that of attachements) in the summary buffer?
> 
> Yes, I wanted that, too, so here's what I did.  Probably this is just
> a crock, but it does seem to work...
> 
> ;; Use %c rather than %L because nnimap doesn't inlude the line
> ;; count for attachments in the line count.
> (require 'gnus-sum)
> (defsubst kai-gnus-summary-line-message-size (header)
>   (let ((c (or (mail-header-chars header) 0)))
>     (cond ((< c 1024) (format "%db" c))
>           ((< c (* 1024 1024)) (format "%dk" (/ c 1024)))
>           (t (format "%dM" (/ c (* 1024 1024)))))))
> (add-to-list 'gnus-summary-line-format-alist
>              '(?k (kai-gnus-summary-line-message-size gnus-tmp-header) ?s))
> (setq gnus-summary-line-format "%U%R%z%I%(%[%d,%4k: %-15,15f%]%) %s\n")
> 
> If you find a better way to format the size, let me know.  It is
> somewhat strange that a message with 1010 bytes will display as
> "1010b" whereas a message with 1030 bytes will display as "1k".

Thanks for the inspiration.  Fyi below is what I started to use now.

      
(defsubst gnus-user-format-function-S (header)
  "Returns message size in kB for `gnus-summary-line-format', if greater than
`gnus-summary-line-show-size-threshold'."
  (let* ((c (or (mail-header-chars header) 0)))
    (if (> c gnus-summary-line-show-size-threshold)
	(format "%3dk " (/ c 1024.0))
      "")))
(defvar gnus-summary-line-show-size-threshold 10000
  "(juhp) Value above which message size is shown in my summary line.")
(setq gnus-summary-line-format "%U%R%z%I%uS%(%[%-20,20n%]%) %s\n")


Cheers, Jens