* how can I convert the To field to CC
@ 2021-02-19 20:57 Uwe Brauer
2021-02-19 21:09 ` Emanuel Berg
2021-02-20 1:10 ` Emanuel Berg
0 siblings, 2 replies; 29+ messages in thread
From: Uwe Brauer @ 2021-02-19 20:57 UTC (permalink / raw)
To: ding
Hi
Of course I can do this manually but I thought there might be a function
doing it,
Use case:
For example I expanded a mail alias that contains a lot of
addresses but I did this in the TO field not in the CC field. Would be
nifty if I could change it on the fly
Regards
Uwe Brauer
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-19 20:57 how can I convert the To field to CC Uwe Brauer
@ 2021-02-19 21:09 ` Emanuel Berg
2021-02-20 1:10 ` Emanuel Berg
1 sibling, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2021-02-19 21:09 UTC (permalink / raw)
To: ding
Uwe Brauer wrote:
> For example I expanded a mail alias that contains a lot of
> addresses but I did this in the TO field not in the CC
> field. Would be nifty if I could change it on the fly
Write a defun...
(message-fetch-field "To")
then
(message-goto-cc)
(insert ...)
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-19 20:57 how can I convert the To field to CC Uwe Brauer
2021-02-19 21:09 ` Emanuel Berg
@ 2021-02-20 1:10 ` Emanuel Berg
2021-02-20 10:16 ` Uwe Brauer
2021-02-20 10:21 ` Uwe Brauer
1 sibling, 2 replies; 29+ messages in thread
From: Emanuel Berg @ 2021-02-20 1:10 UTC (permalink / raw)
To: ding
Uwe Brauer wrote:
> For example I expanded a mail alias that contains a lot of
> addresses but I did this in the TO field not in the CC
> field. Would be nifty if I could change it on the fly
;; is there really no function like this already?
(defun message-set-header (hdr val)
(interactive "sheader: \nsvalue: ")
;; check here if there _is_ such a header - how?
;; also a must-have, super-simple building-block from the holster
;; but can't find it either
(message-position-on-field hdr)
(message-beginning-of-line)
(delete-region (point) (point-at-eol))
(insert val) )
;; test:
;; (message-set-header "Subject" "Lara loves YOU")
(defun message-transpose-headers (hdr1 hdr2)
(interactive "sheader 1: \nsheader 2: ")
(let ((v1 (message-field-value hdr1))
(v2 (message-field-value hdr2)))
(message-set-header hdr1 v2)
(message-set-header hdr2 v1) ))
;; test:
;; (message-transpose-headers "To" "Subject")
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-20 1:10 ` Emanuel Berg
@ 2021-02-20 10:16 ` Uwe Brauer
2021-02-20 19:03 ` Emanuel Berg
2021-02-20 10:21 ` Uwe Brauer
1 sibling, 1 reply; 29+ messages in thread
From: Uwe Brauer @ 2021-02-20 10:16 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]
>>> "EB" == Emanuel Berg <moasenwood@zoho.eu> writes:
> Uwe Brauer wrote:
>> For example I expanded a mail alias that contains a lot of
>> addresses but I did this in the TO field not in the CC
>> field. Would be nifty if I could change it on the fly
> ;; is there really no function like this already?
> (defun message-set-header (hdr val)
> (interactive "sheader: \nsvalue: ")
> ;; check here if there _is_ such a header - how?
> ;; also a must-have, super-simple building-block from the holster
> ;; but can't find it either
> (message-position-on-field hdr)
> (message-beginning-of-line)
> (delete-region (point) (point-at-eol))
> (insert val) )
> ;; test:
> ;; (message-set-header "Subject" "Lara loves YOU")
> (defun message-transpose-headers (hdr1 hdr2)
> (interactive "sheader 1: \nsheader 2: ")
> (let ((v1 (message-field-value hdr1))
> (v2 (message-field-value hdr2)))
> (message-set-header hdr1 v2)
> (message-set-header hdr2 v1) ))
> ;; test:
> ;; (message-transpose-headers "To" "Subject")
Thanks that looks cool but as far as I can tell this is not part of
vanilla gnus (using GNU emacs master "84ec57fe06e187f41a3546131d5dae3b185c3511"
Uwe
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-20 1:10 ` Emanuel Berg
2021-02-20 10:16 ` Uwe Brauer
@ 2021-02-20 10:21 ` Uwe Brauer
2021-02-20 19:02 ` Emanuel Berg
1 sibling, 1 reply; 29+ messages in thread
From: Uwe Brauer @ 2021-02-20 10:21 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 1929 bytes --]
>>> "EB" == Emanuel Berg <moasenwood@zoho.eu> writes:
> Uwe Brauer wrote:
>> For example I expanded a mail alias that contains a lot of
>> addresses but I did this in the TO field not in the CC
>> field. Would be nifty if I could change it on the fly
> ;; is there really no function like this already?
> (defun message-set-header (hdr val)
> (interactive "sheader: \nsvalue: ")
> ;; check here if there _is_ such a header - how?
> ;; also a must-have, super-simple building-block from the holster
> ;; but can't find it either
> (message-position-on-field hdr)
> (message-beginning-of-line)
> (delete-region (point) (point-at-eol))
> (insert val) )
> ;; test:
> ;; (message-set-header "Subject" "Lara loves YOU")
> (defun message-transpose-headers (hdr1 hdr2)
> (interactive "sheader 1: \nsheader 2: ")
> (let ((v1 (message-field-value hdr1))
> (v2 (message-field-value hdr2)))
> (message-set-header hdr1 v2)
> (message-set-header hdr2 v1) ))
> ;; test:
> ;; (message-transpose-headers "To" "Subject")
I cried victory to early (without testing)
When I try
(message-transpose-headers "Cc" "To")
I obtain
Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
insert(nil)
message-set-header("To" nil)
(let ((v1 (message-field-value hdr1)) (v2 (message-field-value hdr2))) (message-set-header hdr1 v2) (message-set-header hdr2 v1))
message-transpose-headers("To" "Cc")
funcall-interactively(message-transpose-headers "To" "Cc")
call-interactively(message-transpose-headers record nil)
command-execute(message-transpose-headers record)
execute-extended-command(nil "message-transpose-headers" "message-tr")
funcall-interactively(execute-extended-command nil "message-transpose-headers" "message-tr")
call-interactively(execute-extended-command nil nil)
command-execute(execute-extended-command)
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-20 10:21 ` Uwe Brauer
@ 2021-02-20 19:02 ` Emanuel Berg
2021-02-20 22:26 ` Uwe Brauer
0 siblings, 1 reply; 29+ messages in thread
From: Emanuel Berg @ 2021-02-20 19:02 UTC (permalink / raw)
To: ding
Uwe Brauer wrote:
> I cried victory to early (without testing)
>
> When I try
>
> (message-transpose-headers "Cc" "To")
>
> I obtain [...]
You are right, I only tested for headers with a value, but now
it works:
(defun message-set-header (hdr val)
(interactive "sheader: \nsvalue: ")
(message-position-on-field hdr)
(message-beginning-of-header nil)
(delete-region (point) (point-at-eol))
(insert val) )
;; test:
;; (message-set-header "Subject" "Lara loves YOU")
(defun message-transpose-headers (hdr1 hdr2)
(interactive "sheader 1: \nsheader 2: ")
(save-excursion
(let ((v1 (or (message-field-value hdr1) ""))
(v2 (or (message-field-value hdr2) "")) )
(message-set-header hdr1 v2)
(message-set-header hdr2 v1) )))
;; test:
;; (message-transpose-headers "To" "Subject")
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-20 10:16 ` Uwe Brauer
@ 2021-02-20 19:03 ` Emanuel Berg
2021-02-20 22:27 ` Uwe Brauer
0 siblings, 1 reply; 29+ messages in thread
From: Emanuel Berg @ 2021-02-20 19:03 UTC (permalink / raw)
To: ding
Uwe Brauer wrote:
> Thanks that looks cool but as far as I can tell this is not
> part of vanilla gnus (using GNU emacs master
> "84ec57fe06e187f41a3546131d5dae3b185c3511"
What do you mean?
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-20 19:02 ` Emanuel Berg
@ 2021-02-20 22:26 ` Uwe Brauer
2021-02-20 22:31 ` Uwe Brauer
2021-02-20 23:10 ` dick.r.chiang
0 siblings, 2 replies; 29+ messages in thread
From: Uwe Brauer @ 2021-02-20 22:26 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]
> Uwe Brauer wrote:
> You are right, I only tested for headers with a value, but now
> it works:
> (defun message-set-header (hdr val)
> (interactive "sheader: \nsvalue: ")
> (message-position-on-field hdr)
> (message-beginning-of-header nil)
> (delete-region (point) (point-at-eol))
> (insert val) )
> ;; test:
> ;; (message-set-header "Subject" "Lara loves YOU")
> (defun message-transpose-headers (hdr1 hdr2)
> (interactive "sheader 1: \nsheader 2: ")
> (save-excursion
> (let ((v1 (or (message-field-value hdr1) ""))
> (v2 (or (message-field-value hdr2) "")) )
> (message-set-header hdr1 v2)
> (message-set-header hdr2 v1) )))
> ;; test:
> ;; (message-transpose-headers "To" "Subject")
For single lines addresses yes,
To: user1@gmail.com
Cc: user2@gmail.com
Changes to
To: user2@gmail.com
Cc: user1@gmail.com
But if you have multi line addresses, which can happen if you use bbdb
then
To: user1@gmail.com, user3@gmail.com,
user4@gmail.com
Cc: user2@gmail.com
gives
To: user1@gmail.com, user3@gmail.com,
user2@gmail.com
Cc: user1@gmail.com, user3@gmail.com, user4@gmail.com
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-20 19:03 ` Emanuel Berg
@ 2021-02-20 22:27 ` Uwe Brauer
2021-02-20 22:39 ` Emanuel Berg
0 siblings, 1 reply; 29+ messages in thread
From: Uwe Brauer @ 2021-02-20 22:27 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 390 bytes --]
>>> "EB" == Emanuel Berg <moasenwood@zoho.eu> writes:
> Uwe Brauer wrote:
>> Thanks that looks cool but as far as I can tell this is not
>> part of vanilla gnus (using GNU emacs master
>> "84ec57fe06e187f41a3546131d5dae3b185c3511"
> What do you mean?
You wrote, shouldn't that be part of gnus and I only wanted to point
out that even my relative modern emacs/gnus it is not
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-20 22:26 ` Uwe Brauer
@ 2021-02-20 22:31 ` Uwe Brauer
2021-02-20 23:10 ` dick.r.chiang
1 sibling, 0 replies; 29+ messages in thread
From: Uwe Brauer @ 2021-02-20 22:31 UTC (permalink / raw)
To: ding
> For single lines addresses yes,
> To: user1@gmail.com
> Cc: user2@gmail.com
> Changes to
> To: user2@gmail.com
> Cc: user1@gmail.com
> But if you have multi line addresses, which can happen if you use bbdb
> then
> To: user1@gmail.com, user3@gmail.com,
> user4@gmail.com
> Cc: user2@gmail.com
> gives
> To: user1@gmail.com, user3@gmail.com,
> user2@gmail.com
> Cc: user1@gmail.com, user3@gmail.com, user4@gmail.com
The problem of multilines in addresses when expanding is caused my
auto-fill-mode. I don't know how to turn auto-fill-mode on only in the
text body
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-20 22:27 ` Uwe Brauer
@ 2021-02-20 22:39 ` Emanuel Berg
0 siblings, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2021-02-20 22:39 UTC (permalink / raw)
To: ding
Uwe Brauer wrote:
>>> Thanks that looks cool but as far as I can tell this is
>>> not part of vanilla gnus (using GNU emacs master
>>> "84ec57fe06e187f41a3546131d5dae3b185c3511"
>>
>> What do you mean?
>
> shouldn't that be part of gnus
Well, now that you say it, by all means :)
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-20 22:26 ` Uwe Brauer
2021-02-20 22:31 ` Uwe Brauer
@ 2021-02-20 23:10 ` dick.r.chiang
2021-02-21 0:24 ` Emanuel Berg
1 sibling, 1 reply; 29+ messages in thread
From: dick.r.chiang @ 2021-02-20 23:10 UTC (permalink / raw)
To: ding
I feel sufficient succor has been provided that you can take it the rest of
the way. If that is not the case:
(defun my/message-swap-to-cc ()
(interactive)
(when-let ((to (message-field-value "To"))
(cc (message-field-value "Cc")))
(message-replace-header "To" cc "From")
(message-replace-header "Cc" to "To")))
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-20 23:10 ` dick.r.chiang
@ 2021-02-21 0:24 ` Emanuel Berg
2021-02-21 0:36 ` Emanuel Berg
2021-02-21 2:55 ` dick.r.chiang
0 siblings, 2 replies; 29+ messages in thread
From: Emanuel Berg @ 2021-02-21 0:24 UTC (permalink / raw)
To: ding
dick.r.chiang wrote:
> (defun my/message-swap-to-cc ()
> (interactive)
> (when-let ((to (message-field-value "To"))
> (cc (message-field-value "Cc")))
> (message-replace-header "To" cc "From")
> (message-replace-header "Cc" to "To")))
(defun my/message-swap-to-cc ()
(interactive)
(when-let ((to (or (message-field-value "To") ""))
(cc (or (message-field-value "Cc") "")) )
(message-replace-header "To" cc "From")
(message-replace-header "Cc" to "To")))
W/o the `or' it will fail on an empty header.
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 0:24 ` Emanuel Berg
@ 2021-02-21 0:36 ` Emanuel Berg
2021-02-21 3:03 ` dick.r.chiang
2021-02-21 2:55 ` dick.r.chiang
1 sibling, 1 reply; 29+ messages in thread
From: Emanuel Berg @ 2021-02-21 0:36 UTC (permalink / raw)
To: ding
> (defun my/message-swap-to-cc ()
> (interactive)
> (when-let ((to (or (message-field-value "To") ""))
> (cc (or (message-field-value "Cc") "")) )
> (message-replace-header "To" cc "From")
> (message-replace-header "Cc" to "To")))
This also cannot do multiliners and the reason is
`message-field-value' which I also used. One could consider
that a bug in Emacs. Maybe not the BIGGEST bug.
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 0:24 ` Emanuel Berg
2021-02-21 0:36 ` Emanuel Berg
@ 2021-02-21 2:55 ` dick.r.chiang
2021-02-21 3:24 ` Emanuel Berg
1 sibling, 1 reply; 29+ messages in thread
From: dick.r.chiang @ 2021-02-21 2:55 UTC (permalink / raw)
To: ding
Your or'ing with "" would defeat the purpose of `when-let`.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 0:36 ` Emanuel Berg
@ 2021-02-21 3:03 ` dick.r.chiang
2021-02-21 3:18 ` Emanuel Berg
0 siblings, 1 reply; 29+ messages in thread
From: dick.r.chiang @ 2021-02-21 3:03 UTC (permalink / raw)
To: ding
EB> This also cannot do multiliners
I only tested under emacs-27. YMMV.
(defun my/message-swap-to-cc ()
(interactive)
(when-let ((to (message-field-value "To"))
(cc (message-field-value "Cc")))
(message-replace-header "To" cc "From")
(message-replace-header "Cc" to "To")))
(with-temp-buffer
(insert "From: ding@gnus.org
To: user1,
user2.
user3
Cc: user4,
user5,
user6,
--text follows this line--
Hello.
")
(cl-assert (and (cl-search "user1" (message-field-value "To"))
(cl-search "user5" (message-field-value "Cc"))))
(my/message-swap-to-cc)
(cl-assert (and (cl-search "user5" (message-field-value "To"))
(cl-search "user1" (message-field-value "Cc")))))
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 3:03 ` dick.r.chiang
@ 2021-02-21 3:18 ` Emanuel Berg
2021-02-21 4:13 ` dick.r.chiang
0 siblings, 1 reply; 29+ messages in thread
From: Emanuel Berg @ 2021-02-21 3:18 UTC (permalink / raw)
To: ding
dick.r.chiang wrote:
>> This also cannot do multiliners
>
> I only tested under emacs-27. YMMV.
Ah, no, it isn't that, it is the initial whitespace on
subsequent lines! Then it works, and so should mine, yes.
No bug in Emacs or Gnus, good.
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 2:55 ` dick.r.chiang
@ 2021-02-21 3:24 ` Emanuel Berg
2021-02-21 4:09 ` dick.r.chiang
0 siblings, 1 reply; 29+ messages in thread
From: Emanuel Berg @ 2021-02-21 3:24 UTC (permalink / raw)
To: ding
dick.r.chiang wrote:
> Your or'ing with "" would defeat the purpose of `when-let`.
Also, it doesn't help :)
But your function still doesn't work on an empty To or Cc what
I can see.
This works, I tried it on the same data. Maybe there is
something built-in that one can replace `message-set-header'
with tho...
(defun message-set-header (hdr val)
(interactive "sheader: \nsvalue: ")
(message-position-on-field hdr)
(message-beginning-of-header nil)
(delete-region (point) (point-at-eol))
(insert val) )
;; test:
;; (message-set-header "Subject" "Lara loves YOU")
(defun message-transpose-headers (hdr1 hdr2)
(interactive "sheader 1: \nsheader 2: ")
(save-excursion
(let ((v1 (or (message-field-value hdr1) ""))
(v2 (or (message-field-value hdr2) "")) )
(message-set-header hdr1 v2)
(message-set-header hdr2 v1) )))
;; test:
;; (message-transpose-headers "To" "Subject")
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 3:24 ` Emanuel Berg
@ 2021-02-21 4:09 ` dick.r.chiang
2021-02-21 4:47 ` Emanuel Berg
0 siblings, 1 reply; 29+ messages in thread
From: dick.r.chiang @ 2021-02-21 4:09 UTC (permalink / raw)
To: ding
Oh boy, I guess we have to "go there" although I didn't think Herr Brauer's
original itch needed to scratch an empty To or Cc.
(defun my/message-swap-to-cc ()
(interactive)
(message-goto-to)
(message-goto-cc)
(let ((to (or (message-field-value "To") "")))
(message-replace-header "To" (or (message-field-value "Cc") "") "From" t)
(message-replace-header "Cc" to "To" t)))
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 3:18 ` Emanuel Berg
@ 2021-02-21 4:13 ` dick.r.chiang
0 siblings, 0 replies; 29+ messages in thread
From: dick.r.chiang @ 2021-02-21 4:13 UTC (permalink / raw)
To: ding
Yes, an additional user need to be indented else `message.el` can't
distinguish it from another header.
The original solution only deletes to (point-at-eol), so no, Herr Brauer's
objections were valid.
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 4:09 ` dick.r.chiang
@ 2021-02-21 4:47 ` Emanuel Berg
2021-02-21 9:18 ` Uwe Brauer
2021-05-09 4:45 ` Emanuel Berg
0 siblings, 2 replies; 29+ messages in thread
From: Emanuel Berg @ 2021-02-21 4:47 UTC (permalink / raw)
To: ding
dick.r.chiang wrote:
> Oh boy, I guess we have to "go there" although I didn't think Herr Brauer's
> original itch needed to scratch an empty To or Cc.
>
> (defun my/message-swap-to-cc ()
> (interactive)
> (message-goto-to)
> (message-goto-cc)
> (let ((to (or (message-field-value "To") "")))
> (message-replace-header "To" (or (message-field-value "Cc") "") "From" t)
> (message-replace-header "Cc" to "To" t)))
Great! I rewrote it a bit to do make it generic.
Works for all edgy cases so far, that is missing header, empty
header and multiline value.
(require 'message)
(defun message-transpose-headers (hdr1 hdr2)
(interactive "sheader 1: \nsheader 2: ")
(save-excursion
(message-position-on-field hdr1)
(message-position-on-field hdr2)
(let ((v1 (or (message-field-value hdr1) ""))
(v2 (or (message-field-value hdr2) "")) )
(message-replace-header hdr1 v2 "From" t)
(message-replace-header hdr2 v1 "To" t)) ))
;; test:
;; (message-transpose-headers "To" "Subject")
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 4:47 ` Emanuel Berg
@ 2021-02-21 9:18 ` Uwe Brauer
2021-02-21 9:36 ` Emanuel Berg
2021-05-09 4:45 ` Emanuel Berg
1 sibling, 1 reply; 29+ messages in thread
From: Uwe Brauer @ 2021-02-21 9:18 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 806 bytes --]
> dick.r.chiang wrote:
> Great! I rewrote it a bit to do make it generic.
> Works for all edgy cases so far, that is missing header, empty
> header and multiline value.
> (require 'message)
> (defun message-transpose-headers (hdr1 hdr2)
> (interactive "sheader 1: \nsheader 2: ")
> (save-excursion
> (message-position-on-field hdr1)
> (message-position-on-field hdr2)
> (let ((v1 (or (message-field-value hdr1) ""))
> (v2 (or (message-field-value hdr2) "")) )
> (message-replace-header hdr1 v2 "From" t)
> (message-replace-header hdr2 v1 "To" t)) ))
> ;; test:
> ;; (message-transpose-headers "To" "Subject")
well that was a bit of discussion I missed.
But thanks
That works nice for my use case "To" to "Cc"
Don't you want to send a patch to the dev list?
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 9:18 ` Uwe Brauer
@ 2021-02-21 9:36 ` Emanuel Berg
2021-03-01 7:40 ` Uwe Brauer
2021-03-01 7:44 ` Uwe Brauer
0 siblings, 2 replies; 29+ messages in thread
From: Emanuel Berg @ 2021-02-21 9:36 UTC (permalink / raw)
To: ding
Uwe Brauer wrote:
> But thanks
np :) for my part
> That works nice for my use case "To" to "Cc"
It should also work for the general case, God willing.
> Don't you want to send a patch to the dev list?
Well, I have by now written 117 Elisp files [1] including
13 Gnus files [2] and they can have anything and everything,
I'd be delighted. Take it :)
[1] https://dataswamp.org/~incal/emacs-init/
[2] https://dataswamp.org/~incal/emacs-init/gnus/
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 9:36 ` Emanuel Berg
@ 2021-03-01 7:40 ` Uwe Brauer
2021-03-02 2:57 ` Emanuel Berg
2021-03-02 3:38 ` Emanuel Berg
2021-03-01 7:44 ` Uwe Brauer
1 sibling, 2 replies; 29+ messages in thread
From: Uwe Brauer @ 2021-03-01 7:40 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 633 bytes --]
>>> "EB" == Emanuel Berg <moasenwood@zoho.eu> writes:
> Uwe Brauer wrote:
>> But thanks
> np :) for my part
>> That works nice for my use case "To" to "Cc"
> It should also work for the general case, God willing.
>> Don't you want to send a patch to the dev list?
> Well, I have by now written 117 Elisp files [1] including
> 13 Gnus files [2] and they can have anything and everything,
> I'd be delighted. Take it :)
> [1] https://dataswamp.org/~incal/emacs-init/
> [2] https://dataswamp.org/~incal/emacs-init/gnus/
I tried
wget -r https://dataswamp.org/~incal/emacs-init/
But it got refused.
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 9:36 ` Emanuel Berg
2021-03-01 7:40 ` Uwe Brauer
@ 2021-03-01 7:44 ` Uwe Brauer
2021-03-02 2:55 ` Emanuel Berg
1 sibling, 1 reply; 29+ messages in thread
From: Uwe Brauer @ 2021-03-01 7:44 UTC (permalink / raw)
To: ding
[-- Attachment #1: Type: text/plain, Size: 641 bytes --]
>>> "EB" == Emanuel Berg <moasenwood@zoho.eu> writes:
> Uwe Brauer wrote:
>> But thanks
> np :) for my part
>> That works nice for my use case "To" to "Cc"
> It should also work for the general case, God willing.
>> Don't you want to send a patch to the dev list?
> Well, I have by now written 117 Elisp files [1] including
> 13 Gnus files [2] and they can have anything and everything,
> I'd be delighted. Take it :)
> [1] https://dataswamp.org/~incal/emacs-init/
> [2] https://dataswamp.org/~incal/emacs-init/gnus/
I downloaded manually mail-to-many
But the functions are not interactive, so it is not clear to me how to
use it.
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5673 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-03-01 7:44 ` Uwe Brauer
@ 2021-03-02 2:55 ` Emanuel Berg
0 siblings, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2021-03-02 2:55 UTC (permalink / raw)
To: ding
Uwe Brauer wrote:
>> [1] https://dataswamp.org/~incal/emacs-init/
>
>> [2] https://dataswamp.org/~incal/emacs-init/gnus/
>
> I downloaded manually mail-to-many
>
> But the functions are not interactive, so it is not clear to
> me how to use it.
OT (well, 50/50)
I wrote a small, but very ambitious book a couple of years
back [1] - lots'a Norwegian people in that book BTW, maybe you
guys can get it published there? I know how patriotic you
are :) and you should be with that record, I guess. well, if
you do, you get the literary agent's 15% for sure - anyway
I got a list of like 70 or so publishers in Sweden, so
I wanted to mail a letter and the book to everyone but it
couldn't look like spam, that's why I wrote it. One publishers
said, ~"what I great book! but no", the others said nothing or
"no".
Just a couple of years ago I started translating it into EPUB
but that just felt bizarre, I started to hate myself almost,
reading my self-assured blah blah, so I didn't get far.
Also, the lovely LaTeX IMO (looks like a magazine article from
the 70s) would be lost. (But my impression was irrational.
It _is_ a good book, it just felt so strange doing!)
So the project itself is what it is right now - gone, but
not forgotten! (= Borta men inte glömd)
New adventure project:
https://dataswamp.org/~incal/blog/index.html
Can I interest you in a future tree house book?
After that, maybe pick up that old book again. Or what do the
successful people say - never look back? Right, I'm not
successful :)
[1] https://dataswamp.org/~incal/borta/borta.pdf
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-03-01 7:40 ` Uwe Brauer
@ 2021-03-02 2:57 ` Emanuel Berg
2021-03-02 3:38 ` Emanuel Berg
1 sibling, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2021-03-02 2:57 UTC (permalink / raw)
To: ding
Uwe Brauer wrote:
> I tried
>
> wget -r https://dataswamp.org/~incal/emacs-init/
>
> But it got refused.
Right... should fix that, thank you.
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-03-01 7:40 ` Uwe Brauer
2021-03-02 2:57 ` Emanuel Berg
@ 2021-03-02 3:38 ` Emanuel Berg
1 sibling, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2021-03-02 3:38 UTC (permalink / raw)
To: ding
Uwe Brauer wrote:
> wget -r https://dataswamp.org/~incal/emacs-init/
Down, try
https://user.it.uu.se/~embe8573/emacs.html
and
https://user.it.uu.se/~embe8573/emacs-init
All that, except for the source, hasn't been updated in ages.
Well, better that than the other way around!
Just add it all to vanilla Emacs and Gnus and be done with
it, right?
--
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
* Re: how can I convert the To field to CC
2021-02-21 4:47 ` Emanuel Berg
2021-02-21 9:18 ` Uwe Brauer
@ 2021-05-09 4:45 ` Emanuel Berg
1 sibling, 0 replies; 29+ messages in thread
From: Emanuel Berg @ 2021-05-09 4:45 UTC (permalink / raw)
To: ding
> (require 'message)
>
> (defun message-transpose-headers (hdr1 hdr2)
> (interactive "sheader 1: \nsheader 2: ")
> (save-excursion
> (message-position-on-field hdr1)
> (message-position-on-field hdr2)
> (let ((v1 (or (message-field-value hdr1) ""))
> (v2 (or (message-field-value hdr2) "")) )
> (message-replace-header hdr1 v2 "From" t)
> (message-replace-header hdr2 v1 "To" t)) ))
I must have been completely wasted when I wrote that, well,
that happens, here, I think, is what it is meant to look like:
(require 'message)
(defun message-transpose-headers (hdr1 hdr2)
(interactive "sheader 1: \nsheader 2: ")
(save-excursion
(let ((v1 (or (message-fetch-field hdr1) ""))
(v2 (or (message-fetch-field hdr2) "")) )
(message-replace-header hdr1 v2 hdr1 t)
(message-replace-header hdr2 v1 hdr2 t)) ))
;; test:
;; (message-transpose-headers "To" "Subject")
https://dataswamp.org/~incal/emacs-init/gnus/message-incal.el
--
underground experts united
https://dataswamp.org/~incal
^ permalink raw reply [flat|nested] 29+ messages in thread
end of thread, other threads:[~2021-05-09 4:46 UTC | newest]
Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-19 20:57 how can I convert the To field to CC Uwe Brauer
2021-02-19 21:09 ` Emanuel Berg
2021-02-20 1:10 ` Emanuel Berg
2021-02-20 10:16 ` Uwe Brauer
2021-02-20 19:03 ` Emanuel Berg
2021-02-20 22:27 ` Uwe Brauer
2021-02-20 22:39 ` Emanuel Berg
2021-02-20 10:21 ` Uwe Brauer
2021-02-20 19:02 ` Emanuel Berg
2021-02-20 22:26 ` Uwe Brauer
2021-02-20 22:31 ` Uwe Brauer
2021-02-20 23:10 ` dick.r.chiang
2021-02-21 0:24 ` Emanuel Berg
2021-02-21 0:36 ` Emanuel Berg
2021-02-21 3:03 ` dick.r.chiang
2021-02-21 3:18 ` Emanuel Berg
2021-02-21 4:13 ` dick.r.chiang
2021-02-21 2:55 ` dick.r.chiang
2021-02-21 3:24 ` Emanuel Berg
2021-02-21 4:09 ` dick.r.chiang
2021-02-21 4:47 ` Emanuel Berg
2021-02-21 9:18 ` Uwe Brauer
2021-02-21 9:36 ` Emanuel Berg
2021-03-01 7:40 ` Uwe Brauer
2021-03-02 2:57 ` Emanuel Berg
2021-03-02 3:38 ` Emanuel Berg
2021-03-01 7:44 ` Uwe Brauer
2021-03-02 2:55 ` Emanuel Berg
2021-05-09 4:45 ` Emanuel Berg
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).