From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id uPl4FosoEWH86AAAgWs5BA (envelope-from ) for ; Mon, 09 Aug 2021 15:07:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id mElNEosoEWF4VQAA1q6Kng (envelope-from ) for ; Mon, 09 Aug 2021 13:07:23 +0000 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 93B9C1F260 for ; Mon, 9 Aug 2021 15:07:22 +0200 (CEST) Received: from localhost ([::1]:40526 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mD4zw-0007rK-N4 for larch@yhetil.org; Mon, 09 Aug 2021 09:07:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mD4zU-0007ps-6h for emacs-orgmode@gnu.org; Mon, 09 Aug 2021 09:06:52 -0400 Received: from box.hyperreal.enterprises ([85.159.211.210]:56783) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mD4zS-0006dv-42 for emacs-orgmode@gnu.org; Mon, 09 Aug 2021 09:06:52 -0400 Received: from authenticated-user (box.hyperreal.enterprises [85.159.211.210]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by box.hyperreal.enterprises (Postfix) with ESMTPSA id 711B544CF9 for ; Mon, 9 Aug 2021 14:06:45 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=hyperreal.enterprises; s=mail; t=1628514405; bh=eF8/vIsOzXPY6yVIJJkAEPpoe/BbE1SEdy5pbX0CtIw=; h=From:To:Subject:Date:From; b=fKkzEJOcj3/850Jopu002wctx8aYeYWlsMpZjPcJFdZkAs+4F3hzQ6gLap9bkpW7B O0tCsT3YQocGPFuZq6FcXneE2zP1lmLruVSAOmmKRg6k8cIQWUmt3zhr48bTzaeLhq Hsh2GqEddpRtXjTXipHTpiMYX6udGFV9Ti9JV8DJlka/fvso8l3KQ2i6ifvP38bZXz hFSoOpk89mcl7PL2HAk72FmuIgCikD1Um5xAmd/H5J5sqtdEydW7bpay60hy1LhX5D zHRRv00wj2J5zsBj+EK4n3iyKN87YwEeoKodVtWpBju+DMlJn4xb07tSlCNKU+D0kw A+x78KgCS8YWg== To: emacs-orgmode@gnu.org Subject: [patch] priorities range reversed Date: Mon, 09 Aug 2021 14:06:43 +0100 Message-ID: <87v94ewyvw.fsf@Proteus> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=85.159.211.210; envelope-from=joseph.corneli.orgmode@hyperreal.enterprises; helo=box.hyperreal.enterprises 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, SPF_HELO_PASS=-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.23 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" Reply-to: Joe Corneli From: Joe Corneli via "General discussions about Org-mode." X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1628514442; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=mw05wUo5U2zXssSRYAyhzQ2W8D7pq9/KUtuoomutQLI=; b=gHDECuPKQ9B0R2JcfNQ8qXnjGgJFALiAKPowQ5ca3wpDihZgBHG3lY1Gj5769FVeSGn10S 4eQ1Ig6Evyg2+sTONgRw4vWceXQakEFUzjdv2gUA7+dfGxFVSIQr3lYJ9+igedcmEXEk/P TnL7rlv+d/wEAjQ0ePVJ2jTavZFHomSgL+WHeAUmYUhnbLM3ty5efI96fFU8SrL2Axff2t uNn1cakPFU3frOQeepIojorhhcA3MPP+Kj6aaBWvhnNn3L8SZRH9n4FpD02Lieg9dBaOn5 CssPG9ueewQFueINsr1o0IcyiiwRMO+ekIugbLJHuwZugxR3Z0OZwZU5nYLDzg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628514442; a=rsa-sha256; cv=none; b=ix8o2s3A8fjjio+NZ3qqE6yKWDY6QU/fkpBUic8wuihBlZun1dqSe3zYAtI/w82N7zZWX6 OAfxz5SJP9fSVATiVlDGoGNpih2mizeX6RSzMLNJ6XG5Ncm56RGdBiRQPvgVMiHYXWxerw Tjx2ZCzMXog29e/T4nbedTKR4F0ONE3nylRVvwIpwFJGtcSpJuu8hdRWXOvFcAGR8DIZVC JFzlmNpxF+F+5NUZFKSX+J0yhRfE/UPUN6aSlUtYKOL0kx6gs3T7roBWh6dUUQHOlEs0IG DV0uBD8/Pu0rT1Nk39n38lGTlDcYZi5kCH23nVmx7NQAepzOjBydTuZlTvG6SQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=hyperreal.enterprises header.s=mail header.b=fKkzEJOc; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.41 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=hyperreal.enterprises header.s=mail header.b=fKkzEJOc; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 93B9C1F260 X-Spam-Score: -2.41 X-Migadu-Scanner: scn0.migadu.com X-TUID: Czokllwm3JFO --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable In the case of numeric priorities [#1] [#9] and so on, there is a test that is reversed in org.el. This appears twice with a slight variation. ;; Are we are less than the highest or greater than the lowest? (or (< (upcase new) org-priority-highest) (> (upcase new) org-priority-lowest)) The test is, in itself (and in principle) just fine. The problem is that it then triggers an error, which is exactly the opposite of what=E2=80= =99s wanted! The attached patch reverses the test so that we enter the error case when the priority is *outside* of the range of acceptable priority tags. Here=E2=80=99s some test data for reproducing the problem and testing the solution (with the patch applied). Evaluate: (setq org-default-priority 2) (setq org-highest-priority 9) (setq org-lowest-priority 1) * This is a test (Run M-x org-priority RET on the above line.) --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=priorities_reversed.patch diff --git a/lisp/org.el b/lisp/org.el index ce68f4692..bd6fd3146 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11337,7 +11337,7 @@ or a character." (= (upcase org-priority-lowest) org-priority-lowest)) (setq new (upcase new))) (cond ((equal new ?\s) (setq remove t)) - ((or (< (upcase new) org-priority-highest) (> (upcase new) org-priority-lowest)) + ((or (> (upcase new) org-priority-highest) (< (upcase new) org-priority-lowest)) (user-error (if nump "Priority must be between `%s' and `%s'" @@ -11364,8 +11364,8 @@ or a character." org-priority-default (1+ org-priority-default)))))) (t (user-error "Invalid action"))) - (when (or (< (upcase new) org-priority-highest) - (> (upcase new) org-priority-lowest)) + (when (or (> (upcase new) org-priority-highest) + (< (upcase new) org-priority-lowest)) (if (and (memq action '(up down)) (not have) (not (eq last-command this-command))) ;; `new' is from default priority --=-=-= Content-Type: text/plain -- Dr Joseph A. Corneli (https://github.com/holtzermann17) HYPERREAL ENTERPRISES LTD is a private company limited by shares, incorporated 25th, June 2019 as Company Number 634284 on the Register of Companies for Scotland (https://beta.companieshouse.gov.uk/company/SC634284). --=-=-=--