lem-project / lem

Common Lisp editor/IDE with high expansibility
http://lem-project.github.io/
MIT License
2.39k stars 177 forks source link

Directory Sorting Order? #1546

Open nmccamish opened 1 month ago

nmccamish commented 1 month ago

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 #'<.

vindarel commented 1 month ago

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

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

what about:

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)

nmccamish commented 1 month ago

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?

vindarel commented 1 month ago

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.

nmccamish commented 1 month ago

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

cxxxr commented 1 month ago

@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

vindarel commented 1 month ago

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

vindarel commented 1 month ago

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.

nmccamish commented 1 month ago

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.