From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Baier Subject: Re: org-drill: remove duplicates Date: Mon, 09 Jun 2014 15:17:49 +0200 Message-ID: <877g4qnrwi.fsf@mailbox.org> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtzSe-000390-2r for emacs-orgmode@gnu.org; Mon, 09 Jun 2014 09:18:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WtzSX-0002KN-5t for emacs-orgmode@gnu.org; Mon, 09 Jun 2014 09:18:04 -0400 Received: from mx2.mailbox.org ([80.241.60.215]:39722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WtzSW-0002Jw-Ro for emacs-orgmode@gnu.org; Mon, 09 Jun 2014 09:17:57 -0400 In-Reply-To: (Dennis Yurichev's message of "Mon, 09 Jun 2014 14:28:02 +0300") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Dennis Yurichev Cc: emacs-orgmode@gnu.org 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