unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mark Lillibridge <mdl@alum.mit.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: Change in rmail-insert-mime-forwarded-message
Date: Fri, 11 Jan 2013 08:48:07 -0800	[thread overview]
Message-ID: <87d2xb64zc.fsf@foil.strangled.net> (raw)
In-Reply-To: <837gnkgmxm.fsf@gnu.org> (message from Eli Zaretskii on Fri, 11 Jan 2013 10:10:13 +0200)


Eli Zaretskii <eliz@gnu.org> writes:

>  > Date: Thu, 10 Jan 2013 23:43:33 -0500
>  > From: Richard Stallman <rms@gnu.org>
>  > Cc: emacs-devel@gnu.org
>  > 
>  > 	Hmmm.  Richard, does the behavior of "f" when
>  >     rmail-enable-mime-composing is set to nil do what you want?
>  > 
>  > I just tried it, and it seems ok.
>  > 
>  > 								 If so, we
>  >     just need to figure out a good way to make that behavior and my patch
>  >     behavior for "f" available at the same time.
>  > 
>  > That's ok with me.  Any suggestions?
>  
>  Test rmail-enable-mime-composing's value and do one or the other
>  depending on that value?

    The obvious first step would seem to be to modify rmail-forward
(below) to have an optional argument that overrides the setting of
rmail-enable-mime-composing.  

    The question is how best to select this argument interactively?
Unfortunately, the prefix argument is already being used to toggle
between regular forward and resend message.  We could make C-u f resend
and C-u C-u f forward the non-default way, but that feels kludgy to me.
Accordingly, I'm thinking adding a new command key would be better.  We
could add F for the alternative forward method or move resend to its own
key, R, and make C-u f the alternative forward (not muscle memory
backwards compatible).  If you don't like shifting (I don't think Rmail
currently uses any shifted letters), y and z look available but are not
very memorable.  Either way, this probably means adding a short helper
function that calls rmail-forward with the appropriate arguments.  An
advantage of "F" is that it would allow using C-u F in the future for
alternative methods of forwarding like (3).

    Note that there are a few other ways to forward messages (menubar,
from summary buffer) that would also need to be changed similarly to
whatever we do with the main one.  We should probably rename (with
obsolete alias) rmail-enable-mime-composing to something like
rmail-default-forwarding-method if we do this.

    I don't have a strong argument offhand for which way the default
should be set, but if it's (2), it might be useful to have a mini-buffer
message if the message has attachments suggesting that the user might
want to use (1) instead.

- Mark



(defun rmail-forward (resend)
  "Forward the current message to another user.
With prefix argument, \"resend\" the message instead of forwarding it;
see the documentation of `rmail-resend'."
  (interactive "P")
  (if (zerop rmail-current-message)
      (error "No message to forward"))
  (if resend
      (call-interactively 'rmail-resend)
    (let ((forward-buffer rmail-buffer)
	  (msgnum rmail-current-message)
	  (subject (concat "["
			   (let ((from (or (mail-fetch-field "From")
					   (mail-fetch-field ">From"))))
			     (if from
				 (concat (mail-strip-quoted-names from) ": ")
			       ""))
			   (or (mail-fetch-field "Subject") "")
			   "]")))
      (if (rmail-start-mail
	   nil nil subject nil nil rmail-buffer
	   (list (list 'rmail-mark-message
		       forward-buffer
		       (with-current-buffer rmail-buffer
			 (aref rmail-msgref-vector msgnum))
		       rmail-forwarded-attr-index))
	   ;; If only one window, use it for the mail buffer.
	   ;; Otherwise, use another window for the mail buffer
	   ;; so that the Rmail buffer remains visible
	   ;; and sending the mail will get back to it.
	   (and (not rmail-mail-new-frame) (one-window-p t)))
	  ;; The mail buffer is now current.
	  (save-excursion
	    ;; Insert after header separator--before signature if any.
	    (rfc822-goto-eoh)
	    (forward-line 1)
	    (if (and rmail-enable-mime rmail-enable-mime-composing
		     rmail-insert-mime-forwarded-message-function)
		(prog1
		    (funcall rmail-insert-mime-forwarded-message-function
			     forward-buffer)
		  ;; rmail-insert-mime-forwarded-message-function
		  ;; works by inserting MML tags into forward-buffer.
		  ;; The MUA will need to convert it to MIME before
		  ;; sending.  mail-encode-mml tells them to do that.
		  ;; message.el does that automagically.
		  (or (eq mail-user-agent 'message-user-agent)
		      (setq mail-encode-mml t)))
	      (insert "------- Start of forwarded message -------\n")
	      ;; Quote lines with `- ' if they start with `-'.
	      (let ((beg (point)) end)
		(setq end (point-marker))
		(set-marker-insertion-type end t)
		(insert-buffer-substring forward-buffer)
		(goto-char beg)
		(while (re-search-forward "^-" end t)
		  (beginning-of-line)
		  (insert "- ")
		  (forward-line 1))
		(goto-char end)
		(skip-chars-backward "\n")
		(if (< (point) end)
		    (forward-char 1))
		(delete-region (point) end)
		(set-marker end nil))
	      (insert "------- End of forwarded message -------\n"))
	    (push-mark))))))



  reply	other threads:[~2013-01-11 16:48 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07  2:18 Change in rmail-insert-mime-forwarded-message Richard Stallman
2013-01-07  3:44 ` Eli Zaretskii
2013-01-08  2:11   ` Richard Stallman
2013-01-09 17:15     ` Eli Zaretskii
2013-01-10  6:19       ` Richard Stallman
2013-01-10 19:03         ` Eli Zaretskii
2013-01-07  4:43 ` Mark Lillibridge
2013-01-08  2:11   ` Richard Stallman
2013-01-08  3:57     ` Mark Lillibridge
2013-01-08 10:02       ` Stephen J. Turnbull
2013-01-08 16:32         ` Mark Lillibridge
2013-01-08 18:13           ` Stephen J. Turnbull
2013-01-23  0:32             ` Mark Lillibridge
2013-01-23  6:44               ` Stephen J. Turnbull
2013-01-09 16:43       ` Richard Stallman
2013-01-10 16:53         ` Mark Lillibridge
2013-01-11  4:43           ` Richard Stallman
2013-01-11  8:10             ` Eli Zaretskii
2013-01-11 16:48               ` Mark Lillibridge [this message]
2013-01-13 22:43                 ` Richard Stallman
2013-01-14 22:43                   ` Richard Stallman
2013-01-15  2:13                     ` Glenn Morris
2013-01-15  4:01                       ` Eli Zaretskii
2013-01-15  5:27                       ` Richard Stallman
2013-01-15 16:07                         ` Eli Zaretskii
2013-01-16  0:04                           ` Richard Stallman
2013-01-23  0:40                             ` Mark Lillibridge
2013-01-15 17:29                         ` Glenn Morris
2013-01-16  0:04                           ` Richard Stallman
2013-01-16  1:14                             ` Glenn Morris
2013-01-17  6:26                     ` Mark Lillibridge
2013-01-17 21:04                       ` Richard Stallman
2013-04-01 19:06                         ` Mark Lillibridge

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d2xb64zc.fsf@foil.strangled.net \
    --to=mdl@alum.mit.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=rms@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).