1

In general, Icicles sorts things in alphabetical order. However, something I can’t find has made it so filenames are sorted in descending alphabetical order (z, y, x … b, a). I can use C-M-, to reverse it so it’s in ascending order. On the other hand, if I hit C-,, it says (NOW: alphabetical); if I then select alphabetical, it changes to the correct order. The value of icicle-sort-comparer is icicle-case-string-less-p. My custom.el doesn’t contain any variables whose names include icicle.

I’m using commit 9e9c37d from the GitHub mirror right now, but I’ve been seeing this for a while now, just wasn’t thinking about it.

How can I make it so Icicles sorts filenames (e.g. in icicle-find-file) in ascending alphabetical order by default?

1

Updating this to provide the short answer, after email exchange:

Set user option icicle-file-sort to the sort order you want, e.g., icicle-case-string-less-p.

(Leaving the rest of the original response, below, in case it helps someone.)


I'm not sure what's going on, so this isn't much of an "answer", so far. You can follow up by email if this becomes a back-and-forth (not good for emacs.SE) - use M-x icicle-send-bug-report for that. That's probably the best recourse. (You might want to start with that, and ultimately delete the question here or add an answer.)

It's presumably not important, but I guess you have some custom key bindings, because neither C-M-` nor C-` is bound by Icicles by default. It sounds like you've maybe bound C-` to icicle-change-sort-order (which is C-, by default). I guess you did that by customizing icicle-completion-key-bindings. But you say that you have no customizations (no occurrences of icicle in your custom-file). So this is one thing that's unclear to me.

Do I understand the problem correctly to be this?

  • By default, when using icicle-find-file (for example), Icicles tells you that sorting is alphabetical, but the order is z-to-a, not a-to-z. Does this happen also for other completion, besides file-name completion?

  • If you then use icicle-change-sort-order (C-, by default) during completion, to change the order, and you pick alphabetical, the problem is corrected (sorting becomes a-to-z). Does it then stay corrected, so that the next time you use icicle-find-file (or another completing command) the order is a-to-z?

Here are some things to check:

  • Can you reproduce the problem if you start Emacs using emacs -Q (no init file, so no use of custom-file)? If so, please send a recipe to reproduce the problem: M-x icicle-send-bug-report.

  • If not, start by bisecting your init file (which might then mean bisecting custom-file), to find what is creating the problem.

  • Is either icicle-reverse-sort-p or icicle-reverse-multi-sort-p non-nil? (If so, what is it?) If so, try resetting it to its initial value of nil, and see if you can find out where it gets set to non-nil (starting with your init file).

  • The value of option icicle-sort-orders-alist. You can modify it, but see the doc string. This is the default value, after you've loaded Icicles (it's not the value shown in the defcustom, which is nil):

    (("turned OFF")
     ("by abbrev frequency" . icicle-command-abbrev-used-more-p)
     ("by previous use alphabetically" . icicle-historical-alphabetic-p)
     ("by last use as input" . icicle-latest-input-first-p)
     ("by directories last" . icicle-dirs-last-p)
     ("by directories first" . icicle-dirs-first-p)
     ("by last use, dirs first" . icicle-dirs-and-latest-use-first-p)
     ("by file type" . icicle-file-type-less-p)
     ("by last file modification time" . icicle-latest-modification-first-p)
     ("by last file access time" . icicle-latest-access-first-p)
     ("by last use" . icicle-latest-use-first-p)
     ("by 2nd parts alphabetically" . icicle-2nd-part-string-less-p)
     ("case insensitive" . icicle-case-insensitive-string-less-p)
     ("proxy candidates first" . icicle-proxy-candidate-first-p)
     ("extra candidates first" . icicle-extra-candidates-first-p)
     ("special candidates first" . icicle-special-candidates-first-p)
     ("by flx score" . icicle-flx-score-greater-p)
     ("alphabetical" . icicle-case-string-less-p))

HTH. Sorry for the trouble.

| improve this answer | |
  • My apologies, I am using the default keybindings but for some reason I went to great lengths to put backticks in the question. 🤦‍♂️ You’ve correctly understood the problem. This only happens for file-name completion. Picking alphabetical doesn’t fix the order for future invocations. The icicle-reverse… variables you mentioned are nil. I’ll try your suggestions. And thank you for writing a really great library in the first place! – Aankhen Dec 8 '19 at 8:38
  • Good. Please follow up with M-x icicle-send-bug-report, providing a recipe, preferably starting from emacs -Q, if you don't find the answer easily. I can't repro it, so far. – Drew Dec 8 '19 at 17:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.