simplenote-vim / simplenote.vim

vim plugin to interact with the simplenote service
http://www.vim.org/scripts/script.php?script_id=3582
MIT License
368 stars 31 forks source link

:Simplenote -l X doesn't work well when there are deleted notes #38

Closed atomicules closed 11 years ago

atomicules commented 11 years ago

You can assign this one to me.

Previously doing something like :Simplenote -l 10 worked really well for me and returned the 10 most recent notes. However, now by limiting the number of notes fetched to 10 I will end up with just one note being listed in Vim (because the other 9 fetched will have the "deleted" flag set). I don't know if it is because something has changed in the API or whether it's because I've more deleted notes.

I thought the API returned the note index starting with the most recent note? I'm sure that is how it worked when I added in the "limit list" bit. However, now it seems to return the oldest note first and since a lot of my older notes are more likely to have the "deleted" flag set that's why I end up with one note, etc being displayed. The only API doc I've got access to is v2.1.5. Do you know if there have been any changes since this?

The limit list functionality in Simplenote.py works, but the problem with how I implemented it in Simplenote.vim is that I did not appreciate or take into account that Simplenote.vim filters the returned list for display.

So... there are two problems

  1. I need to rethink how it works. I guess I just for each fetch of notes I just need to count how many aren't deleted and continue fetching until enough undeleted notes are retrieved. But...
  2. This doesn't help with the fact that the api now seems to be returning results in reverse order. I don't really care for my oldest 10 notes :-(.

Perhaps I'd be better scrapping the "limit list" idea and using the "modified since" option in the API for a way of limiting the notes returned?

mrtazz commented 11 years ago

Hmm I'd have to dig into this but I'm not aware of any API changes.

mrtazz commented 11 years ago

The API index indeed seems to return the oldest notes first (based on modifydate). I asked on the API mailing list and when this is the true, we'll need to find a better way to implement this functionality.

atomicules commented 11 years ago

I asked on the API mailing list

Thanks. I lost access to the API group when I deleted my Gmail account. I'm thinking it might be better to use something like -l 2012-09-25 and just return all notes modified since a date rather than trying to return a set number. After all, the reason why I went with the "limit list" thing was that I wanted a way to return my most recent notes quickly.

mrtazz commented 11 years ago

quote from the API mailing list:

The order is arbitrary (not guaranteed), but will mostly conform to order the notes were created in. In the new Simperium API interface for Simplenote, the order is by most recently modified.

So we can't really rely on the order. Although I will also look into the Simperium API, maybe it makes sense to switch to it.

atomicules commented 11 years ago

Sorry for the delay. This is the kind of thing I was thinking (implemented in simplenote.py), rather than have get_note_list(qty) have get_note_list("YYYY-MM-DD"):

https://github.com/atomicules/simplenote.py/commit/6e0c3115f8705c9b4e27cb7ad95f49337e67846e

What do you think?

mrtazz commented 11 years ago

Looks pretty good to me. I somehow totally overlooked that the API provides a since parameter.

atomicules commented 11 years ago

Ok, I'll finish off the changes in simplenote.py (tests and README) and then make the necessary changes in simplenote.vim.

atomicules commented 10 years ago

Couldn't re-open this pull request, but merged in here: https://github.com/mrtazz/simplenote.vim/commit/69ee0d483b2a52df619430b6970d365936ff3eeb