Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exception editing draft message from inbox #225

Closed
acodispo opened this issue Feb 9, 2014 · 12 comments
Closed

exception editing draft message from inbox #225

acodispo opened this issue Feb 9, 2014 · 12 comments
Labels

Comments

@acodispo
Copy link

acodispo commented Feb 9, 2014

In inbox-mode, highlight a thread with a draft, hit e.

exception-log.txt:

--- NoMethodError from thread: main
undefined method `fn_for_offset' for #<Redwood::Maildir:0x9978cdc>
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/lib/sup/message.rb:186:in `draft_filename'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/lib/sup/modes/resume_mode.rb:8:in `initialize'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/lib/sup/modes/thread_index_mode.rb:272:in `new'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/lib/sup/modes/thread_index_mode.rb:272:in `edit_message'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/lib/sup/mode.rb:59:in `handle_input'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/lib/sup/buffer.rb:222:in `handle_input'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/bin/sup:268:in `<module:Redwood>'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/bin/sup:74:in `<top (required)>'
/home/acodispo/.gem/ruby/2.1.0/bin/sup:23:in `load'
/home/acodispo/.gem/ruby/2.1.0/bin/sup:23:in `<main>'

Arch Linux, sup installed via gem i sup.

@cscorley
Copy link
Contributor

cscorley commented Feb 9, 2014

See issue #220.

Short answer: you cannot edit drafts that are in a Maildir.

@acodispo
Copy link
Author

Okay, thanks! If you have time, can you clarify how my draft got into the Maildir? I'm not doing anything like #220 is doing, setting a label on a source draft folder. I am using the sync-back features, and the thread does have a label on it. Which of my behaviors is causing the issue (since I'd like to avoid it in the future)? Thanks again!

@cscorley
Copy link
Contributor

Actually, I don't think this deals with issue #220 at all now. However, I cannot reproduce. Any other details about the specific thread you can provide?

@gauteh
Copy link
Member

gauteh commented Feb 10, 2014

Draft does have a corresponding maildir flag ('D' means :draft). Seems like we're adding the draft label to messages polled from maildirfolders that have been marked as drafts externally.

@cscorley
Copy link
Contributor

For now (until Maildir draft editing is possible), is it best to just disable the application of this label then? (https://github.com/sup-heliotrope/sup/blob/develop/lib/sup/maildir.rb#L182)

@acodispo
Copy link
Author

I can't see anything peculiar about the thread itself. Single email to me, I sent a reply, and then a reply back to me. Oddly, the thread still indicates the presence of a draft, though the edited and sent draft appears in the thread. Here's the exception-log.txt when I try to edit the lingering draft:

--- NoMethodError from thread: main
undefined method `fn_for_offset' for #<Redwood::Maildir:0x8d40ca8>
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/lib/sup/message.rb:186:in `draft_filename'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/lib/sup/modes/resume_mode.rb:8:in `initialize'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/lib/sup/modes/thread_view_mode.rb:423:in `new'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/lib/sup/modes/thread_view_mode.rb:423:in `edit_draft'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/lib/sup/mode.rb:59:in `handle_input'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/lib/sup/buffer.rb:222:in `handle_input'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/bin/sup:268:in `<module:Redwood>'
/home/acodispo/.gem/ruby/2.1.0/gems/sup-0.15.4/bin/sup:74:in `<top (required)>'
/home/acodispo/.gem/ruby/2.1.0/bin/sup:23:in `load'
/home/acodispo/.gem/ruby/2.1.0/bin/sup:23:in `<main>'

It's identical to the other exception except for a different hash after Maildir: at end of line 2?

@gauteh
Copy link
Member

gauteh commented Feb 10, 2014

@cscorley: yes, gracefully handle the draft label on any sync. Ignore it like other labels (e.g.: :killed), that is, remove it from the supported labels list.

@gauteh
Copy link
Member

gauteh commented Feb 10, 2014

@acodispo: the hash will change each time the Maildir class is instantiated in Ruby (when you start sup).

@acodispo
Copy link
Author

Is there a way to clear the draft status on that message? The message I was working on (i.e. the draft) is sent and done with, and it seems messy to leave it lying around. :-)

I'm away from the laptop at present, but as I recall the only file showing in .sup/drafts was an open draft for a different thread.

@gauteh
Copy link
Member

gauteh commented Feb 11, 2014

You could, while sup is shut down, try to edit the file directly: change the filename to no longer have the D flag at the end. Upon next re-poll sup should find the change and remove the draft label. Another way to do this is to change it on the remote server (I don't know your setup).

If you are certain the email is not a draft, you could remove the draft label manually on the index and then reconcile the flags. You could do something along the lines of (sup closed):

Remember to back up index and mail first.

$ cd sup.git/devel
$ irb -I../lib -r './start-console'
> q = Index.parse_query('label:draft')
> a = []
> Index.each_message(q) { |x| a.push x }
> puts a # this should only contain one message if you only have one marked as draft
> m = a[0] # get the first message or find the problematic one
> m.labels.delete :draft
> m.sync_back
> exit

@acodispo
Copy link
Author

Thanks for the help. I ended up having to wipe out my maildir and sup index and start over, for unrelated reasons, but if I run across the issue again I'll let you know.

@gauteh
Copy link
Member

gauteh commented Feb 12, 2014

Ok

@gauteh gauteh closed this as completed Feb 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants