auctex-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Better sorting for TeX-symbol-list


From: Arash Esbati
Subject: Re: Better sorting for TeX-symbol-list
Date: Sat, 11 Jun 2022 17:42:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50

Hi Gustavo,

Gustavo Barros <gusbrs.2016@gmail.com> writes:

> `TeX-symbol-list' is sorted by AUCTeX using `TeX-car-string-lessp'
> which uses internally `string-lessp'.  However, `string-lessp' sorts
> all entries starting with an uppercase letter, in a block, before the
> ones starting with a lowercase one.  This is not really ideal for
> `TeX-symbol-list', given some traditional naming conventions of
> LaTeX. First, lowercase macros tend to be user facing more frequently
> used ones, so it would make sense they were sorted first.

I'm not sure if I understand your suggestion correctly since I don't
think that the return value of the function `TeX-symbol-list' is to be
exposed to users directly.

> Second the common idiom of `\macro', with a `\Macro' version for start
> of sentence use, also does not work that well. Again, `\macro' is
> probably used more frequently.  Furthermore, ideally these two should
> be next to each other on the list, and they are currently far
> apart.

Again, why should we care from a user perspective?

For me, it is a task for the completion system to respect or ignore the
case and/or sort the candidates.  Maybe you just want to adjust the
variable `completions-sort'.  Example:

(let ((completions-sort (lambda (list)
                          (sort list #'string-collate-lessp))))
  (completing-read "Macro: "
                   '("declare"
                     "declarefoo"
                     "Declare"
                     "DeclareRobustCommand")))

Is this what you're looking after?

> Considering the popularity of vertical completion systems and the
> common use of case-fold this complicates unnecessarily the task.

Things get even more complicated when you're using vertico for example
which also cater for history and length of candidates.  So again, I
don't think the sorting of the candidates input is relevant.

Best, Arash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]