Skip to content

Configure what extra prompts denote-sort-dired issues

By default, the denote-sort-dired command prompts for (i) a query to match file names, (ii) a file name component to sort by, and (iii) whether to reverse the sorting (Display filtered and sorted files with denote-sort-dired). Users can configure the latter two by modifying the user option denote-sort-dired-extra-prompts.

The denote-sort-dired-extra-prompts accepts either a nil value or a list of symbols among sort-by-component, reverse-sort, and exclude-regexp. The order those symbols appear in the list is significant, with the leftmost coming first.

These symbols correspond to the following:

  • A choice to select the file name component to sort by.
  • A yes or no prompt on whether to reverse the sorting.
  • A string (or regular expression) of files to be excluded from the results.

In case of a nil value, those extra prompts will not happen, meaning that denote-sort-dired will fall back to using whatever is defined in the variables denote-sort-dired-default-sort-component and denote-sort-dired-default-reverse-sort.

Here are some examples:

emacs-lisp
;; The default extra prompts...
(setq denote-sort-dired-extra-prompts '(sort-by-component reverse-sort))

;; When using `denote-sort-dired', ask whether to reverse the sort and
;; then which file name component to sort by.  These are always done
;; after the prompt to search for files matching a regexp.
(setq denote-sort-dired-extra-prompts '(reverse-sort sort-by-component))

;; Do not prompt for a reverse sort.  Just use the value of
;; `denote-sort-dired-default-reverse-sort' (which is nil out-of-the-box).
(setq denote-sort-dired-extra-prompts '(sort-by-component))

;; Do not issue any extra prompts.  Always sort by the `title' file
;; name component and never do a reverse sort.
(setq denote-sort-dired-extra-prompts nil)
(setq denote-sort-dired-default-sort-component 'title)
(setq denote-sort-dired-default-reverse-sort nil)