-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
everything below --citation follows this line (read-only)-- erased #73
Comments
I believe this is the intended behaviour. If you want to quote something in your reply you should specifically include it above the |
So, it’s cited below the original email in order to allow the user to copy the text into the right block ? That makes sense. Is there an example configuration that uses org-msg only for composition, not for replies, |
Could you be more specific ? I am having a hard understanding your request |
@jeremy-compostella Sorry to intrude. But I was wondering the exact same question when trying to use org-msg with notmuch. With mu4e, when replying to an email, the original email appears below my reply(below a grey horizontal line), making my reply totally Outlook style. But with notmuch, my reply would only contain my reply, without the original email below it. (Hence as this issue said, things below --citation follows...--- are erased). I could not figure out why there is such difference. Would you mind sharing your thoughts? Please let me know in case my description above isn't clear. |
I have realized that the problem is the notmuch implementation did not privode a |
@whudwl - thank you for intruding! That's precisely the issue. I really appreciate your help documenting what happens and why ! |
@whudwl and @jonathanwilner, feel to volunteer and write this function. I do not use notmuch and I cannot write it. |
just quickly whipped up this piece which seems to work for me. I'm no expert on lisp so this could be totally far from an optimal solution. (defvar org-msg-notmuch-saved-article-path "")
(defun org-msg-notmuch-save-article (handle)
"recursively search through the result of (mm-dissect-buffer) and save the text/html part.
path of the saved file is saved in valiable org-msg-notmuch-saved-article-path
"
(cond
((stringp (car handle)) (mapcar #'org-msg-notmuch-save-article (cdr handle)))
((bufferp (car handle))
(if (string= (car (car (cdr handle))) "text/html")
(progn
(let ((file (make-temp-file "org-msg" nil ".html")))
(mm-save-part-to-file handle file)
(setq org-msg-notmuch-saved-article-path file)))))
(t
(mapcar #'org-msg-notmuch-save-article handle))))
(defun org-msg-save-article-for-reply-notmuch ()
(let ((message-id (save-excursion
(goto-char (point-min))
(re-search-forward "In-Reply-To: <\\(.*\\)>")
(match-string-no-properties 1))))
(save-window-excursion
(let ((notmuch-show-only-matching-messages t))
(notmuch-show (format "id:%s" message-id)))
(with-current-notmuch-show-message
(org-msg-notmuch-save-article (mm-dissect-buffer)))
(list org-msg-notmuch-saved-article-path)))) |
This is interesting. While I was re-working you code I realized a few things:
Then I figured we could re-use the Does the following work for you ? Note that I reworked some stuff too, so you may have to debug it a little bit.
It creates a code duplication in OrgMsg that if it that code work will have to be taken care of. |
where does the (trim ...) function come from? My emacs couldn't find it. |
I don't know. I added it for safety but you can probably remove the call to
this function.
…On Wed, May 5, 2021, 5:57 PM David ***@***.***> wrote:
This is interesting. While I was re-working you code I realized a few
things:
1. it does not save the images or re-bind them in the <img> tags
2. it does create the header
Then I figured we could re-use the gnus engine.
Does the following work for you ? Note that I reworked some stuff too, so
you may have to debug it a little bit.
(defun org-msg-save-article-for-reply-notmuch ()
(let ((id (trim (org-msg-message-fetch-field "in-reply-to")))
header parts)
(cl-flet ((get-field (field)
(when-let ((value (org-msg-message-fetch-field field)))
(concat (capitalize field) ": " value))))
(save-window-excursion
(let ((notmuch-show-only-matching-messages t))
(notmuch-show (format "id:%s" (substring id 1 -1))))
(with-current-notmuch-show-message
(let ((fields (mapcar #'get-field
'("from" "subject" "to" "cc" "date"))))
(setf header (mapconcat 'identity (delq nil fields) "\n")))
(setf parts (mm-dissect-buffer)))
(let* ((browse-url-browser-function #'ignore)
(save (cl-copy-list gnus-article-browse-html-temp-list)))
(cl-letf (((symbol-function 'gnus-summary-show-article) #'ignore))
(save-window-excursion
(gnus-article-browse-html-parts parts header)))
(let ((temp-files (cl-set-difference gnus-article-browse-html-temp-list save
:test 'string=)))
(setq gnus-article-browse-html-temp-list save)
temp-files))))))
It creates a code duplication in OrgMsg that if it that code work will
have to be taken care of.
where does the (trim ...) function come from? My emacs couldn't find it.
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#73 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMACBHUAJRAFIR5F3AO7XTTMHSP7ANCNFSM4R7WSCZA>
.
|
I'm getting |
What do you mean by most emails? Does it work with some email? What is
different in this emails?
|
Did a bit of more testing. Seems the error happens when there are inline images.
|
seems the error is emitted from line 2845 of gnus-art.el. (with-current-buffer gnus-article-buffer
gnus-article-mime-handles) the value of the |
It seems gnus relies on the local variable (defun org-msg-save-article-for-reply-notmuch ()
(let ((id (string-trim (org-msg-message-fetch-field "in-reply-to")))
header parts)
(cl-flet ((get-field (field)
(when-let ((value (org-msg-message-fetch-field field)))
(concat (capitalize field) ": " value))))
(save-window-excursion
(let ((notmuch-show-only-matching-messages t))
(notmuch-show (format "id:%s" (substring id 1 -1))))
(with-current-notmuch-show-message
(let ((fields (mapcar #'get-field
'("from" "subject" "to" "cc" "date"))))
(setf header (mapconcat 'identity (delq nil fields) "\n")))
(setf parts (mm-dissect-buffer)))
(let* ((browse-url-browser-function #'ignore)
(save (cl-copy-list gnus-article-browse-html-temp-list)))
(cl-letf (((symbol-function 'gnus-summary-show-article) #'ignore))
(save-window-excursion
(setq-local gnus-article-mime-handles parts)
(let ((gnus-article-buffer (current-buffer)))
(gnus-article-browse-html-parts parts header))))
(let ((temp-files (cl-set-difference gnus-article-browse-html-temp-list save
:test 'string=)))
(setq gnus-article-browse-html-temp-list save)
temp-files)))))) |
Even simpler:
|
This patch addresses #73. Signed-off-by: Jeremy Compostella <jeremy.compostella@gmail.com>
This patch addresses #73. Signed-off-by: Jeremy Compostella <jeremy.compostella@gmail.com>
I pushed the improved changes to the |
@jeremy-compostella Thank you so much for that. I did a bit of testing of the experimental branch, made some minor fixes. Now it pretty much works perfectly for me. Have created pull request. |
I've also tested the experimental branch and it's working for me as well using notmuch! Thanks @whudwl + @jeremy-compostella ! |
Emm. Strange. It worked for you as it is? I had to modify it a bit for it to work. |
Yes - each one of these has worked for me out of the box - except for "trim" - which I couldn't find either. The current experimental branch has a weird "select all" effect where all of the previous message is selected for yank that is going on when the reply is first composed, but it's not holding me back too much. |
I saw that “select all” effect too. I think it’s the result of an error. Lets see if it’s fixed once jemery pulls my change.
…On 7 May 2021, 8:56 AM +1000, jonathanwilner ***@***.***>, wrote:
Yes - each one of these has worked for me out of the box - except for "trim" - which I couldn't find either.
The current experimental branch has a weird "select all" effect where all of the previous message is selected for yank that is going on when the reply is first composed, but it's not holding me back too much.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
This patch addresses #73. Signed-off-by: Dave Dai <whudwl@gmail.com> Signed-off-by: Jeremy Compostella <jeremy.compostella@gmail.com>
@whudwl I integrated all your changes. Let me know if it works better. |
This patch addresses #73. Signed-off-by: Dave Dai <whudwl@gmail.com> Signed-off-by: Jeremy Compostella <jeremy.compostella@gmail.com>
@jeremy-compostella It makes sense to not activate Saying this, I think your new commit in experimental branch works seamlessly to me, also. |
org-msg is supposed to determine if it's replying to a html message or text message. So what @HyunggyuJang ponted out is probably indeed a problem. |
Now I'm getting |
Hi all, This current version in the experimental branch appears to erase the forwarded email again & leave just the HTML signature. Previous versions appeared to work beautifully to forward HTML email. This could be just me & my config. Please ignore if it's working well for @whudwl or others. Thanks! |
@HyunggyuJang, indeed if you do not have specified the list of alternative for reply to text, OrgMsg does not enable itself (as described in the documentation). Disabling itself for text message has always been the default behavior of OrgMsg since the very beginning and except for the notmuch backend which was very poorly written. Patch b26aa6c put the notmuch backend to the same level. I suggest that you define |
@jonathanwilner and @whudwl I would appreciate if a notmuch user could try to debug the experimental branch. |
@whudwl any update on your testing with regard to respond to various email type (text, html, mixed) ? |
@jeremy-compostella Seems like my configuration for Org Msg is somewhat obsolete, haven’t tracked the changes breaking backward compatibility so far. |
There should not be any backward compatibility issue except as I said with the
Does it work ? Do you still faces a crash on reply to text only emails ? |
@jeremy-compostella
Sorry for misleading. Was due to my short understanding. Seems like there’s no issue about backward compatibility. What I conceived as a discrepancy was the change made to default alternative format setting, but it appears also well maintained to support previous ones.
As I’m away from environment now, I’ll test it as soon as I get there.
Regards,
— Hyunggyu Jang
… On May 13, 2021, at 8:50 AM, Jérémy Compostella ***@***.***> wrote:
Seems like my configuration for Org Msg is somewhat obsolete, haven’t tracked the changes breaking backward compatibility so far.
There should not be any backward compatibility issue except as I said with the notmuch backend as it was poorly implemented originally.
Think setting it properly as you did in README.org would perfectly fit to my use-case.
Does it work ? Do you still faces a crash on reply to text only emails ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Can confirm now it works also for text only messages. However, the signature part comes after the text citation, is it intended? To me it betrays what the Furthermore, what I’ve delineated at this comment, was from html only message, not the text only format, still exists. I’ll send the problematic mail to your email address. Note that if Thanks for your hard work. |
Got an And for another email I replied to, the subject in the quoted section got doubled up a dozen times. For example, the subject of the mail I replied to is "urgent issue", though the subject of my reply is OK, but below my reply, in the citation section, the subject became "urgent issue urgent issue urgent issue.....". Just FYI, could be off topic. For most emails, it works pretty well though. I thought all the heavy lifting is done by gnus engine which is supposed to be mature, so a bit surprised. |
@jeremy-compostella It seems, for this super simple email I was trying to reply to, it had only 1 part (not sure this is how to describe it?). which needs to be enclosed in a list. so inside (gnus-article-browse-html-parts (list parts) header) |
@whudwl, good catch! Indeed, the I removed 7c235d5 from the experimental branch but would appreciate if someone could look into it. It would be better to get rid of the use of a macro. |
Hi @jeremy-compostella - this continues to generally work well for me, except for forwarding HTML email. I've got to turn off org-msg before a forward now, or I just get the signature, but not the forwarded message in the multi-part message. |
It does not betray anything. The posting-style only applied to HTML emails.
Or from the README.org OrgMsg composes reply to HTML emails in top-posting style. This behavior can be disabled by setting
Could you provide more details? (I feel like you are expecting to much from what OrgMsg can do). |
Since which commit does forwarding does not work for you anymore ? |
@whudwl I found a way to validate and pushed to master. I also found a bug when forwarding an html email which is not a multipart. I pushed the fix to master too. |
@HyunggyuJang I tested 0418fa1 which remove the use of `with-current-notmuch-show-message' and it works like a charm on a clean Emacs. |
Hi @jeremy-compostella - it seems (at least for me) that I'm getting the "Select All" effect again from the most recent master. Re: forwarding HTML - I can forward cleanly a message with no plaintext. If it has HTML and Plaintext, the forward now includes the From, To, Subject and Date, but then "---End of Forwarded Message---" |
@jeremy-compostella Glad to know that you found the way to test notmuch related stuff. At a glimpse, your new commits works smoothly in my setting. Thanks for your enthusiasm and endeavor! |
@HyunggyuJang, including the experimental branch ? |
@jeremy-compostella
Yeah, without experimental branch, macro related things keep buzzing.
At least to me, experimental branch is good to be merged to mainstream.
Regards,
— Hyunggyu Jang
… On May 18, 2021, at 3:02 AM, Jérémy Compostella ***@***.***> wrote:
@HyunggyuJang, including the experimental branch ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Aha, I will be the annoying person who was relying on a bug :) I use notmuch and I've only just updated and noticed that my HTML replies now include the citation. This is actually not what I want, and I preferred not including the citation in my reply. Is there any configuration to stop this? |
I believe so, have a look at the documentation (README.org). If you set |
Hi,
Thanks for that, that's /almost/ perfect, however it still does include a copy of the text (thankfully editable however) above my message.
I can just delete it each time (or define a function to do so), but before I do, is there any way around that?
Cheers!
Joshua
|
This second part of the issue has nothing to do with |
Every time I try to reply to a message using org-msg, any text that should be cited is instead removed from the message. This is true in the preview & the final results.
System is Notmuch on Emacs 27.1 or Emacs 28 on Mac OS X Catalina. I'm using Doom Emacs. I've tried the latest version from master as well as the experimental branch. Both produce the same results.
I'm running the latest notmuch from git.
Any ideas?
The text was updated successfully, but these errors were encountered: