From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: [PATCH] agenda: Fold case when retrieving user-configured effort values
Date: Thu, 09 Jul 2020 03:50:39 -0400 [thread overview]
Message-ID: <87a709ktyo.fsf@pierrot.dokosmarshall.org> (raw)
In-Reply-To: 87d0555mpw.fsf@kyleam.com
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
prev parent reply other threads:[~2020-07-09 7:51 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 ` [PATCH] agenda: Fold case when retrieving user-configured effort values Kyle Meyer
2020-07-09 7:50 ` Nick Dokos [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a709ktyo.fsf@pierrot.dokosmarshall.org \
--to=ndokos@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.