[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: indicate email has attachment in summary buffer
From: |
Leon |
Subject: |
Re: indicate email has attachment in summary buffer |
Date: |
Thu, 03 Aug 2006 12:49:55 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (gnu/linux) |
Reiner Steib <reinersteib+gmane@imap.cc> writes:
> On Wed, Aug 02 2006, Frank Schmitt wrote:
>
>> Leon <sdl.web@gmail.com> writes:
>>
>>> I have just completed a project with 4 people based on emails. I
>>> almost missed an important file attached in an email. That's how I
>>> found an indicator of attachment in gnus summary line will be
>>> practically useful.
>>>
>>> It happened like this.
>>> The message, as we always include the original, became very long. And
>>> the attachment in gnus is shown at the end of the article buffer that
>>> I missed it.
>
> The mode line displays something like "(2 parts)".
>
> You also might consider this settings, cf. (info "(gnus)Article
> Hiding"):
>
> (setq
> gnus-treat-hide-citation t ; nice w/ non-nil gnus-cited-lines-visible
> gnus-cited-lines-visible '(3 . 6)) ; (top . bottom)
This is useful in general:)
>
>>> So I'm wondering is there any way I can have an indicator in the
>>> summary line for emails that have attachment. For example something
>>> like this will be useful:
>>>
>>> O +|31-Jul| Hadron Quark | 160|@● Always show 20 posts
>>>
>>> The '@' at the beginning of the subject indicates attachment.
>>
>> Yes, this is possible, however it isn't easy, you have to write some
>> lisp to do it: [...]
>
> Or as often: Find someone who already has written it. ;-)
>
>> Now you "only" have to write a function which takes the header and
>> searches for "Content-Type: multipart/mixed". If it is found your
>> function returns an "@", otherwise it returns a " ". This should be
>> really easy for someone who knows some lisp. (Rainer? :-))
>
> s/ai/ei/ if you thought of me. ;-)
>
> ;; rs-gnus-summary.el -- Auxiliary summary mode commands for Gnus
> [...]
> ;; X-URL:
> http://theotp1.physik.uni-ulm.de/~ste/comp/emacs/gnus/rs-gnus-summary.el
>
> See the installation instructions in the file. Especially the
> following functions and variables are for the Content-Type:
>
> ,----[ <f1> f rs-gnus-summary-line-content-type RET ]
> | rs-gnus-summary-line-content-type is a Lisp function in
> `rs-gnus-summary.el'.
> | (rs-gnus-summary-line-content-type header)
> |
> | Display content type of message in summary line.
> |
> | This function is intended to be used in `gnus-summary-line-format-alist',
> with
> | (defalias 'gnus-user-format-function-X 'rs-gnus-summary-line-content-type).
> | See (info "(gnus)Group Line Specification").
> |
> | You need to add `Content-Type' to `nnmail-extra-headers' and
> | `gnus-extra-headers', see Info node `(gnus)To From Newsgroups'.
> `----
>
> ,----[ <f1> v rs-gnus-summary-line-content-type-alist RET ]
> | rs-gnus-summary-line-content-type-alist is a variable defined in
> | `rs-gnus-summary.el'.
> | Its value is shown below.
> |
> | Documentation:
> | Alist of regular expressions and summary line indicators.
> |
> | You can customize this variable.
> |
> | Value:
> | (("^text/plain" " ")
> | ("^text/html" "h")
> | ("^multipart/mixed" "m")
> | ("^multipart/alternative" "a")
> | ("^multipart/related" "r")
> | ("^multipart/signed" "s")
> | ("^multipart/encrypted" "e")
> | ("^multipart/report" "t"))
> `----
>
> (defalias 'gnus-user-format-function-ct 'rs-gnus-summary-line-content-type)
>
> Then add %u&ct; in `gnus-summary-line-format' and regenerate the NOV
> files as described in the manual:
>
> ,----[ (info "(gnus)To From Newsgroups") ]
> | A related variable is `nnmail-extra-headers', which controls when to
> | include extra headers when generating overview (NOV) files. If you
> | have old overview files, you should regenerate them after changing this
> | variable, by entering the server buffer using `^', and then `g' on the
> | appropriate mail server (e.g. nnml) to cause regeneration.
> `----
>
> Bye, Reiner.
I have adapt one function from rs-gnus-summary.el as:
(defun gnus-user-format-function-@ (header)
"Display @ for message with attachment in summary line.
You need to add `Content-Type' to `nnmail-extra-headers' and
`gnus-extra-headers', see Info node `(gnus)To From Newsgroups'."
(let ((case-fold-search t)
(ctype (or (cdr (assq 'Content-Type (mail-header-extra header)))
"text/plain"))
indicator)
(when (string-match "^multipart/mixed" ctype)
(setq indicator "@"))
(if indicator
indicator
" ")))
As you can see, I only match "^multipart/mixed" with Content-type. Do
you think this is reliable to match all emails with attachment?
Thank you.
--
Leon
- indicate email has attachment in summary buffer, Leon, 2006/08/02
- Re: indicate email has attachment in summary buffer, Frank Schmitt, 2006/08/02
- Re: indicate email has attachment in summary buffer, Reiner Steib, 2006/08/02
- Re: indicate email has attachment in summary buffer,
Leon <=
- Re: indicate email has attachment in summary buffer, Reiner Steib, 2006/08/03
- Re: indicate email has attachment in summary buffer, Leon, 2006/08/03
- Re: indicate email has attachment in summary buffer, Reiner Steib, 2006/08/03
- Re: indicate email has attachment in summary buffer, Leon, 2006/08/03
- Re: indicate email has attachment in summary buffer, Reiner Steib, 2006/08/05
- Re: indicate email has attachment in summary buffer, Leon, 2006/08/05
- Re: indicate email has attachment in summary buffer, Leon, 2006/08/04
- Re: indicate email has attachment in summary buffer, Reiner Steib, 2006/08/04
- Re: indicate email has attachment in summary buffer, Leon, 2006/08/04
- Re: indicate email has attachment in summary buffer, Reiner Steib, 2006/08/05