[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] agenda: Fold case when retrieving user-configured effort val
From: |
Nick Dokos |
Subject: |
Re: [PATCH] agenda: Fold case when retrieving user-configured effort values |
Date: |
Thu, 09 Jul 2020 03:50:39 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Kyle Meyer <kyle@kyleam.com> writes:
> 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.
>
Wow - not only paranoid but blind as well.
> 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
Thanks! LGTM.
--
Nick