help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Sorting Order of Completion Candidates


From: Florian Beck
Subject: Re: Sorting Order of Completion Candidates
Date: Tue, 01 Mar 2011 11:59:09 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7

On 03/01/2011 02:25 AM, Drew Adams wrote:
While writing some code to index my notes I have run into a problem.
I have a carefully crafted list of keywords sorted in order of
frequency. (When assigning new keywords I want to consider the most
frequent keywords first.) However
(completing-read "Prompt: " '("a" "c" "b"))  gives me

  Possible completions are:
  a
  b
  c

whereas I want

  Possible completions are:
  a
  c
  b

If there is no option or hook, if guess I could just modify the
*Completions* buffer. Any hints how/where it is set up?

1. Stefan can probably steer you as to how to do what you want with a recent
version of vanilla Emacs.

I ended up modifying `minibuffer-completion-help'. There doesn't seem to be a way around that.

2. An alternative is to use Icicles.  Then all you need to do is bind
`icicle-sort-comparer' to nil around the call to `completing-read'.  A nil value
means do not sort.  (You can also customize `icicle-sort-comparer' to use any
default sort order you like.)

Thanks, I will look into that. Or do you replace the whole completion mechanism?

--
Florian Beck



reply via email to

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