On 2014-06-09 13:28 Dennis Yurichev wrote:
> Hi.
>
> I just started using org-drill, which is seems pretty good.
> One thing I noticed at first: are there a way to remove duplicates which
> will inevitably be added into the file?
>
> And/or: it's possible to sort all entries in org-file by, let's say,
> "** English" heading?
>
> I've something like...
>
> ==
> * Word
> ** English
> english word 2
> ** Russian
> russian word 2
>
> * Word
> ** English
> english word 1
> ** Russian
> russian word 1
> ==
>
> It's possible to sort file so that's entry with "english word 1"
> will be at top?
I do not know of any build-in sorting strategy that does what you want.
But you can always write your own function and pass it along with
`C-c ^ f'. Such a function takes no arguments and returns the sorting
key. I put together a small function, but it does not work correctly
yet. Maybe someone can point out why. Or maybe this will help you as a
point to start and investigate further.
This function is called with point at the beginning of the top level
headline. Note: I called `C-c ^ f' with an active region over the whole
file.
#+BEGIN_SRC emacs-lisp
(defun my-sort ()
(forward-line 2)
(message "%s" (thing-at-point 'line))
(thing-at-point 'line))
#+END_SRC
Using this function with org-sort results in some weird behaviour where
only the "English" but not the "Russian" headlines are sorted.
I hope this helps a bit,
--
Alexander Baier