* How to strip names out of To: and CC:
@ 2007-10-18 17:42 jidanni
2007-10-18 18:53 ` Reiner Steib
0 siblings, 1 reply; 18+ messages in thread
From: jidanni @ 2007-10-18 17:42 UTC (permalink / raw)
To: ding
How can I use message-header-setup-hook
to make
To: Bob Dobbs <b@d.c>
become
To: b@d.c
(Something like what mail-extr-ignore-single-names or
mail-extr-ignore-realname-equals-mailbox-name do but more intense.)
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2007-10-18 17:42 How to strip names out of To: and CC: jidanni
@ 2007-10-18 18:53 ` Reiner Steib
2007-10-20 19:30 ` jidanni
0 siblings, 1 reply; 18+ messages in thread
From: Reiner Steib @ 2007-10-18 18:53 UTC (permalink / raw)
To: ding
On Thu, Oct 18 2007, jidanni@jidanni.org wrote:
> How can I use message-header-setup-hook
> to make
> To: Bob Dobbs <b@d.c>
> become
> To: b@d.c
`mail-extract-address-components'/`gnus-extract-address-components'
(I won't provide code because I consider it a bad idea.)
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2007-10-18 18:53 ` Reiner Steib
@ 2007-10-20 19:30 ` jidanni
2007-10-21 5:54 ` Daniel Pittman
0 siblings, 1 reply; 18+ messages in thread
From: jidanni @ 2007-10-20 19:30 UTC (permalink / raw)
To: ding
Well here's how far I got:
(defun jidanni-message-to-cc-no-names ()
"Strip the names out of To: and Cc:,
leaving just the addresses, for a more spartan style."
(let
(mapcar
(lambda(X)
((X-content
(mapcar
(lambda(x)(cadr x))
(mail-extract-address-components x t))))
(message-fetch-field "X"))
(message-goto-X)(message-delete-line);OR (message-remove-header X)?
(insert (concat "X: " X-content "\n")) (list to cc))))
(add-hook 'message-header-setup-hook
'jidanni-message-to-cc-no-names)
Of course it is just a jumble of Lisp Concepts in no special order
that took several hours for me to amass.
Or maybe I would be smarter to just hack the definition of
mail-extract-address-components and gnus-extract-address-components to
cause them to lose the names, but that would be like painting the
traffic light green.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2007-10-20 19:30 ` jidanni
@ 2007-10-21 5:54 ` Daniel Pittman
2007-10-24 18:52 ` jidanni
0 siblings, 1 reply; 18+ messages in thread
From: Daniel Pittman @ 2007-10-21 5:54 UTC (permalink / raw)
To: ding
jidanni@jidanni.org writes:
> Well here's how far I got:
> (defun jidanni-message-to-cc-no-names ()
> "Strip the names out of To: and Cc:,
> leaving just the addresses, for a more spartan style."
> (let
> (mapcar
> (lambda(X)
> ((X-content
> (mapcar
> (lambda(x)(cadr x))
> (mail-extract-address-components x t))))
> (message-fetch-field "X"))
> (message-goto-X)(message-delete-line);OR (message-remove-header X)?
> (insert (concat "X: " X-content "\n")) (list to cc))))
>
> (add-hook 'message-header-setup-hook
> 'jidanni-message-to-cc-no-names)
>
> Of course it is just a jumble of Lisp Concepts in no special order
> that took several hours for me to amass.
>
> Or maybe I would be smarter to just hack the definition of
> mail-extract-address-components and gnus-extract-address-components to
> cause them to lose the names, but that would be like painting the
> traffic light green.
You might do better setting the value of the variable
`gnus-extract-address-components' to something that called an existing
method, expunged the name part, then returned the result.
Like others I /really/ don't think this is a good idea, but that
involves no hacking and minimal writing of code for your purposes.
Regards,
Daniel
--
Daniel Pittman <daniel@cybersource.com.au> Phone: 03 9621 2377
Level 4, 10 Queen St, Melbourne Web: http://www.cyber.com.au
Cybersource: Australia's Leading Linux and Open Source Solutions Company
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2007-10-21 5:54 ` Daniel Pittman
@ 2007-10-24 18:52 ` jidanni
2007-10-24 20:03 ` Reiner Steib
0 siblings, 1 reply; 18+ messages in thread
From: jidanni @ 2007-10-24 18:52 UTC (permalink / raw)
To: ding
> setting the value of the variable `gnus-extract-address-components'
Ah! Of course. I can finally achieve the reasonable goals (no?) of
(describe-variable 'mail-extr-ignore-realname-equals-mailbox-name)
(describe-variable 'mail-extr-ignore-single-names)
to decrease the stupidity of my outgoing mail. Every little bit helps!
The key is to use
(setq gnus-extract-address-components 'mail-extract-address-components)
However, that doesn't work. That isn't apparently part of what happens
when one hits "r" (gnus-summary-reply). Instead that seems to be part
of what is called to do different things owhen setting up the *Summary*
buffer, which I don't want to affect. I only want to affect what
happens when I chose to reply to a message.
And one day when I finally achieve my aforementioned reasonable goals,
which you all must admit are very reasonable, I can go further,
to achieve the only part which you disagree with,
(setq mail-extr-full-name-prefixes ".+");wipe names completely
Anyway, I see a bug: there is no way to make gnus do the
aforementioned reasonable things via a reasonable way!
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2007-10-24 18:52 ` jidanni
@ 2007-10-24 20:03 ` Reiner Steib
2007-10-24 22:06 ` jidanni
0 siblings, 1 reply; 18+ messages in thread
From: Reiner Steib @ 2007-10-24 20:03 UTC (permalink / raw)
To: ding
On Wed, Oct 24 2007, jidanni@jidanni.org wrote:
> Anyway, I see a bug: there is no way to make gnus do the
> aforementioned reasonable things via a reasonable way!
The manual says: "Gnus gives you all the opportunity you could
possibly want for shooting yourself in the foot." I'm quite sure your
unreasonable thing doesn't require more than 5-10 lines of code
included in `message-send-mail-hook'.
The reasonable way is to read the "Emacs Lisp Intro: (eintr)" and some
similar code from `message.el'. After finishing this exercise, you
will probably be able to provide many really useful patches for Gnus
in the future yourself.
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2007-10-24 20:03 ` Reiner Steib
@ 2007-10-24 22:06 ` jidanni
2007-10-24 23:16 ` Bastien
0 siblings, 1 reply; 18+ messages in thread
From: jidanni @ 2007-10-24 22:06 UTC (permalink / raw)
To: ding
message-send-mail-hook is too late. You meant message-send-mail-hook.
In this debug trace,
run-hooks(message-header-setup-hook)
message-setup-1((((To . "\"yapcheah@gmail.com\" <yapcheah@gmail.com>"...
Dan should focus his attention on ^^^^^^^^^^^^^^^^^^^^^^
message-setup(...
message-reply(nil nil)
gnus-summary-reply(nil)
call-interactively(gnus-summary-reply)
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
@ 2007-11-09 3:26 jidanni
2007-11-09 17:54 ` jidanni
2008-03-19 16:46 ` Reiner Steib
0 siblings, 2 replies; 18+ messages in thread
From: jidanni @ 2007-11-09 3:26 UTC (permalink / raw)
To: ding
Dear Gnus Pals: I have changed the function message-get-reply-headers.
I have put the new version, all 200+ lines of it, in my .gnus.el file.
;;jidanni changed
;; (cons (downcase (mail-strip-quoted-names addr)) addr))
;;to
(cons (downcase (mail-strip-quoted-names addr))
(downcase (mail-strip-quoted-names addr))))
;;to avoid looking like a fool, even more consistantly than
;;mail-extr-ignore-realname-equals-mailbox-name and
;;mail-extr-ignore-single-names could, before gnus ignored them anyway
Of course you, the authors, could kindly add one little variable, say
message-austere-to-cc-reply, to toggle so we can avoid having to
redefine the whole hundreds line function.
No, this one line change cannot be done with one line in some hook, so
forget that.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2007-11-09 3:26 jidanni
@ 2007-11-09 17:54 ` jidanni
2008-03-19 16:46 ` Reiner Steib
1 sibling, 0 replies; 18+ messages in thread
From: jidanni @ 2007-11-09 17:54 UTC (permalink / raw)
To: ding
Indeed, here lies your opportunity to end the embarrassment of
To: "d@d.d" <d@d.d>
which many of you seem to think looks just fine in one's outbound mail.
By adding a variable (pointing to a function) at
(cons (downcase (mail-strip-quoted-names addr)) addr))
you could bring back the now lost functionality of
mail-extr-ignore-realname-equals-mailbox-name,
mail-extr-ignore-single-names,
and allow my style of strip everything except the raw@address.com too.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2007-11-09 3:26 jidanni
2007-11-09 17:54 ` jidanni
@ 2008-03-19 16:46 ` Reiner Steib
2008-03-21 3:16 ` jidanni
1 sibling, 1 reply; 18+ messages in thread
From: Reiner Steib @ 2008-03-19 16:46 UTC (permalink / raw)
To: jidanni; +Cc: ding
On Fri, Nov 09 2007, jidanni@jidanni.org wrote:
> Dear Gnus Pals: I have changed the function message-get-reply-headers.
> I have put the new version, all 200+ lines of it, in my .gnus.el file.
>
> ;;jidanni changed
> ;; (cons (downcase (mail-strip-quoted-names addr)) addr))
> ;;to
> (cons (downcase (mail-strip-quoted-names addr))
> (downcase (mail-strip-quoted-names addr))))
> ;;to avoid looking like a fool, even more consistantly than
> ;;mail-extr-ignore-realname-equals-mailbox-name and
> ;;mail-extr-ignore-single-names could, before gnus ignored them anyway
>
> Of course you, the authors, could kindly add one little variable, say
> message-austere-to-cc-reply, to toggle so we can avoid having to
> redefine the whole hundreds line function.
>
> No, this one line change cannot be done with one line in some hook, so
> forget that.
On Fri, Nov 09 2007, jidanni@jidanni.org wrote:
> Indeed, here lies your opportunity to end the embarrassment of
> To: "d@d.d" <d@d.d>
> which many of you seem to think looks just fine in one's outbound mail.
Should be possible with the CVS version now:
2008-03-19 Reiner Steib <Reiner.Steib@gmx.de>
* message.el (message-alter-recipients-discard-bogus-full-name): New
function.
(message-alter-recipients-function): New variable.
(message-get-reply-headers): Use it.
,----[ <f1> v message-alter-recipients-function RET ]
| message-alter-recipients-function is a variable defined in `message.el'.
| Its value is message-alter-recipients-discard-bogus-full-name
|
| Documentation:
| Function called to allow alteration of reply header structures.
| It is called in `message-get-reply-headers' for each recipient.
| The function is called with one parameter, a cons cell ...
|
| You can customize this variable.
`----
,----[ <f1> f message-alter-recipients-discard-bogus-full-name RET ]
| message-alter-recipients-discard-bogus-full-name is a Lisp function
| in `message.el'.
| (message-alter-recipients-discard-bogus-full-name addrcell)
|
| Discard mail address in full names.
| When the full name in reply headers contains the mail
| address (e.g. "foo@bar <foo@bar>"), discard full name.
| addrcell is a cons cell where the car is the mail address and the
| cdr is the complete address (full name and mail address).
`----
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2008-03-19 16:46 ` Reiner Steib
@ 2008-03-21 3:16 ` jidanni
2008-03-21 7:35 ` Reiner Steib
0 siblings, 1 reply; 18+ messages in thread
From: jidanni @ 2008-03-21 3:16 UTC (permalink / raw)
To: ding
I assume you allow users to strip names unconditionally too.
I'll use Debian's flaky at(1) to make a note to find out when the time
comes and it reaches Debian sid. Thanks.
$ echo echo try http://permalink.gmane.org/gmane.emacs.gnus.general/66532|
env - at now+6\ months
warning: commands will be executed using /bin/sh
job 771 at Sun Sep 21 11:10:00 2008
Can't signal atd (permission denied)
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2008-03-21 3:16 ` jidanni
@ 2008-03-21 7:35 ` Reiner Steib
2010-02-03 3:02 ` jidanni
0 siblings, 1 reply; 18+ messages in thread
From: Reiner Steib @ 2008-03-21 7:35 UTC (permalink / raw)
To: jidanni; +Cc: ding
On Fri, Mar 21 2008, jidanni@jidanni.org wrote:
> I assume you allow users to strip names unconditionally too.
Well, your case "foo@bar <foo@bar>" is covered by
`message-alter-recipients-discard-bogus-full-name'. If you want more,
write your own variant based on it (should be very simple).
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2008-03-21 7:35 ` Reiner Steib
@ 2010-02-03 3:02 ` jidanni
2010-02-03 19:25 ` jidanni
0 siblings, 1 reply; 18+ messages in thread
From: jidanni @ 2010-02-03 3:02 UTC (permalink / raw)
To: ding; +Cc: Reiner.Steib
message-simplify-recipients is an interactive compiled Lisp function
in `message.el'.
1. This function is apparently unused by any other code.
2. When I do M-x message-simplify-recipients, it does what I want.
However, when I put it into any hook, it causes an error that mentions
the "--text follows this line--" separator.
3. It seems to work on addresses, even if they don't match
message-recipients-without-full-name, which is fine with me though.
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2010-02-03 3:02 ` jidanni
@ 2010-02-03 19:25 ` jidanni
2010-02-03 19:48 ` Reiner Steib
0 siblings, 1 reply; 18+ messages in thread
From: jidanni @ 2010-02-03 19:25 UTC (permalink / raw)
To: ding; +Cc: reiner.steib
>>>>> "j" == jidanni <jidanni@jidanni.org> writes:
j> message-simplify-recipients is an interactive compiled Lisp function
j> in `message.el'.
j> 1. This function is apparently unused by any other code.
j> 2. When I do M-x message-simplify-recipients, it does what I want.
j> However, when I put it into any hook, it causes an error that mentions
j> the "--text follows this line--" separator.
j> 3. It seems to work on addresses, even if they don't match
j> message-recipients-without-full-name, which is fine with me though.
Never mind, I'll just do
(defun jidanni-message-alter-recipients-discard-all-names (addrcell)
"Discard all names in mail addresses, because it looks neater"
(cons (car addrcell) (car addrcell)))
(setq message-alter-recipients-function 'jidanni-message-alter-recipients-discard-all-names)
P.S., hope this shows up in gmane.emacs.gnus.general...
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: How to strip names out of To: and CC:
2010-02-03 19:25 ` jidanni
@ 2010-02-03 19:48 ` Reiner Steib
2010-02-03 20:15 ` jidanni
0 siblings, 1 reply; 18+ messages in thread
From: Reiner Steib @ 2010-02-03 19:48 UTC (permalink / raw)
To: jidanni; +Cc: ding
On Wed, Feb 03 2010, jidanni@jidanni.org wrote:
>>>>>> "j" == jidanni <jidanni@jidanni.org> writes:
> j> message-simplify-recipients is an interactive compiled Lisp function
> j> in `message.el'.
>
> j> 1. This function is apparently unused by any other code.
So what?
> j> 2. When I do M-x message-simplify-recipients, it does what I want.
> j> However, when I put it into any hook, it causes an error that mentions
> j> the "--text follows this line--" separator.
Which hook? You need to use a hook run in the message buffer.
> j> 3. It seems to work on addresses, even if they don't match
> j> message-recipients-without-full-name, which is fine with me though.
It shouldn't. Please provide an example including the headers and
your value of `message-recipients-without-full-name'.
> Never mind, I'll just do
> (defun jidanni-message-alter-recipients-discard-all-names (addrcell)
> "Discard all names in mail addresses, because it looks neater"
> (cons (car addrcell) (car addrcell)))
>
> (setq message-alter-recipients-function 'jidanni-message-alter-recipients-discard-all-names)
>
> P.S., hope this shows up in gmane.emacs.gnus.general...
Both articles did. BTW, please don't Cc me.
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2010-02-03 20:15 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-18 17:42 How to strip names out of To: and CC: jidanni
2007-10-18 18:53 ` Reiner Steib
2007-10-20 19:30 ` jidanni
2007-10-21 5:54 ` Daniel Pittman
2007-10-24 18:52 ` jidanni
2007-10-24 20:03 ` Reiner Steib
2007-10-24 22:06 ` jidanni
2007-10-24 23:16 ` Bastien
2007-10-24 23:25 ` jidanni
2007-11-09 3:26 jidanni
2007-11-09 17:54 ` jidanni
2008-03-19 16:46 ` Reiner Steib
2008-03-21 3:16 ` jidanni
2008-03-21 7:35 ` Reiner Steib
2010-02-03 3:02 ` jidanni
2010-02-03 19:25 ` jidanni
2010-02-03 19:48 ` Reiner Steib
2010-02-03 20:15 ` jidanni
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).