emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] About org-sort -> org-sort-list with custom sort function


From: Zhitao Gong
Subject: [O] About org-sort -> org-sort-list with custom sort function
Date: Wed, 03 May 2017 14:36:52 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hi All,

I think there is a bug in org-sort or org-sort-list function.

If you call org-sort (C-c ^) on list items, this function will call
org-sort-list.  However, org-sort calls org-sort-list with only one
argument, i.e., the with-case (see the code below)

#+BEGIN_SRC emacs-lisp
((org-at-item-p) (org-call-with-arg 'org-sort-list with-case))
#+END_SRC emacs-lisp

The problem is that if you choose ?f (sorting with custom key function),
then org-sort-list expects another argument, the compare-func, which is
not passed to it.

IMHO, there are two ways to solve this

1. Ask for the compare-func in org-sort-list, as it does for the
   getkey-func.  A default value could be provided for compare-func,
   e.g., string<, <, etc.  Or
2. Restrict the return type to a string (or integer) so that we could
   fix the compare-func

-- 
gongzhitaao / 半緣脩道半緣君



reply via email to

[Prev in Thread] Current Thread [Next in Thread]