emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kyle Meyer <kyle@kyleam.com>
To: Nick Dokos <ndokos@gmail.com>
Cc: emacs-orgmode@gnu.org
Subject: [PATCH] agenda: Fold case when retrieving user-configured effort values
Date: Thu, 09 Jul 2020 00:36:11 -0400	[thread overview]
Message-ID: <87d0555mpw.fsf@kyleam.com> (raw)
In-Reply-To: <87eepmkn1j.fsf@pierrot.dokosmarshall.org>

Nick Dokos writes:

> BTW, I just thought of a possible problem: the manual says that property
> keys are case-insensitive (although all the examples I can find spell
> "_ALL" in upper case, but if I write
>
>   :PROPERTIES:
>   :foo_all: bar baz
>   :END:
>
> I don't think that the code is going to handle it correctly. There
> are other places that also use "_ALL" without a let of case-fold-search
> (at least AFAICT).
>
> Am I paranoid or is this a problem?

case-fold-search is let-bound to t at the beginning of
org-buffer-property-keys, so the added string-match is covered.

When collecting keys, there's no attempt to normalize to upper or lower,
so the delete-dups call won't take care of any keys that are present in
various case styles.  I don't think that's something worth worrying
about (and perhaps it's even preferable, since we can't know which
variant the caller would want to complete).

As for other spots in the code base: looking through grep hits for
"_ALL", it seems like most should be okay because they go through
org-entry-get.  Two places in org-agenda are case-sensitive, though.

-- >8 --
Subject: [PATCH] agenda: Fold case when retrieving user-configured effort
 values

* lisp/org-agenda.el (org-agenda-filter-by-effort):
(org-agenda-filter-completion-function): Ignore case when querying
effort property key in org-global-properties since property keys are
documented as case-insensitive.
---
 lisp/org-agenda.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 90129b23e..5c2933b0a 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -7611,8 +7611,9 @@ (defun org-agenda-filter-by-effort (strip-or-accumulate)
 consistency with the other filter commands."
   (interactive "P")
   (let* ((efforts (split-string
-		   (or (cdr (assoc (concat org-effort-property "_ALL")
-				   org-global-properties))
+		   (or (cdr (assoc-string (concat org-effort-property "_ALL")
+					  org-global-properties
+					  t))
 		       "0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00")))
 	 ;; XXX: the following handles only up to 10 different
 	 ;; effort values.
@@ -7777,8 +7778,9 @@ (defun org-agenda-filter-completion-function (string _predicate &optional flag)
 			  (org-agenda-get-represented-tags))))
      ((member operator '("<" ">" "="))
       (setq table (split-string
-		   (or (cdr (assoc (concat org-effort-property "_ALL")
-				   org-global-properties))
+		   (or (cdr (assoc-string (concat org-effort-property "_ALL")
+					  org-global-properties
+					  t))
 		       "0 0:10 0:30 1:00 2:00 3:00 4:00 5:00 6:00 7:00")
 		   " +")))
      (t (setq table nil)))

base-commit: eac255d911e0793513b2e2f14b06b94194a04daf
-- 
2.26.2



  reply	other threads:[~2020-07-09  4:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-07  2:01 [PATCH] org: add property names from #+PROPERTY keywords to completion list Nick Dokos
2020-07-07  2:40 ` Nick Dokos
2020-07-07  4:23 ` Kyle Meyer
2020-07-07 12:44   ` Nick Dokos
2020-07-07 13:38   ` Nick Dokos
2020-07-07 16:48   ` Nick Dokos
2020-07-08  3:52     ` Kyle Meyer
2020-07-08 15:47       ` Nick Dokos
2020-07-08 16:07       ` Nick Dokos
2020-07-09  4:36         ` Kyle Meyer [this message]
2020-07-09  7:50           ` [PATCH] agenda: Fold case when retrieving user-configured effort values Nick Dokos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d0555mpw.fsf@kyleam.com \
    --to=kyle@kyleam.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=ndokos@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).