From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.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 KERKEh/mGmRG/gAASxT56A (envelope-from ) for ; Wed, 22 Mar 2023 12:27:27 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id YP9SER/mGmTuVQAAG6o9tA (envelope-from ) for ; Wed, 22 Mar 2023 12:27:27 +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 936FA2DD7E for ; Wed, 22 Mar 2023 12:27:26 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=mpyLSLvx; 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"; dmarc=pass (policy=none) header.from=posteo.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1679484446; 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=daHbg5/vT7ZGeCpduE3sBSRK3AvWLF7Ch2t/4cIKWxQ=; b=Nb7YL6RgUnw7rV1Fs83+UbEr5mVsRMTdWvz88DhXi5xCPYbMX7IuqMbZKcAPg2fOoix0Hx zaTVq+fZiOQq23dyhpXx4CfpH1jN7FNgZvAcRAekEy5IhDpk0ehOIXudT5yvOLvJN41034 /5LaQb7nZ80lUsSUsDD/7+mxtt+4pSrpedI3qyXEmpVmHvLBjljuwoEysj4P1ltRFYjlMB iKpxRNJT3NMT/JwpF7mSPOB2Qou/JESx0ZjrAmO2G9+S2ce4yPL11ExiHXqx2d8vh+g31t NAIV9yYjksFU6fUdDKsSRS6libFC67PMDrmIgsAFnguAnMfHqxuCmki+13apxg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1679484446; a=rsa-sha256; cv=none; b=cNj/+H+ebXtjrsMe6UDNtbT7JRbNpWdlpQCp+Pudz/DHjkHjefI1ry8wipqbl3nBXfmBpg AHEfn5QbST3HxkeG/WSLM7DxNC1YXoYo1vOhzre5FHgliJ8gdlPqQI2Vx9M0MqAnzgDJe6 SyZCboK0RQVj3K47Ps35C51Cm6yW6ETEpYf/cHqhxPpGkHFF8tzbCcIigtFW4bYOIkLZn0 A6qO1LcT4qflMCTP8kG2Hj3y/U4rZq7ygSBwzauzI4znxKFFyrd0NDm1eA5V2LSWrg4qVV tdaskceYMC6hryY9Hi5LC80kn6g0IygBzN6zXO+AJ94FVN9GJ4T3emx68tc4PQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=mpyLSLvx; 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"; dmarc=pass (policy=none) header.from=posteo.net Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pewbz-0003GN-VV; Wed, 22 Mar 2023 07:26:36 -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 1pewbu-00031d-Kh for emacs-orgmode@gnu.org; Wed, 22 Mar 2023 07:26:33 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pewbs-0006ku-Nz for emacs-orgmode@gnu.org; Wed, 22 Mar 2023 07:26:30 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 72C6C2403D6 for ; Wed, 22 Mar 2023 12:26:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1679484386; bh=pGHcmhf0fNkTG5AnF4DhCCJ3Xo7MOla5kr2w3ZGFCbI=; h=From:To:Cc:Subject:Date:From; b=mpyLSLvxrLX/xmT9gssjiCVlyZVofKrKxGyxVynFdrxapMHAiM/gDbXGN6Pzrqaie BlX0EzthtImNP5+4jBxsVDyx+4PQdSsylCVaGMMuzKRbwuuZWD57IaWRXLqdULSpNE k8oSMK2xqANcazEaEq15rrrn07+/ofKTbTFCGexsOyLgLXf03oVkwSTavcQ1k/T0Zn lU82gHr7BgkQCPcK+kGZxbYBc+qOhN4aconMI/1rXuv20xxHGUo0PRP2CMRbOkHPfI C1/99dqdQtDV1x0d+WPbc6cG+7NMTkd2rcNpt5BO6sFrURsH2CamvNjjMFxZxYV5bo spmd0SpnFMJDg== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4PhR4Z6wkjz6trM; Wed, 22 Mar 2023 12:26:22 +0100 (CET) From: Ihor Radchenko To: Jonas Olofsson Cc: emacs-orgmode@gnu.org 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/)] In-Reply-To: <26396316-1201-4D88-9D81-C87DDDA8885A@apple.com> References: <26396316-1201-4D88-9D81-C87DDDA8885A@apple.com> Date: Wed, 22 Mar 2023 11:28:20 +0000 Message-ID: <874jqdowiz.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=yantar92@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H2=-0.001, 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: X-Migadu-Scanner: scn0.migadu.com List-Post: X-Migadu-Queue-Id: 936FA2DD7E X-Spam-Score: -6.07 X-Migadu-Spam-Score: -6.07 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 X-TUID: eY+MoaeTBqMN 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