emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] org-sort: Read compare-func in interactive calls


From: Kyle Meyer
Subject: Re: [O] [PATCH] org-sort: Read compare-func in interactive calls
Date: Thu, 11 May 2017 21:48:37 -0400

Nicolas Goaziou <address@hidden> writes:

>> * lisp/org-list.el (org-sort-list): Read COMPARE-FUNC when called
>> interactively rather than being restricted to the default behavior of
>> sort-subr's PREDICATE parameter.  Guard prompts for GETKEY-FUNC and
>> COMPARE-FUNCTION with called-interactively-p, like
>> org-table-sort-lines already did for GETKEY-FUNC.
>
> Thank you. I have but one comment.

Thanks for taking a look.

>> +     (sort-func
>> +      (cond
>> +       ((= dcst ?a) #'string<)
>> +       ((= dcst ?f)
>> +        (or compare-func
>> +            (and (called-interactively-p 'any)
>
> The above should be avoided. See `called-interactively-p' docstring. The
> same applies in other places.

Yeah, in order to make org-sort-entries, org-sort-list, and
org-table-sort-lines behave the same way with respect to how they read
getkey-func and compare-func, I ignored the warning in
called-interactively-p's docstring that says it can be "brittle" if a
function is advised or being debugged.

Instead of adding called-interactively-p to org-sort-entries and
org-sort-list, I initially looked at removing called-interactively-p
from org-table-sort-lines, but I think that would 1) require changing
its behavior for determining the sorting column, and 2) going against
org-table-sort-lines's docstring that says no prompting will take place
if called from Lisp.

So I'm fine removing called-interactively-p from org-table-sort-lines,
but I'm not sure how it should behave, particularly with respect to the
column prompt.

Thoughts?

-- 
Kyle



reply via email to

[Prev in Thread] Current Thread [Next in Thread]