From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id aKzxJoedtV9lZQAA0tVLHw (envelope-from ) for ; Wed, 18 Nov 2020 22:17:43 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id mG86IoedtV9UVgAAB5/wlQ (envelope-from ) for ; Wed, 18 Nov 2020 22:17:43 +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 D1BD79401BF for ; Wed, 18 Nov 2020 22:17:42 +0000 (UTC) Received: from localhost ([::1]:58320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kfVll-0002Ve-S0 for larch@yhetil.org; Wed, 18 Nov 2020 17:17:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:51156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfVlP-0002VD-00 for emacs-orgmode@gnu.org; Wed, 18 Nov 2020 17:17:19 -0500 Received: from static.214.254.202.116.clients.your-server.de ([116.202.254.214]:39716 helo=ciao.gmane.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfVlN-0007uB-31 for emacs-orgmode@gnu.org; Wed, 18 Nov 2020 17:17:18 -0500 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1kfVlI-0001KL-M4 for emacs-orgmode@gnu.org; Wed, 18 Nov 2020 23:17:12 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: emacs-orgmode@gnu.org From: joakim@verona.se Subject: Re: problem with org-highest-priority Date: Wed, 18 Nov 2020 23:17:05 +0100 Message-ID: <87sg96b99a.fsf@tanaka.verona.se> References: <878sckz66g.fsf@tanaka.verona.se> <87v9fovt34.fsf@kyleam.com> Mime-Version: 1.0 Content-Type: text/plain User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cancel-Lock: sha1:+U22qisYdFweDlEdI8wlIJkobLs= Received-SPF: pass client-ip=116.202.254.214; envelope-from=geo-emacs-orgmode@m.gmane-mx.org; helo=ciao.gmane.io X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/18 13:30:54 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; 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-Spam-Score: -0.51 X-TUID: fex27SHucg0g Kyle Meyer writes: > joakim@verona.se writes: > >> This used to work: >> (defun jv-org-priorities () >> (setq org-highest-priority ?0 ;; 64 @ 48 0, bugs start happening if you have higher prios tnan 0, like '!' >> org-lowest-priority ?E ;; E >> org-default-priority ?0 ;; 0 >> org-priority-regexp ".*?\\(\\[#\\([;:<=>?@A-Z0-9]\\)\\] ?\\)" >> )) >> >> I could then have priority cookies from [#0] to [#E]. >> >> With the current org I get [#48] instead of [#0]. >> >> Is there any way to restore the previous behaviour? > > The change in behavior you describe came with 4f98694bf (Allow numeric > values for priorities, 2020-01-30). Based on quickly skimming that > commit, I think the issue boils down to intentionally not supporting a > mix of numbers and letters. I'm out of time tonight to look at it too > closely, but I think support for your use case could be restored with > something like the lightly tested patch below. Thanks, I tested your patch, and it helps a little bit. - m-x org-priority works, I can set any priority from 0 to Z - org-priority-down and org-priority-down doesn't work as expected, as they worked previously. I dont step through all the priority cookies, instead I quickly wind up in prio 0, then I'm stuck there, for lack of better description. - sorting of priorities still work with or withouth the patch, that is prio 0 is highest prio, prio Z is lowest prio. I would like to mention that in my case the characters between letters and numbers are also priority cookies, @ is a cookie as well as 0 and z. Limiting to just letters and numbers would be fine for me though, I dont use the in-between prios much. Because the sorting still works, I have been able to work around this new behaviour, by writing the cookie by hand. I'm not sure how to proceed. It seems I'm the only org-user affected by this change? Should I maintain a local patch to get the behaviour I want? What is the recomended way to do that? I usually run org-plus-contrib from elpa. > > diff --git a/lisp/org.el b/lisp/org.el > index 425e9391b..8237f39f6 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -11166,8 +11166,7 @@ (defun org-priority (&optional action show) > (unless org-priority-enable-commands > (user-error "Priority commands are disabled")) > (setq action (or action 'set)) > - (let ((nump (< org-priority-lowest 65)) > - current new news have remove) > + (let (current new news have remove) > (save-excursion > (org-back-to-heading t) > (when (looking-at org-priority-regexp) > @@ -11181,27 +11180,18 @@ (defun org-priority (&optional action show) > (integerp action)) > (if (not (eq action 'set)) > (setq new action) > - (setq > - new > - (if nump > - (string-to-number > - (read-string (format "Priority %s-%s, SPC to remove: " > - (number-to-string org-priority-highest) > - (number-to-string org-priority-lowest)))) > - (progn (message "Priority %c-%c, SPC to remove: " > - org-priority-highest org-priority-lowest) > - (save-match-data > - (setq new (read-char-exclusive))))))) > + (setq new > + (progn (message "Priority %c-%c, SPC to remove: " > + org-priority-highest org-priority-lowest) > + (save-match-data > + (setq new (read-char-exclusive)))))) > (when (and (= (upcase org-priority-highest) org-priority-highest) > (= (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)) > - (user-error > - (if nump > - "Priority must be between `%s' and `%s'" > - "Priority must be between `%c' and `%c'") > - org-priority-highest org-priority-lowest)))) > + (user-error "Priority must be between `%c' and `%c'" > + org-priority-highest org-priority-lowest)))) > ((eq action 'up) > (setq new (if have > (1- current) ; normal cycling > @@ -11235,7 +11225,7 @@ (defun org-priority (&optional action show) > (setq remove t))) > ;; Numerical priorities are limited to 64, beyond that number, > ;; assume the priority cookie is a character. > - (setq news (if (> new 64) (format "%c" new) (format "%s" new))) > + (setq news (format "%c" new)) > (if have > (if remove > (replace-match "" t t nil 1) > > -- Joakim Verona joakim@verona.se