From: Ramkumar Ramachandra <artagnon@gmail.com>
To: sup-talk <sup-talk@rubyforge.org>
Subject: [sup-talk] [PATCH 3/4] Callback to compose
Date: Sat, 10 Apr 2010 16:09:43 +0530 [thread overview]
Message-ID: <1270895977-sup-1231@kytes> (raw)
Write a callback to parse the file and fill in the parsed contents
into a newly spawned buffer.
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
lib/sup/modes/compose-mode.rb | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/lib/sup/modes/compose-mode.rb b/lib/sup/modes/compose-mode.rb
index f0d1e23..a19c294 100644
--- a/lib/sup/modes/compose-mode.rb
+++ b/lib/sup/modes/compose-mode.rb
@@ -20,6 +20,23 @@ class ComposeMode < EditMessageMode
edited
end
+ def parse_file fn
+ super fn
+ end
+
+ def self.edit_message_callback file, mtime
+ edited = File.mtime(file.path) > mtime ? true : false
+
+ return edited unless edited
+
+ mode = ComposeMode.new
+ header, body = mode.parse_file file.path
+ header -= NON_EDITABLE_HEADERS
+ mode.header, mode.body = header, body
+ BufferManager.spawn "New Message", mode
+ mode.update
+ end
+
def self.spawn_nicely opts={}
to = opts[:to] || (BufferManager.ask_for_contacts(:people, "To: ", [opts[:to_default]]) or return if ($config[:ask_for_to] != false))
cc = opts[:cc] || (BufferManager.ask_for_contacts(:people, "Cc: ") or return if $config[:ask_for_cc])
--
1.7.0.4
_______________________________________________
sup-talk mailing list
sup-talk@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-talk
reply other threads:[~2010-04-10 10:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1270895977-sup-1231@kytes \
--to=artagnon@gmail.com \
--cc=sup-talk@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