#+BEGIN_SRC emacs-lisp :results value list
(sort '("foo*" "foo-bar" "foo?")
'string<)
#+END_SRC
#+RESULTS:
- foo*
- foo-bar
- foo?
#+BEGIN_SRC emacs-lisp :results value list
(sort '("foo*" "foobar" "foo?")
'string<)
#+END_SRC
#+RESULTS:
- foo*
- foo?
- foobar
2. completion-at-point 内部的二次排序:
completion-at-point
-> completion-in-region
--> completion--in-region
---> completion--in-region-1
----> completion--do-completion
-----> minibuffer-completion-help
(setq completions
;; FIXME: This function is for the output of all-completions,
;; not completion-all-completions. Often it's the same, but
;; not always.
(let ((sort-fun (completion-metadata-get
all-md 'display-sort-function)))
(if sort-fun
(funcall sort-fun completions)
(sort completions 'string-lessp))))