emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alexander Baier <alexander.baier@mailbox.org>
To: Dennis Yurichev <dennis_mailing_lists@conus.info>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-drill: remove duplicates
Date: Mon, 09 Jun 2014 15:17:49 +0200	[thread overview]
Message-ID: <877g4qnrwi.fsf@mailbox.org> (raw)
In-Reply-To: <m3bnu2nwzh.fsf@conus.info> (Dennis Yurichev's message of "Mon, 09 Jun 2014 14:28:02 +0300")

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

      reply	other threads:[~2014-06-09 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-09 11:28 org-drill: remove duplicates Dennis Yurichev
2014-06-09 13:17 ` Alexander Baier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877g4qnrwi.fsf@mailbox.org \
    --to=alexander.baier@mailbox.org \
    --cc=dennis_mailing_lists@conus.info \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).