From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id GGucF1HvC2dobAAAqHPOHw:P1 (envelope-from ) for ; Sun, 13 Oct 2024 16:03:29 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id GGucF1HvC2dobAAAqHPOHw (envelope-from ) for ; Sun, 13 Oct 2024 18:03:29 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gER05unQ; 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=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1728835409; h=from:from:sender:sender: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=ZSWD2iFhoQb1/lr9F4AqoQU02OBgipJl1Gjp9PuUWh4=; b=pSZSAyUveOQ7pnVv53Jn/6JP94Sohw/YIoKGhzBGzbaRr+cV6widx7sNTPfKU79lF678i7 pXplMEfzq75MDLEN/pX1oLnViEaufgCV7wDOJsJ+ftcvWP5jDpUYDCznOpo8lIZZort66p Enb7N56tQ5cWVnEjR6/reyp1V/i7cOadFbBMuh8yZhPkW9qkPSzkXsQU3hEXUTPeI3I4Cy lHnTSOWQYyxQDAwpRBMr1qVLG1uoSw21gEnNdbs3hYcAwg/JIWpz2ycTed0EQzorLKD/z9 EnGLScSk2rzfTmh2VjVqcsBQcnk/r7L+U0QAH/iMprFaC6wjjYnbm7F//EsFSA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1728835409; a=rsa-sha256; cv=none; b=eg9tr6sBL2TZT+wHnmXvv8YQCkWlICS7hST1+u28rmi9iVQu15JpofimecnD1N5t7ATigY KqPMAJzH9NO+qLl16fHxXdD6/GMwlGf+6ClMiz6PwmxF/yGxC1QckSKZWeK0tFdB34dJda mL1O2UD49zfXbpgPT1j236De6wSzYEuTsDzgkloUOKp3N+/NZwHkLHyuaPqVBe/RObeTrQ jkSEj0QO+FMcpKVs7Ej0AtcoMk4PFSiANe6jSbQ2SjoX/K7+MpoRiGdM/XGw8ksFoa0724 IJdWF9Hkxzjcx04I2xWcadUfpDT/FNcrMDdlTXcRiBhUCosK0M7wf6/AWgZlGw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=gER05unQ; 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=gmail.com 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 1382355118 for ; Sun, 13 Oct 2024 18:03:29 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t013L-0006x3-LN; Sun, 13 Oct 2024 12:02:44 -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 1t012x-0006mv-Ek for emacs-orgmode@gnu.org; Sun, 13 Oct 2024 12:02:21 -0400 Received: from mail-qt1-x833.google.com ([2607:f8b0:4864:20::833]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t012u-0003QX-JN for emacs-orgmode@gnu.org; Sun, 13 Oct 2024 12:02:19 -0400 Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-4604bd47e35so10718391cf.0 for ; Sun, 13 Oct 2024 09:02:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728835335; x=1729440135; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=ZSWD2iFhoQb1/lr9F4AqoQU02OBgipJl1Gjp9PuUWh4=; b=gER05unQnUOpr73Q67tkEiHKzi5TxKqTwblUWZKwsneMVwBZWY+/H8fDcrioSWud6x 4LgOo0WySsL5LCiZQlPvpg97fLqL0u7OYP6bh3pZysyBruUmlCs0i/+qvzDrjailxNpC 1iXY6v/cBydcSKK7J3Hk+Rclipu/vJAgX/pgDv2C5sSZWiJz1GPpaPXYtDXKSxrqIbKK SoGtovhRpWvcefPkef7HRupe4afFaWYjZdLasJRNMP/MDL6jbL1iu+1/FfqAvUerYw9I s1z7SlcS+AzGHDsZIWSvz2Fu9WpCIRvSW9EzxJAuHtq9mxYc+6zIHGjypjpdOd/EyHi4 S0Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728835335; x=1729440135; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ZSWD2iFhoQb1/lr9F4AqoQU02OBgipJl1Gjp9PuUWh4=; b=fee8OVYkZfcMf7jggGhlmzyi7sqWbm6Gqtj2yIKcukKj0U/LgJepL8E4aDlKl0kQSA MR1zYFNy4gjoX7eFy7yZLTX+wLwSu1jP1Aq71//lm7hCKgMMfenbfWropnq2fq9cWOva 9zzn73IKZu7Xv/o/JB2T6WneqTcteBjS+ojN4j1PiN8lgtJfvZ78qwRjdhc6yOOefTLc QAuoAFXcVLnkcslVH8SNLiXlP4YFFrYflzYFvTslSyh9COfOBoDCVObUVip6CSsOIzv9 DJSbt59pjZoVu3pOJSqKz3DlQV7cyqWj3N+mHmE4r73aIOwXBQ2o3gNQwI/dc3Eqkg97 SCJw== X-Gm-Message-State: AOJu0YwCk+y2vWQGtW8hfVJCrAfNRMHNp6HxvAVaayR080Zug/uVxcf1 yIT3NY4Xma1gNt0f2O3xk82gyfD9IGHCR/v5fkH/Rz3Dg4rNBM4Uligk4aejTRNmc2HlRwQPBc8 nbzOQwu8bn4plE5tsskUby0yJ29dcMqHc X-Google-Smtp-Source: AGHT+IEOwNIye4Kr4/fkLxtl9E+Dd/zjDL6Hwz0U9yYW9/gBrLpBcCQ+PGxIAK3GYEAAT43D5edKFOsxvdggo1vTi4U= X-Received: by 2002:a05:622a:5407:b0:460:3a58:d073 with SMTP id d75a77b69052e-4604bc545a9mr162335281cf.54.1728835335269; Sun, 13 Oct 2024 09:02:15 -0700 (PDT) MIME-Version: 1.0 From: Tommy Jollyboat Date: Sun, 13 Oct 2024 17:02:04 +0100 Message-ID: Subject: [BUG] Numeric priorities only partially supported To: emacs-orgmode@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::833; envelope-from=jollyboatbros@gmail.com; helo=mail-qt1-x833.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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -4.90 X-Spam-Score: -4.90 X-Migadu-Queue-Id: 1382355118 X-Migadu-Scanner: mx13.migadu.com X-TUID: df2/9U3eHcs9 (tested with Org 9.7.11, I've done my best to search archives and the bug-tracker) Back in 2020, commit #4f98694bf introduced numeric priorities, allowing [#1] to [#64] as an alternative to [#A] to [#Z]. This is also documented in the manual. https://git.savannah.gnu.org/cgit/emacs/org-mode.git/commit/?id=4f98694bf https://orgmode.org/manual/Priorities.html It introduced the new function ~org-priority-to-value~, which replaces ~string-to-char~ for parsing priority strings. It parses numeric prios as ints (1..64) and alphabetic prios as chars (?A..?Z, which is 65-90). * PROBLEM However, various functions within org-mode are still using ~string-to-char~ and giving inconsistent results, because numerical priorities are parsed wrongly, or sometimes return nil (or #10 to #64). * EXAMPLES With the following heading tree: * test tree ** [#10] ten ** [#2] two You can get the correct values 10 and 2 with: (org-priority-to-value (thing-at-point 'line)) You can get incorrect values nil and ?2 with: (org-element-property :priority (org-element-at-point)) or (nth 3 (org-heading-components)) And if you sort the test tree by priority (with org-sort-entries, "p"), it won't change, because [#10] is wrongly interpreted as if it were [#1]. * SOLUTION If we agree that numeric priorities should be supported everywhere, various functions need updating: Functions that use string-to-char to parse: - org-entry-put - org-mobile-edit (in org-mobile.el) - org-agenda-fontify-priorities (org-agenda.el) - org-mouse-context-menu (org-mouse.el) I've confirmed that org-entry-put exhibits wrong behaviour (parsing 1-9 as ?1-?9 and 10-64 as nil). I'm not familiar with the others, as they're in modules I don't use. The Org Element API also needs updating: - ~org-element--headline-parse-title~ implements its own org-priority-regexp, which doesn't account for multiple characters - ~org-entry-put~ has bugs, but I don't understand the code well enough - A couple of functions format priorities as "[#%c]", and should include a %s case for values under 65. These should all be fairly safe/uncontroversial changes to make, as any documents that are impacted were relying on undefined behavior (such as using chars outside of the range A-Z as priorities). Hope that's all clear! Sorry it's a bit of an essay.