Gnus development mailing list
 help / color / mirror / Atom feed
From: Eric Abrahamsen <eric@ericabrahamsen.net>
To: ding@gnus.org
Subject: Re: [UTF8 problems]
Date: Tue, 16 Mar 2021 10:26:41 -0700	[thread overview]
Message-ID: <87y2enrovi.fsf@ericabrahamsen.net> (raw)
In-Reply-To: <87tupbgwvy.fsf@mat.ucm.es> (Uwe Brauer's message of "Tue, 16 Mar 2021 12:29:05 +0100")

Uwe Brauer <oub@mat.ucm.es> writes:

>>>> "EA" == Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Uwe Brauer <oub@mat.ucm.es> writes:
>>>>>> "EA" == Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>>> 
>>>> Uwe Brauer <oub@mat.ucm.es> writes:
>>>> Hi
>>>> 
>>>> I know that  'mail-header-from extract information from the from field,
>>>> but is there something similar for the CC field. I cannot not find
>>>> anything similar.
>>> 
>>>> In general you can use `gnus-fetch-original-field' to get any header you
>>>> want, specified as a string. So;
>>> 
>>>> (gnus-fetch-original-field "cc")
>>> 
>>> That works fine for ascii, but I just got that result
>>> 
>>> =?UTF-8?Q?Marta_Gonz=C3=A1lez?= <user@ucm.es>
>>> 
>>> That does not happen for org-capture with %:fromname
>>> 
>>> Any ideas?
>
>> (mail-decode-encoded-address-string
>>   (gnus-fetch-original-field "cc"))
>
>> There are some other `mail-decode-encoded-*' functions for other uses.
>
>
> Thanks but it does not work 
>
> Here it is what I did 
>
>
> (defun my-extract-cc ()
>   (interactive)
>   (mail-decode-encoded-address-string
>    (gnus-fetch-original-field "cc")))
>         ("mg" "Annu:Grupos:Ejercicios"
>          table-line (file+headline "~/ALLES/HGs/tex/vorlesungen/HGAnnu/Ejercios-Alumnos-Grupos/2021/Ejercios-Teoria21.org" "Exercicios Annu21")
>          "| | | | | %:fromname|%:fromaddress | %:subject| %(my-extract-cc)  |%^{Hoja|1|2|3|4|5|6|7}|%^{Exercicio|1|} |  %a|%:date | "  :prepend t :empty-lines 1 :unnarrowed t
>          )
>
>
> But then I obtained.
>
>
> | | | | |  %![Error: (wrong-type-argument stringp nil)]  |1|2 |  
>
>
> I tried to debug the function but nothing strange happened. I am really
> puzzled.

Looks like the %(expr) escapes are evaluated in the *Capture* buffer,
not the buffer where you started the capture. You might have to do:

(defun my-extract-cc ()
  (interactive)
  (with-current-buffer (org-capture-get :original-buffer)
    (mail-decode-encoded-address-string
     (gnus-fetch-original-field "cc"))))


  reply	other threads:[~2021-03-16 17:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-12 18:52 how to extract the content of a cc field Uwe Brauer
2021-03-12 19:08 ` Eric Abrahamsen
2021-03-12 21:59   ` Uwe Brauer
2021-03-14 10:53     ` Robert Pluim
2021-03-20  4:38     ` Emanuel Berg
2021-03-14 21:26   ` [UTF8 problems] (was: how to extract the content of a cc field) Uwe Brauer
2021-03-15 23:22     ` [UTF8 problems] Eric Abrahamsen
2021-03-16 11:29       ` Uwe Brauer
2021-03-16 17:26         ` Eric Abrahamsen [this message]
2021-03-16 21:02           ` Uwe Brauer
2021-03-16 21:18             ` Eric Abrahamsen
2021-03-18 12:15           ` [if cc is empty?] (was: [UTF8 problems]) Uwe Brauer
2021-03-18 15:37             ` [if cc is empty?] Eric Abrahamsen
2021-03-18 21:25               ` Uwe Brauer
2021-03-12 19:11 ` how to extract the content of a cc field Andreas Schwab
2021-03-12 19:17   ` Eric Abrahamsen
2021-03-14 21:27   ` Uwe Brauer
2021-03-15 23:08     ` Eric Abrahamsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y2enrovi.fsf@ericabrahamsen.net \
    --to=eric@ericabrahamsen.net \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).