From: Alexander Shulgin <alex.shulgin@gmail.com>
To: Sascha Silbe <sascha-ml-reply-to-2011-3@silbe.org>,
Sup developer discussion <sup-devel@rubyforge.org>
Subject: Re: [sup-devel] [PATCH] Catch errors while saving a message to disk for editing
Date: Sat, 2 Jul 2011 23:28:27 +0300 [thread overview]
Message-ID: <BANLkTikhM6fvZoSJu=Uo_qPfTsPy3uW5tA@mail.gmail.com> (raw)
In-Reply-To: <1309619214-2446-1-git-send-email-sascha-pgp@silbe.org>
On Sat, Jul 2, 2011 at 18:06, Sascha Silbe <sascha-pgp@silbe.org> wrote:
> lib/sup/modes/edit-message-mode.rb | 24 +++++++++++++++++-------
> 1 files changed, 17 insertions(+), 7 deletions(-)
>
> diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
> index 5ed7833..256e314 100644
> --- a/lib/sup/modes/edit-message-mode.rb
> +++ b/lib/sup/modes/edit-message-mode.rb
> @@ -172,12 +172,21 @@ def edit_to; edit_field "To" end
> def edit_cc; edit_field "Cc" end
> def edit_subject; edit_field "Subject" end
>
> - def edit_message
> - @file = Tempfile.new "sup.#{self.class.name.gsub(/.*::/, '').camel_to_hyphy}"
> + def save_message_to_file
Didn't you mean 'write_message_to_file' here instead?
> + @file = Tempfile.new ["sup.#{self.class.name.gsub(/.*::/, '').camel_to_hyphy}", ".eml"]
> @file.puts format_headers(@header - NON_EDITABLE_HEADERS).first
> @file.puts
> @file.puts @body.join("\n")
> @file.close
> + end
> +
> + def edit_message
> + begin
> + write_message_to_file
> + rescue SystemCallError => e
> + BufferManager.flash "Can't save message to file: #{e.message}"
> + return
> + end
>
> editor = $config[:editor] || ENV['EDITOR'] || "/usr/bin/vi"
>
[snip]
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel
next prev parent reply other threads:[~2011-07-02 20:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-02 15:06 Sascha Silbe
2011-07-02 20:28 ` Alexander Shulgin [this message]
2011-07-02 21:54 ` Sascha Silbe
2011-07-02 21:56 ` [sup-devel] [PATCH v2] " Sascha Silbe
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='BANLkTikhM6fvZoSJu=Uo_qPfTsPy3uW5tA@mail.gmail.com' \
--to=alex.shulgin@gmail.com \
--cc=sascha-ml-reply-to-2011-3@silbe.org \
--cc=sup-devel@rubyforge.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox