GNU bug report logs - #60188
30.0.50; zerop cpd-length are not all handled in project--read-file-cpd-relative

Previous Next

Package: emacs;

Reported by: Shuguang Sun <shuguang79 <at> qq.com>

Date: Mon, 19 Dec 2022 05:14:01 UTC

Severity: normal

Found in version 30.0.50

Full log


View this message in rfc822 format

From: "Shuguang Sun" <shuguang79 <at> qq.com>
To: "Juri Linkov" <juri <at> linkov.net>
Cc: 60188 <60188 <at> debbugs.gnu.org>
Subject: bug#60188: 30.0.50; zerop cpd-length are not all handled inproject--read-file-cpd-relative
Date: Tue, 20 Dec 2022 07:45:50 +0800
[Message part 1 (text/plain, inline)]
In my case,&nbsp;common-parent-directory is nil.






------------------ Original ------------------

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

This bug report was last modified 2 years and 177 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.