[Top][All Lists]

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

bug#14061: 24.3.50; Globbing in completion not working correctly

From: Michael Heerdegen
Subject: bug#14061: 24.3.50; Globbing in completion not working correctly
Date: Wed, 27 Mar 2013 03:49:38 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Michael Heerdegen <address@hidden> writes:

> >    C-h v *compil*warn* TAB TAB
> >
> > "byte-compile-warnings" should be among the matches, but that's not
> > the case.
> Looks like `completion-pcm--merge-completions' is introducing the error:
> (completion-pcm--merge-completions
>  '("byte-compile-error-on-warn"
>    "byte-compile-warning-types"
>    "byte-compile-warnings"
>    "byte-compile-last-warned-form")
>  '(star "compil" star "warn"))
> ==>
> (any "warn" "-" star "compile-" "byte-")

Some more thoughts:

In the definition of `completion-pcm--merge-completions', we have

  (when (memq elem '(star point prefix))
    ;; Extract common suffix additionally to common prefix.
    ;; Only do it for `point', `star', and `prefix' since for
    ;; `any' it could lead to a merged completion that
    ;; doesn't itself match the candidates.
    (let ((suffix (completion--common-suffix comps)))
      (cl-assert (stringp suffix))
      (unless (equal suffix "")
        (push suffix res))))

In the pathological cases, the `suffix' includes a hyphen that is
already included in the prefix:

   '(star "compil" star "warn"))       ;; suffix == "-"

   '(star "compile" star "types"))     ;; suffix == "-warning-"

but not all cases where `suffix' starts with "-" are problematic:

   '(star "compile" star "types"))

so it would be wrong to remove a leading "-" from `suffix'

Dunno what a good fix would look like.  It tried

  (let* ((pre-length (length prefix))
         (suffix (completion--common-suffix
                  (mapcar (lambda (comp) (substring comp pre-length))
    (cl-assert (stringp suffix))
    (unless (equal suffix "")
      (push suffix res)))

which seems to work, but my insight in this code is limited.



reply via email to

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