Re: Threading of forwarded messages

2019-09-03 Thread David Bremner
Örjan Ekeberg  writes:

> Hi,
>
> Let me first say that I am a very happy user of notmuch+emacs.  Once the
> initial setup and configuration was done, usage has been a very pleasant
> experience.  It daily saves me from getting lost in the constant torrent
> of incoming e-mail, where most need replies or to be forwarded to others
> to deal with.
>
> One thing that I have not been able to configure is the handling of
> forwarded messages.  Forwarded messages are archived as new messages,
> not linked to the messages being forwarded.  This makes it hard to keep
> track of which messages I have forwarded (and therefore is in the hands
> of someone else).  I would like the messages to be linked into the same
> thread.

This feature should be available in notmuch 0.29.

d
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Threading of forwarded messages

2019-01-24 Thread David Edmondson
On Wednesday, 2019-01-23 at 23:46:24 +02, Tomi Ollila wrote:

> On Tue, Jan 22 2019, Örjan Ekeberg wrote:
>> Adding to the wishlist; it would be nice if forwarded messages could
>> also be tagged as "forwarded", much like how replied messages are tagged
>> "replied".  I guess this could be done via some sort of forward-hook,
>> but I can not find anything like this.
>
> replied is added in notmuch-message-mark-replied called via 
> message-send-hook -- and notmuch-message-mark-replied looks for In-Reply-To
> header and some other stuff (did not look deeply enough) to determine
> whether to add notmuch-message-replied-tags... and it looks this hook
> is run to all messages to be send...
>
> ...cannot say directly whether some other message processing could be used
> to do to add "forwarded-tags" -- or alternatively making notmuch-send-hook
> buffer-local to the message buffer created by
> notmuch-mua-new-forward-messages and then just add-hook'ing code to 
> do the tagging operation at send time.
>
> Marked the replied message with notmuch::wishlist in 
> https://nmbug.notmuchmail.org/status/

Having a standard hook that adds tags when the message is sent based on
a (typically buffer local) variable would be a convenient and generally
useful approach.

dme.
-- 
Ah, oh your hair is beautiful.
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: Threading of forwarded messages

2019-01-23 Thread Örjan Ekeberg
Tomi Ollila  writes:
> notmuch-mua-new-forward-messages would be the place adding message-id's
> to the references header (perhaps where 'appropriate subject' is added)
> probably not much work but SMOP anyway ;/

Indeed.  Here is an attempt that seems to do the trick.
This is a modified version of notmuch-mua-new-forward-messages
(extracted from notmuch-mua-el).  Sorry for not posting it as a patch.
Changes are the lines involving the variable forward-references.
Please check if this is the right approach.


(defun notmuch-mua-new-forward-messages (messages  prompt-for-sender)
  "Compose a new message forwarding MESSAGES.

If PROMPT-FOR-SENDER is non-nil, the user will be prompteed for
the From: address."
  (let* ((other-headers
  (when (or prompt-for-sender notmuch-always-prompt-for-sender)
(list (cons 'From (notmuch-mua-prompt-for-sender)
 forward-subject  ;; Comes from the first message and is
  ;; applied later.
 forward-references) ;; Accumulated message-ids of forwarded messages

;; Generate the template for the outgoing message.
(notmuch-mua-mail nil "" other-headers nil 
(notmuch-mua-get-switch-function))

(save-excursion
  ;; Insert all of the forwarded messages.
  (mapc (lambda (id)
  (let ((temp-buffer (get-buffer-create
  (concat "*notmuch-fwd-raw-" id "*"
;; Get the raw version of this message in the buffer.
(with-current-buffer temp-buffer
  (erase-buffer)
  (let ((coding-system-for-read 'no-conversion))
(call-process notmuch-command nil t nil "show" 
"--format=raw" id))
  ;; Because we process the messages in reverse order,
  ;; always generate a forwarded subject, then use the
  ;; last (i.e. first) one.
  (setq forward-subject (message-make-forward-subject))
  (if forward-references
  (setq forward-references
(concat forward-references ", "
(message-fetch-field "Message-ID")))
(setq forward-references (message-fetch-field 
"Message-ID"
;; Make a copy ready to be forwarded in the
;; composition buffer.
(message-forward-make-body temp-buffer)
;; Kill the temporary buffer.
(kill-buffer temp-buffer)))
;; `message-forward-make-body' always puts the message at
;; the top, so do them in reverse order.
(reverse messages))

  ;; Add in the appropriate subject.
  (save-restriction
(message-narrow-to-headers)
(message-remove-header "Subject")
(message-add-header (concat "Subject: " forward-subject))
(message-remove-header "References")
(message-add-header (concat "References: " forward-references)))

  ;; `message-forward-make-body' shows the User-agent header.  Hide
  ;; it again.
  (message-hide-headers)
  (set-buffer-modified-p nil
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Threading of forwarded messages

2019-01-22 Thread Örjan Ekeberg
Hi,

Let me first say that I am a very happy user of notmuch+emacs.  Once the
initial setup and configuration was done, usage has been a very pleasant
experience.  It daily saves me from getting lost in the constant torrent
of incoming e-mail, where most need replies or to be forwarded to others
to deal with.

One thing that I have not been able to configure is the handling of
forwarded messages.  Forwarded messages are archived as new messages,
not linked to the messages being forwarded.  This makes it hard to keep
track of which messages I have forwarded (and therefore is in the hands
of someone else).  I would like the messages to be linked into the same
thread.

From what I understand, it would be sufficient if
notmuch-mua-new-forward-messages (or something further down the call
chain) would add the Message-Id of the forwarded message to the
References header line of the new message.  This is what happens when
using reply instead of forward.

Manually adding such a references-head before sending seems to have
the desired effect of linking them into the same thread.  Also, from
what I can see, gmail does indeed include such a Refrerences-head when
doing forward.

Adding to the wishlist; it would be nice if forwarded messages could
also be tagged as "forwarded", much like how replied messages are tagged
"replied".  I guess this could be done via some sort of forward-hook,
but I can not find anything like this.

/Örjan
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch