I am trying to sort a sub-tree of headings randomly. But `C-c ^ f random RET` asks for a "function for comparing keys". What am I supposed to do? Reference: https://lists.gnu.org/archive/html/emacs-orgmode/2011-02/msg00089.html I have also tried the custom function proposed in the previous mail in this thread (which was also proposed on another thread) but I face the same problem with this as well. Thanks for help. Vikas
On 11/22/21 07:40:35 +0530, Vikas Rawal wrote:
> I am trying to sort a sub-tree of headings randomly. But `C-c ^ f
> random RET` asks for a "function for comparing keys". What am I
> supposed to do?
Here's the prompt:
Function for comparing keys (empty for default `sort-subr' predicate):
And here's what sort-subr's docstring says about the behavior of the
default predicate:
If PREDICATE is nil, comparison is done with ‘<’ if
the keys are numbers, with ‘compare-buffer-substrings’ if the
keys are cons cells (the car and cdr of each cons cell are taken
as start and end positions), and with ‘string<’ otherwise.
That sounds like that should handle random's return value fine, so try
entering an empty string at that prompt.
(Please don't drop the list.) Vikas Rawal writes: > That is, just press RET? I think that depends on the completion framework. With the default completion, yes, I think RET should do it. With ivy, it's instead ivy-immediate-done (C-M-j). I'm not sure offhand about other frameworks. > If I do that, it just reverses the existing order. No randomisation > happens. Dunno. Seems to work on my end (release_9.5.1-188-g27f26f782). * h ** a ** b ** c ** d ** e ** f ** g ** h ** i ** j ** k ** l With point on h and vanilla Emacs: - C-c ^ f - random - RET * h ** f ** e ** h ** i ** g ** j ** k ** b ** c ** d ** a ** l
[-- Attachment #1: Type: text/plain, Size: 486 bytes --] > > > I think that depends on the completion framework. With the default > completion, yes, I think RET should do it. With ivy, it's instead > ivy-immediate-done (C-M-j). I'm not sure offhand about other > frameworks. > > That's what it needed. Thanks. I wonder if there would be a better way to document this somewhere so that people using different completion frameworks could figure out how to do it. It seems to be something that would be useful to others. Thanks again Vikas [-- Attachment #2: Type: text/html, Size: 826 bytes --]
if random sorting of siblings is useful, another entry in the sorting menu, dedicated to it, would eliminate any issues with completion. it is a clever idea to feed random to sort by function. maybe some won't catch the connection. just a possibility. not trying to bloat. On 11/23/21, Vikas Rawal <vikaslists@agrarianresearch.org> wrote: >> >> >> I think that depends on the completion framework. With the default >> completion, yes, I think RET should do it. With ivy, it's instead >> ivy-immediate-done (C-M-j). I'm not sure offhand about other >> frameworks. >> >> > That's what it needed. Thanks. > > I wonder if there would be a better way to document this somewhere so that > people using different completion frameworks could figure out how to do it. > It seems to be something that would be useful to others. > > Thanks again > > Vikas > -- The Kafka Pandemic Please learn what misopathy is. https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html
i have found or would find random line within buffer or region to be useful, and also random entry in org agenda files. i'd find this useful too, but i think i'd find it more useful to keep the ordering the same but instead go to a random entry within region. On 11/23/21, Samuel Wales <samologist@gmail.com> wrote: > if random sorting of siblings is useful, another entry in the sorting > menu, dedicated to it, would eliminate any issues with completion. > > it is a clever idea to feed random to sort by function. maybe some > won't catch the connection. just a possibility. not trying to bloat. > > On 11/23/21, Vikas Rawal <vikaslists@agrarianresearch.org> wrote: >>> >>> >>> I think that depends on the completion framework. With the default >>> completion, yes, I think RET should do it. With ivy, it's instead >>> ivy-immediate-done (C-M-j). I'm not sure offhand about other >>> frameworks. >>> >>> >> That's what it needed. Thanks. >> >> I wonder if there would be a better way to document this somewhere so >> that >> people using different completion frameworks could figure out how to do >> it. >> It seems to be something that would be useful to others. >> >> Thanks again >> >> Vikas >> > > > -- > The Kafka Pandemic > > Please learn what misopathy is. > https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html > -- The Kafka Pandemic Please learn what misopathy is. https://thekafkapandemic.blogspot.com/2013/10/why-some-diseases-are-wronged.html