From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id uA2gCPmjG2QesQAASxT56A (envelope-from ) for ; Thu, 23 Mar 2023 01:57:29 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id KKp1CPmjG2R/ogAA9RJhRA (envelope-from ) for ; Thu, 23 Mar 2023 01:57:29 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id A6A0428A34 for ; Thu, 23 Mar 2023 01:57:28 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pf9Fz-0008IQ-OR; Wed, 22 Mar 2023 20:56:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pf9Fx-0008Hm-Qg for emacs-orgmode@gnu.org; Wed, 22 Mar 2023 20:56:41 -0400 Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pf9Fv-0005Ph-OL for emacs-orgmode@gnu.org; Wed, 22 Mar 2023 20:56:41 -0400 Received: by mail-lj1-x22b.google.com with SMTP id e11so12170352lji.8 for ; Wed, 22 Mar 2023 17:56:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679532997; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=swr06GQTSw8rZts2XFfB7012ueo67q27o+bLNCnstdo=; b=N8W6k9ebmMI6QUsy7lqMH5IxOdMsazDGWFElso5+XH5dTuvmMGXCEUijaZpI5Pgfgz SKyWp3rJ8mqRGtM5Oaw3hULE/c0+AILdX8H1eDF6Xe7JNvV59RUJxj7kRp9a20zaVW8t qB36npho5VLjcv0/0UWCQmmUE9bQ7XPMRNOhS8EEz9L/zfPqjOgchmRsfjRh/GDqgRqQ N48/GeA85csK7W6Jcyg+9ZXEd/iWCu42dx8ZN4+AA9TSGMTiiRZm0NZ/oMc3quXbMej8 6BnuCk90cyavaJsT0Wcm91/RvPxLlfmyQ8UdLoRKr9T9FCIe75kWkvWJfzH/1mApqy6N +6yQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679532997; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=swr06GQTSw8rZts2XFfB7012ueo67q27o+bLNCnstdo=; b=NfmNBbAim00T2IpkoNDvWRm4ITWUCobx039pG7nxy6QDEMicYHPws+6YBFj40YE7SW 2urXPuHWl07c8W9Gl1vd7TcRg3ViTDR2MOslrfDerQG2XC8PPykdoS+YMXdIsXZSMN6m V52Iim/7iyzt4NplwQrsNOC/iYcKL8WT9GIovqMYZopTxHsKnu06hOKkF/ebE6vqawvo zsPuX9N9cnPLSGctY/Jtjgp01CHZkZEeyKRZ7tTVPbG32eNox1p0UOLb0fpJPW4hqaYV BVTkqzOwfyyq+ybTOad8n6zm2aGDJ0Vaiqf70XKetUWY6V6T0ZSsKVGSexj9hnE24wSh twaQ== X-Gm-Message-State: AO0yUKXGccRgHWGMgfFe74+gv7874V5g8fnYvWS080/2hKOI1cVf2rRK yZa8clK7o7b/ow5FW7yOFz5tXsK6V6qLaHc/lsk= X-Google-Smtp-Source: AK7set/Vdv1jOKLaDuYcwAezydGkaR+2pwz6795XQ3G1wiPaJ4K0CWaUuEG0H88bxO1/TZ8DMB3pY/yhqkVYKPF5QuE= X-Received: by 2002:a2e:a0c5:0:b0:295:acc0:3017 with SMTP id f5-20020a2ea0c5000000b00295acc03017mr2612414ljm.4.1679532997222; Wed, 22 Mar 2023 17:56:37 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:aa6:c603:0:b0:24a:cd7e:8a3b with HTTP; Wed, 22 Mar 2023 17:56:36 -0700 (PDT) In-Reply-To: <874jqdowiz.fsf@localhost> References: <26396316-1201-4D88-9D81-C87DDDA8885A@apple.com> <874jqdowiz.fsf@localhost> From: Samuel Wales Date: Wed, 22 Mar 2023 17:56:36 -0700 Message-ID: Subject: Re: [BUG] Agenda not sorting by priority THEN todo state (todo state ignored) [9.6.1 (9.6.1-??-fe92a3c @ /Users/polofsson/.emacs.d/.local/straight/build-28.2/org/)] To: Ihor Radchenko Cc: Jonas Olofsson , emacs-orgmode@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=samologist@gmail.com; helo=mail-lj1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679533048; a=rsa-sha256; cv=none; b=tSqWhStMT5Dt4Vr+4nyqI3p6YF+PLgY+rQGYo86o40luOyC09NZ4wbdh/73MSaNN67WCj2 TmSqdcCGoRco00reR5QVPrsBn0YcdsZETap3IhpifB3IUqXE/juK/dEdcCtfJqr+ccoUxH h+4kegmcoaBX72jzPPqkr8C1oA9PVhHBBI/PynQfeYjW4DIQdQ4vejbj/G1lvkWPcMSIwY MseZ1XdVWQY1qfKUu8ps9ooTIaTIhR1F3k7J/Kv0pLWff0I6OLQOc141n1Z6fnUwMoRq7q YLU+pv1tbfYo+b4JwpK8YKsorcBtGfevhNAsAr2dpxLzs0VsoDZ2hmYQxqrXHg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=N8W6k9eb; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679533048; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=swr06GQTSw8rZts2XFfB7012ueo67q27o+bLNCnstdo=; b=jk2DfQjdsuuuWymLVVyzJ+f7tQ8KjeI2WcgzdxEF+IZeSwDjhnK5/EYPTnaNbhWBCXlLPA B4AATAcpPkqhg0XI/DJJZ9mRdcs9XsL4aqBs6RDSU7W6oTP7XEbAkwNsoQrwHGW+ZmijwJ 4xNKrJreFFWOkffs/hjRdNFNtVMp62e0wTJmSXSgBIoiV+OORGXP48VWFxCPdx5PoV6ICZ nU0n/xbdE2btHuq+xizYbGk+M2axl2QoFGWTa4bb7SCp8fj3yCShMD/SZQD67RpLN1Awl8 RmbthK0t6PjVWSueEsDl2A7UMlx23Y5VSmhLiKD7AMUE6BCRQDQNqQMo27WDnw== Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=N8W6k9eb; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -4.98 X-Spam-Score: -4.98 X-Migadu-Queue-Id: A6A0428A34 X-TUID: QnQRrojK7gra perhaps we could have 2 names: one for the priority cookie setting and one for whatever the agenda does. On 3/22/23, Ihor Radchenko wrote: > Jonas Olofsson writes: > >> I am trying to sort my agenda by a number of variables, but it seems >> that todo-state-down is not applied if added after priority-down. >> Instead it seems as if Priority first is applied, then the date the >> item is scheduled. >> >> Repro: >> 1. Set >> org-agenda-sorting-strategy >> '((agenda priority-down todo-state-down) >> (todo priority-down todo-state-down effort-up category-keep >> scheduled-up) >> (tags priority-down todo-state-down effort-up category-keep) >> (search category-keep)) >> 2. Set >> org-todo-keywords '( >> (sequence "TODO(t!)" "NEXT(n!)" "WAIT(w!)" "|" >> "DONE(d!)" "CANC(c!)" "DUPE(D!)") >> ) >> 3. Have three todos scheduled: >> >> * TODO [#C] Test >> SCHEDULED: <2023-03-16 Thu> >> * NEXT [#C] Test >> SCHEDULED: <2023-03-15 Wed> >> * WAIT [#C] Test >> SCHEDULED: <2023-03-17 Fri> >> >> 4. Go to agenda. >> >> I expect to see items in the following order, since they are the same >> priority. >> WAIT C Test >> NEXT C Test >> TODO C Test >> >> But I see: >> NEXT C Test >> TODO C Test >> WAIT C Test > > Confirmed. > > Yet another agenda madness I have no clue about. > > `org-agenda-get-scheduled' sets the priority as > > 'priority (if habitp (org-habit-get-priority habitp) > (+ 99 diff (org-get-priority item))) > > where diff is the number of overdue days for a given entry. > > Further, > > `org-agenda-get-deadlines' has > > 'priority > ;; Adjust priority to today reminders about deadlines. > ;; Overdue deadlines get the highest priority > ;; increase, then imminent deadlines and eventually > ;; more distant deadlines. > (let ((adjust (if today? (- diff) 0))) > (+ adjust (org-get-priority item))) > > `org-agenda-get-todos' has > > priority (1+ (org-get-priority txt))) > > All these dates back to the initial Org release. > > From what I am seeing, these awkward priority adjustments are hard-coded > for fine-tune agenda sorting in some (unknown) scenarios. > > Changing them will likely break existing sorting. > > To fix this, we should carefully check what will happen if we set the > agenda priority to be the actual user-defined priority. And then fix the > sorting back somehow. > > -- > Ihor Radchenko // yantar92, > Org mode contributor, > Learn more about Org mode at . > Support Org development at , > or support my work at > > -- The Kafka Pandemic A blog about science, health, human rights, and misopathy: https://thekafkapandemic.blogspot.com