lem icon indicating copy to clipboard operation
lem copied to clipboard

Directory Sorting Order?

Open nmccamish opened this issue 1 year ago • 8 comments

Currently, one can sort a directory by one of the three members of type sort-method, but there currently doesn't appear to be a way to sort it ascending or descending. Perhaps we could add a type, sort-direction, and implement it? It could be as simple as changing the :test from #'> to #'<.

nmccamish avatar Sep 27 '24 23:09 nmccamish

Hello, correct. I think we could have the capital S key for that.

but wait, for what exactly, let's think about usage carefully:

  • "s" sorts successfully with a different method.
  • would "S" simply invert the current order?

what about:

  • current order starts at "ascending"
  • "s" sorts
  • "S" toggles the sort order to "descending" and changes the current file order.
  • a repeated press to "S" only inverts the current file order.
  • "s" sorts with the next method, respecting the current sord order.

or is "S" better suited to sort with the previous method, and we use another key to inverse the ordering? :thinking:

what are other applications doing? (file manager or web app listing data, etc)

vindarel avatar Sep 28 '24 15:09 vindarel

In Doom Emacs, I press S (dirvish-quicksort), which pulls up a menu of options, with the lower-cased keys being one direction, and the upper-cased versions the other. Perhaps we could do something like that? Do we need a separate sorting-direction type & argument, or do we integrate that into sorting-method, or something else?

nmccamish avatar Sep 29 '24 00:09 nmccamish

I think it's a good UX.

We don't have a text-based menu of options, we could shave the yaks and create it beforehand, or in the meantime we could rely on the prompt commands (prompt-for-string etc), in order to autocomplete a choice.

vindarel avatar Sep 30 '24 12:09 vindarel

So would it be good to create a separate sorting-direction, or merge that into sorting-method like Dirvish does?

nmccamish avatar Sep 30 '24 21:09 nmccamish

@vindarel

We don't have a text-based menu of options, we could shave the yaks and create it beforehand

What do you think of this? https://github.com/lem-project/lem/blob/0f178254ea848b29d6f40403e79a8fd90419ef6f/src/ext/context-menu.lisp#L76

cxxxr avatar Oct 01 '24 03:10 cxxxr

oh indeed it is useful +1 I forgot about it, it was for the mouse in my mind.

vindarel avatar Oct 01 '24 23:10 vindarel

So would it be good to create a separate sorting-direction, or merge that into sorting-method like Dirvish does?

not 100% sure what you mean, but giving an option to the user to choose the default sorting direction is always nice.

vindarel avatar Oct 01 '24 23:10 vindarel

not 100% sure what you mean

As in, we'd have a list of sort-methods like pathname-asc (for ascending order) and pathname-desc (for descending), instead of just one pathname sort-method and a separate parameter for sorting direction.

nmccamish avatar Oct 02 '24 01:10 nmccamish