From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carlos Pita Subject: [PATCH] Faulty logic in org-cmp-tag/alpha Date: Sat, 9 Mar 2019 17:55:41 -0300 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000a95f520583af90a4" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:45264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2j0d-0003yn-2C for emacs-orgmode@gnu.org; Sat, 09 Mar 2019 15:55:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2j0c-0007qA-74 for emacs-orgmode@gnu.org; Sat, 09 Mar 2019 15:55:55 -0500 Received: from mail-yw1-xc2f.google.com ([2607:f8b0:4864:20::c2f]:43469) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h2j0b-0007pJ-U4 for emacs-orgmode@gnu.org; Sat, 09 Mar 2019 15:55:54 -0500 Received: by mail-yw1-xc2f.google.com with SMTP id d129so867308ywe.10 for ; Sat, 09 Mar 2019 12:55:53 -0800 (PST) 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 --000000000000a95f520583af90a4 Content-Type: text/plain; charset="UTF-8" Hi all, there is a problem in this kind of logic: (cond ((not ta) +1) ((not tb) -1) ((string-lessp ta tb) -1) ((string-lessp tb ta) +1)))) in that when both ta and tb are nil then they are arbitrarily sorted. Since the agenda sorting strategy is lexicographic this logic virtually invalidates any strategy that puts tag or alpha first, v.g. '(tag-up priority-down). I've attached a patch returning nil when both ta and tb are nil so as to fallback to the next sorting criterion without favoring lhs nor rhs. AFAICS this only affects tag and alpha comparators. Best regards -- Carlos --000000000000a95f520583af90a4 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Compare-nil-nil-as-nil-so-as-not-to-change-lexicogra.patch" Content-Disposition: attachment; filename="0001-Compare-nil-nil-as-nil-so-as-not-to-change-lexicogra.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_jt1ywftt0 RnJvbSAzNTM5NjE4MmI0NjViZDY3YzcyZDc3NjcwOWVlZTVlMDA0MWQ5NmM3IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBtZW1lcGxleCA8Y2FybG9zam9zZXBpdGFAZ21haWwuY29tPgpE YXRlOiBTYXQsIDkgTWFyIDIwMTkgMTc6NDk6NTIgLTAzMDAKU3ViamVjdDogW1BBVENIXSBDb21w YXJlIG5pbC1uaWwgYXMgbmlsIHNvIGFzIG5vdCB0byBjaGFuZ2UgbGV4aWNvZ3JhcGhpYwogb3Jk ZXIKCiogbGlzcC9vcmctYWdlbmRhLmVsIChvcmctY21wLWFscGhhL3RhZyk6IGRvbid0IGZhdm9y IGEgcGFydGljdWxhcgogIG9yZGVyaW5nIHdoZW4gYm90aCBsaHMgYW5kIHJocyBhcmUgbmlsLgot LS0KIGxpc3Avb3JnLWFnZW5kYS5lbCB8IDYgKysrKy0tCiAxIGZpbGUgY2hhbmdlZCwgNCBpbnNl cnRpb25zKCspLCAyIGRlbGV0aW9ucygtKQoKZGlmZiAtLWdpdCBhL2xpc3Avb3JnLWFnZW5kYS5l bCBiL2xpc3Avb3JnLWFnZW5kYS5lbAppbmRleCAxM2JiYWU5NjYuLmM5YmVhNDQ2NSAxMDA2NDQK LS0tIGEvbGlzcC9vcmctYWdlbmRhLmVsCisrKyBiL2xpc3Avb3JnLWFnZW5kYS5lbApAQCAtNzAw Myw3ICs3MDAzLDggQEAgVGhlIG9wdGlvbmFsIGFyZ3VtZW50IFRZUEUgdGVsbHMgdGhlIGFnZW5k YSB0eXBlLiIKIAkJCQkgICJcXChbIFx0XSpcXFtbYS16QS1aMC05XVxcXVxcKT8gKiIpIHRiKQog CShzZXRxIHRiIChzdWJzdHJpbmcgdGIgKG1hdGNoLWVuZCAwKSkpKQogICAgICAgKHNldHEgdGIg KGRvd25jYXNlIHRiKSkpCi0gICAgKGNvbmQgKChub3QgdGEpICsxKQorICAgIChjb25kICgobm90 IChvciB0YSB0YikpIG5pbCkKKwkgICgobm90IHRhKSArMSkKIAkgICgobm90IHRiKSAtMSkKIAkg ICgoc3RyaW5nLWxlc3NwIHRhIHRiKSAtMSkKIAkgICgoc3RyaW5nLWxlc3NwIHRiIHRhKSArMSkp KSkKQEAgLTcwMTIsNyArNzAxMyw4IEBAIFRoZSBvcHRpb25hbCBhcmd1bWVudCBUWVBFIHRlbGxz IHRoZSBhZ2VuZGEgdHlwZS4iCiAgICJDb21wYXJlIHRoZSBzdHJpbmcgdmFsdWVzIG9mIHRoZSBm aXJzdCB0YWdzIG9mIEEgYW5kIEIuIgogICAobGV0ICgodGEgKGNhciAobGFzdCAoZ2V0LXRleHQt cHJvcGVydHkgMSAndGFncyBhKSkpKQogCSh0YiAoY2FyIChsYXN0IChnZXQtdGV4dC1wcm9wZXJ0 eSAxICd0YWdzIGIpKSkpKQotICAgIChjb25kICgobm90IHRhKSArMSkKKyAgICAoY29uZCAoKG5v dCAob3IgdGEgdGIpKSBuaWwpCisJICAoKG5vdCB0YSkgKzEpCiAJICAoKG5vdCB0YikgLTEpCiAJ ICAoKHN0cmluZy1sZXNzcCB0YSB0YikgLTEpCiAJICAoKHN0cmluZy1sZXNzcCB0YiB0YSkgKzEp KSkpCi0tIAoyLjIxLjAKCg== --000000000000a95f520583af90a4--