Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] Bug report: temp file commit breaks my emacs hook
@ 2011-01-10 20:11 Steve
  2011-01-10 20:48 ` Michael Hamann
  0 siblings, 1 reply; 3+ messages in thread
From: Steve @ 2011-01-10 20:11 UTC (permalink / raw)
  To: sup-devel, Michael Hamann

Hi all,

This commit has broken part of the interaction between sup and my emacs.

commit 60573298a2258c101a85b3de8121f73d7aec2d51
Author: Michael Hamann <michael@content-space.de>
Date:   Fri Oct 8 10:03:36 2010 -0400

    Fix monkey-patching of Tempfile


Did you change the name of the temp file that gets passed to emacs?
My emacs hook looks like this.

(add-to-list 'auto-mode-alist
'("sup\\.\\(compose\\|forward\\|reply\\|resume\\)-mode$" . mail-mode))

Thoughts?

Thanks.
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [sup-devel] Bug report: temp file commit breaks my emacs hook
  2011-01-10 20:11 [sup-devel] Bug report: temp file commit breaks my emacs hook Steve
@ 2011-01-10 20:48 ` Michael Hamann
  2011-01-10 21:09   ` Steve
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Hamann @ 2011-01-10 20:48 UTC (permalink / raw)
  To: Steve; +Cc: sup-devel

Hi,

Excerpts from Steve's message of 2011-01-10 21:11:35 +0100:
> This commit has broken part of the interaction between sup and my emacs.
> 
> commit 60573298a2258c101a85b3de8121f73d7aec2d51
> Author: Michael Hamann <michael@content-space.de>
> Date:   Fri Oct 8 10:03:36 2010 -0400
> 
>     Fix monkey-patching of Tempfile
> 
> 
> Did you change the name of the temp file that gets passed to emacs?

Yes. Now sup can and must use the syntax for Tempfile creation that is
available in Ruby version 1.8.7 and newer. It allows to set both a
prefix and a suffix. I didn't care about the filename because I had the
experience that with the old filename my Vim didn't recognize the
content as email and without the extension it recognizes it which gives
me nice syntax highlighting even without configuring anything.

> My emacs hook looks like this.
> 
> (add-to-list 'auto-mode-alist
> '("sup\\.\\(compose\\|forward\\|reply\\|resume\\)-mode$" . mail-mode))

The string you are looking for is now at the beginning of the filename
so you could change your hook to match the beginning of the filename
instead of the end.

The following simple change will change the end of the filenames to
.EXTENSION, so if you think it makes sense to add an extension again I
could provide a proper patch.

diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
index 86aef4b..052421d 100644
--- a/lib/sup/modes/edit-message-mode.rb
+++ b/lib/sup/modes/edit-message-mode.rb
@@ -162,7 +162,7 @@ EOS
   def edit_subject; edit_field "Subject" end
 
   def edit_message
-    @file = Tempfile.new "sup.#{self.class.name.gsub(/.*::/, '').camel_to_hyphy}"
+    @file = Tempfile.new ["sup.#{self.class.name.gsub(/.*::/, '').camel_to_hyphy}", ".EXTENSION"]
     @file.puts format_headers(@header - NON_EDITABLE_HEADERS).first
     @file.puts
     @file.puts @body.join("\n")


Regards,
Michael Hamann
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [sup-devel] Bug report: temp file commit breaks my emacs hook
  2011-01-10 20:48 ` Michael Hamann
@ 2011-01-10 21:09   ` Steve
  0 siblings, 0 replies; 3+ messages in thread
From: Steve @ 2011-01-10 21:09 UTC (permalink / raw)
  To: Michael Hamann; +Cc: sup-devel

On Mon, Jan 10, 2011 at 3:48 PM, Michael Hamann
<michael@content-space.de> wrote:
> Hi,
>
> Excerpts from Steve's message of 2011-01-10 21:11:35 +0100:
>> This commit has broken part of the interaction between sup and my emacs.
>>
>> commit 60573298a2258c101a85b3de8121f73d7aec2d51
>> Author: Michael Hamann <michael@content-space.de>
>> Date:   Fri Oct 8 10:03:36 2010 -0400
>>
>>     Fix monkey-patching of Tempfile
>>
>>
>> Did you change the name of the temp file that gets passed to emacs?
>
> Yes. Now sup can and must use the syntax for Tempfile creation that is
> available in Ruby version 1.8.7 and newer. It allows to set both a
> prefix and a suffix. I didn't care about the filename because I had the
> experience that with the old filename my Vim didn't recognize the
> content as email and without the extension it recognizes it which gives
> me nice syntax highlighting even without configuring anything.
>
>> My emacs hook looks like this.
>>
>> (add-to-list 'auto-mode-alist
>> '("sup\\.\\(compose\\|forward\\|reply\\|resume\\)-mode$" . mail-mode))
>
> The string you are looking for is now at the beginning of the filename
> so you could change your hook to match the beginning of the filename
> instead of the end.

Makes sense.  I have corrected my emacs pattern.  No need to patch.

Thanks!
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-10 21:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-10 20:11 [sup-devel] Bug report: temp file commit breaks my emacs hook Steve
2011-01-10 20:48 ` Michael Hamann
2011-01-10 21:09   ` Steve

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox