mu icon indicating copy to clipboard operation
mu copied to clipboard

Hide "PGP Encrypted Part" blocks when using gnus

Open averter opened this issue 3 years ago • 3 comments

Expected or desired behavior

Email body without "PGP Encrypted Part" blocks. Encryption/signing info could instead be displayed as a single line in the message headers.

Actual behavior

The text body displays these extra text blocks (in bold) that I would like to get rid of/minimize.

[[PGP Encrypted Part:OK Good signature from 0X5XXBYY4 averter (my gmail key) [email protected] (trust ultimate) created at 2071-01-28T10:03:56+0000 using RSA]]

This is an encrypted message

[[End of PGP Encrypted Part]]

Steps to reproduce

Send an encrypted email to self. I believe that only gnus needs to be activated, but nonetheless encryption details of my configuration are

(require 'epg-config)                           ; for mu4e
(setq mml2015-use 'epg                          ;    "
      mm-verify-option 'always
      gnus-buttonized-mime-types '("multipart/signed")
      mml-default-sign-method 'pgp		; use pgp
      mml-secure-openpgp-encrypt-to-self  t     ;    "
      mml-secure-openpgp-sign-with-sender t     ;    "
      epg-user-id "gpg_key_id"                  ;    "
      epg-gpg-program "gpg2"                    ; program for encryption
      )
(require 'epa-file)		;; SIGNING AND ENCRYPTING
(add-hook 'mu4e-view-mode-hook
	  (epa-mail-mode))	;; SIGNING AND ENCRYPTING
(add-hook 'mu4e-compose-mode-hook
	  (epa-mail-mode))	;; SIGNING AND ENCRYPTING

(Setq mu4e-compose-crypto-reply-encrypted-policy 'sign-and-encrypt
      mu4e-alert-email-notification-types '(subjects))

Versions of mu, mu4e/emacs, operating system etc.

mu4e v1.4.13, emacs 26.3, Linux Mint 20

averter avatar Nov 28 '20 10:11 averter

I have the a similar issue. I do not mind that these blocks are displayed, when I am reading emails. (To the contrary, I am interested to know, if the signature is okay). But all my answers are containing blocks like [[S/MIME Signed Part:Good signature from certificate /CN=Full Name/OU=Insitution/O=Institution/C=DE/GN=Name/SN=Surname (trust full)]] as well.

You can reproduce this behavior by answering a signed email. (No matter if it was signed with a certificate or a private pg key) It would be really nice, if these were not included in my replies. These blocks clutter my email conversations and are not of any interest to the person with whom I am writing.

Thank you for all the work.

nils-schween avatar Aug 17 '21 07:08 nils-schween

nils-schween @.***> writes:

I have the a similar issue. I do not mind that these blocks are displayed, when I am reading emails. (To the contrary, I am interested to know, if the signature is okay). But all my answers are containing blocks like

as well.

You can reproduce this behavior by answering a signed email. (No matter if it was signed with a certificate or a private pg key) It would be really nice, if these were not included in my replies. These blocks clutter my email conversations and are not of any interest to the person with whom I am writing.

Same problem here, I am using:

(defun tv/mu4e-remove-buttons-in-reply (original-fn &rest args)
  (if current-prefix-arg
      (delete-region (point) (point-max))
    (save-excursion
      (message-goto-body)
      (while (re-search-forward "^[[]\\{2\\}.*[]]\\{2\\}" nil t)
        (replace-match "")))
    (apply original-fn args)))
(add-function :around mu4e-compose-cite-function #'tv/mu4e-remove-buttons-in-reply)

This also remove citation with prefix arg but it is unrelated.

-- Thierry

thierryvolpiatto avatar Aug 17 '21 10:08 thierryvolpiatto

Thanks @thierryvolpiatto ! Works like a charm! @djcb what do you think? Is it possible to adapt mu4e-compose-cite-function accordingly?

nils-schween avatar Aug 17 '21 11:08 nils-schween

@nils-schween: (slightly delayed reply...)

I agree with @thierryvolpiatto; perhaps Gnus (from which we borrow the view) has something for this; but otherwise, I think it's okay to have them in the view.

However, they should not appear in replies, and I think current master handles that correctly (there have been some changes there recently). Does that work for you?

djcb avatar Jul 18 '23 20:07 djcb

"Dirk-Jan C. Binnema" @.***> writes:

[[PGP Encrypted Part:OK]] @nils-schween: (slightly delayed reply...)

I agree with @thierryvolpiatto; perhaps Gnus (from which we borrow the view) has something for this; but otherwise, I think it's okay to have them in the view.

However, they should not appear in replies, and I think current master handles that correctly (there have been some changes there recently). Does that work for you?

As you can see in this reply, no it still not working, I need this piece of code in my mu4e config to get rid of these:

(defun tv/mu4e-remove-buttons-in-reply (original-fn &rest args)
  (if current-prefix-arg
      (delete-region (point) (point-max))
    (save-excursion
      (message-goto-body)
      (while (re-search-forward "^[[]\\{2\\}.*[]]\\{2\\}" nil t)
        (replace-match "")))
    (apply original-fn args)))
(add-function :around mu4e-compose-cite-function #'tv/mu4e-remove-buttons-in-reply)

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.**> [[End of PGP Encrypted Part]]

-- Thierry

thierryvolpiatto avatar Jul 19 '23 03:07 thierryvolpiatto

@thierryvolpiatto: for me, with current master, if you reply to a message with

[[PGP Signed Part:Undecided]]
[1. text/plain]

etc., that will not be included in the reply.

However, if you have an existing message where that text had ended up in the actual message body, then it is not removed (and shouldn't, I think). Are you seeing something else?

djcb avatar Jul 19 '23 05:07 djcb

"Dirk-Jan C. Binnema" @.***> writes:

@thierryvolpiatto: for me, with current master, if you reply to a message with

[1. text/plain]

etc., that will not be included in the reply.

However, if you have an existing message where that text had ended up in the actual message body, then it is not removed (and shouldn't, I think). Are you seeing something else?

Because you assume it is the sender who encrypted the message, however Posteo users using encryption have all their messages with such buttons (This message you sent to me has been encrypted on Posteo servers with my own key).

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.**>

-- Thierry

thierryvolpiatto avatar Jul 19 '23 15:07 thierryvolpiatto

Hmm, I'm not sure I understand... the ticket is (now) about mu4e inadvertently adding Gnus metadata to outgoing messages; I think it doesn't do that anymore. Is that not true? And how does Posteo fit into this?

djcb avatar Jul 19 '23 16:07 djcb

"Dirk-Jan C. Binnema" @.***> writes:

[[PGP Encrypted Part:OK]]

  1. ( ) text/plain (*) text/html

Hmm, I'm not sure I understand... the ticket is (now) about mu4e inadvertently adding Gnus metadata to outgoing messages; I think it doesn't do that anymore.

It still doing this if I remove my advice, see in this reply email the "PGP Encrypted Part" at bottom and top are still there.

Is that not true? And how does Posteo fit into this?

Posteo is encrypting all incoming Email with my own key.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.**> [[End of PGP Encrypted Part]]

-- Thierry

thierryvolpiatto avatar Jul 19 '23 18:07 thierryvolpiatto

@thierryvolpiatto: Does this still happen with the new composer (master)?

djcb avatar Oct 28 '23 09:10 djcb

"Dirk-Jan C. Binnema" @.***> writes:

@thierryvolpiatto: Does this still happen with the new composer (master)?

Looks it doesn't happen anymore after commenting advice:

(defun tv/mu4e-remove-buttons-in-reply (original-fn &rest args) (if current-prefix-arg (delete-region (point) (point-max)) (save-excursion (message-goto-body) (while (re-search-forward "^[[]\{2\}.*[]]\{2\}" nil t) (replace-match ""))) (apply original-fn args))) ;; (add-function :around mu4e-compose-cite-function #'tv/mu4e-remove-buttons-in-reply)

Great!

Thanks.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.**>

-- Thierry

thierryvolpiatto avatar Oct 28 '23 16:10 thierryvolpiatto

Well I have not/do not have time to test if it is working at my end but assume that it is fixed as well. Thanks all.

averter avatar Oct 28 '23 17:10 averter