rudolfochrist/interleave

Create new notes in the correct order [Feature]

kaushalmodi opened this issue · 4 comments

When creating new notes, they are always appending at the bottom of the file.

So if you first made notes for page 10 and then for page 1, the page 1 notes will end up at the bottom of the file.

The notes will be easier to access if the page order is maintained in the notes (page 1 notes, followed by page 2 notes if present, followed by page 3 notes if present, and so on).

One way would be to scan for which page notes already exist in the org file and then insert notes for the new page at the correct location.

This can be made a defcustom var.

Entries are now sorted after quit. 178d751

The sorting doesn't seem to work for me.

I have following page notes in order: pages 33, 37, 42, 7

I take the cursor to the beginning of the buffer and eval (interleave--sort-notes 'asc). It says

Sorting entries... done

But nothing is sorted.. the notes stay in the same order.

Ah, org 'thinks' that 7 > 42! It needs to be 07!

Here's my "hackish" attempt to fix it: kaushalmodi@50939fa

I didn't do a pull request but I am sure there must be a cleaner way to make the org-sort-entries to work correctly.. probably by specifying a sorting function?

I call this a hack because it won't work reliably unless you convert all the existing note entries to have that property value in "%06d" format.