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

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

bug#60188: 30.0.50; zerop cpd-length are not all handled in project--rea


From: Juri Linkov
Subject: bug#60188: 30.0.50; zerop cpd-length are not all handled in project--read-file-cpd-relative
Date: Mon, 19 Dec 2022 21:50:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

> When I call C-x p d (project-find-dir), it reports the error message:
> `project--read-file-cpd-relative: Wrong type argument: stringp, nil`
>
> Finaly I found it is due the the zero length of
> `common-parent-directory` in `project--read-file-cpd-relative` as I
> using `fd` to provide the list of dirs which does not include the common
> project root in the returnd dirs.
>
> In `project--read-file-cpd-relative`, the zero length of
> `common-parent-directory` is handled for `prompt` but not for `abbr-cpd`
> which will be used as parameter of `string-prefix-p`.
>
> Below is the diff and a working patch. But no sure for the impact of HIST.
>
> ```
> diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
> index 559da6dd649..8c4ea8eeca0 100644
> --- a/lisp/progmodes/project.el
> +++ b/lisp/progmodes/project.el
> @@ -1039,7 +1039,9 @@ project--read-file-cpd-relative
>           (_ (when included-cpd
>                (setq substrings (cons "./" substrings))))
>           (new-collection (project--file-completion-table substrings))
> -         (abbr-cpd (abbreviate-file-name common-parent-directory))
> +         (abbr-cpd (if (zerop cpd-length)
> +                       ""
> +                     (abbreviate-file-name common-parent-directory)))

Strange, I can't reproduce the problem.  When cpd-length is 0,
then for the empty string (abbreviate-file-name "") returns "".





reply via email to

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