mu icon indicating copy to clipboard operation
mu copied to clipboard

[mu4e rfe] More flexible reply options

Open theophilusx opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe.

Often I want to reply to a message without including a copy of the original message or including only a part of the original message. Currently, I have to manually delete the cited message or edit it. Something similar to what Gnus offers would be great (where you can reply without citation or with citation).

Describe the solution you'd like

Two parts to the ideal solution:

Part 1: If reply (R) is called with the universal/prefix argument C-u, create the reply buffer WITHOUT any citation of the original message - just a blank buffer. If R is called without the prefix argument, behave as it does now.

Part 2: Desirable but not essential. If you reply (R) to a message and the original message has a region defined, only include the text enclosed in the region in the reply. This would allow easy reply to a message where you just want to quote part of the message rather than the whole message.

Describe alternatives you've considered

Would accept any alternative which would just allow me to reply to a message without including citation of the original message.

Additional context

Two examples where this would be useful -

Replying to messages from bug trackers and issue trackers (le.g. issue notification from github). You don't want to include the original message because the reply will be added to the comments on the issue and including the original message is just duplicating information already visible and adding noise.

Using add-on packages like org-msg, which adds the reply as a read-only section in the reply, which means you cannot edit it. This means you cannot use org-msg (which gives you support for composing messages using org features like tables, lists, source blocks etc) to compose replies where you don't want to include the whole cited original message. For example, if I wanted to reply to this issue including a source block showing some code I might have added or configuration settings to mu4e!

theophilusx avatar Jul 18 '21 03:07 theophilusx

Everything should be there to do that, and we inherit quite a bit from gnus -

There's mu4e-compose-cite-function, and you can changes various knobs here: https://gnus.org/manual/big-message.html#Insertion-Variables

So what you'd need is a defun that sets those things (let-binding won't work), then calls mu4e-compose-reply.

djcb avatar Jul 18 '21 08:07 djcb

Your right. I was able to hack together the following, which seems to work. Putting it here in case others might find it useful. Basically, if you reply with C-u R to add the universal argument, the citation is remove. If you just do R as normal, the message is cited as normal.

,---- | (defun tx-delete-citation () | (let ((start (point)) | (end (point-max))) | (delete-region start end))) | | (defun tx-mu4e-reply (prefix) | (interactive "P") | (setq mu4e-compose-cite-function (if prefix | #'tx-delete-citation | #'message-cite-original-without-signature)) | (mu4e-compose-reply)) | | (define-key mu4e-view-mode-map "R" #'tx-mu4e-reply) | (define-key mu4e-headers-mode-map "R" #'tx-mu4e-reply) `----

It is pretty hacky, but seems to achieve the basic result I was after.

Regards,

Tim

-- Tim Cross

/For gor sake stop laughing, this is serious!/

theophilusx avatar Jul 18 '21 12:07 theophilusx

Tim Cross @.***> writes:

[[PGP Encrypted Part:OK]] Your right. I was able to hack together the following, which seems to work. Putting it here in case others might find it useful. Basically, if you reply with C-u R to add the universal argument, the citation is remove. If you just do R as normal, the message is cited as normal.

,---- | (defun tx-delete-citation () | (let ((start (point)) | (end (point-max))) | (delete-region start end))) | | (defun tx-mu4e-reply (prefix) | (interactive "P") | (setq mu4e-compose-cite-function (if prefix | #'tx-delete-citation | #'message-cite-original-without-signature)) | (mu4e-compose-reply)) | | (define-key mu4e-view-mode-map "R" #'tx-mu4e-reply) | (define-key mu4e-headers-mode-map "R" #'tx-mu4e-reply) `----

It is pretty hacky, but seems to achieve the basic result I was after.

Nice, seems you can do this as well with advice:

(defun tv/mu4e-compose-reply-advice (&rest args)
  (setq mu4e-compose-cite-function
        (if current-prefix-arg
            (lambda () (delete-region (point) (point-max)))
          #'message-cite-original-without-signature)))
(advice-add 'mu4e-compose-reply :before #'tv/mu4e-compose-reply-advice)

-- Thierry

thierryvolpiatto avatar Jul 18 '21 13:07 thierryvolpiatto

The new message composer should help for this; for the no-citation part, you can e.g. let-bind message-cite-function to mu4e-message-cite-nothing. If this is a common need you could create a function my-mu4e-compose-reply-without-citation that does that.

Note: mu4e 1.11.23 has a new composer that is much closer to gnus' one, so various message- settings have better odds to work in mu4e as well. See NEWS.org for details.

djcb avatar Oct 26 '23 06:10 djcb