From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zhitao Gong Subject: About org-sort -> org-sort-list with custom sort function Date: Wed, 03 May 2017 14:36:52 -0500 Message-ID: <87inlhhgvf.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:38738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6056-0007va-2N for emacs-orgmode@gnu.org; Wed, 03 May 2017 15:37:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6052-0007Dd-6Y for emacs-orgmode@gnu.org; Wed, 03 May 2017 15:37:00 -0400 Received: from mail-yw0-x232.google.com ([2607:f8b0:4002:c05::232]:34851) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d6052-0007Ay-1M for emacs-orgmode@gnu.org; Wed, 03 May 2017 15:36:56 -0400 Received: by mail-yw0-x232.google.com with SMTP id u70so90663933ywe.2 for ; Wed, 03 May 2017 12:36:54 -0700 (PDT) Received: from localhost ([131.204.254.104]) by smtp.gmail.com with ESMTPSA id k128sm11020579ywb.58.2017.05.03.12.36.52 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 03 May 2017 12:36:53 -0700 (PDT) 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" To: emacs-orgmode@gnu.org 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 --=20 gongzhitaao / =E5=8D=8A=E7=B7=A3=E8=84=A9=E9=81=93=E5=8D=8A=E7=B7=A3=E5=90= =9B