+(defun minibuffer--sort-preprocess-history (start string)
+ "Preprocess history, remove completion prefixes.
+STRING is the minibuffer content.
+START is the start position of the completion."
+ (let* ((def (car-safe minibuffer-default))
+ (hist (symbol-value minibuffer-history-variable))
+ (hist (if def (cons def hist) hist))
+ (bounds (completion-boundaries
+ (substring string 0 (- (point) start))
+ minibuffer-completion-table
+ minibuffer-completion-predicate
+ ""))
Actually, the caller has the info we need already in the (cdr last),
which it throws away in:
(when last
(setcdr last nil)
This info also has the advantage of working with partial-completion
because it comes from the completion-style output rather than from the
completion-table.
+ (pre (substring string 0 (car bounds)))
+ (pre-len (length pre)))
+ ;; Preprocess history if completion boundaries are used
+ (cond
+ ;; Special handling of file name candidates.
+ ;; Drop prefix and everything after the first "/".
+ (minibuffer-completing-file-name
I hope that using (cdr last) will make it unnecessary to use such a hack.
If not, then please try and use the `category` from `md` rather than
`minibuffer-completing-file-name` which I consider as obsolete (tho it's
not marked as such yet).