From: Shuguang Sun via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: 60188@debbugs.gnu.org
Subject: bug#60188: 30.0.50; zerop cpd-length are not all handled in project--read-file-cpd-relative
Date: Wed, 21 Dec 2022 16:48:37 +0800 [thread overview]
Message-ID: <tencent_27148E8E81FFF29C7B5D9A332E4B1C78D705@qq.com> (raw)
In-Reply-To: <86v8m7dvh1.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 19 Dec 2022 21:50:02 +0200")
Juri Linkov <juri@linkov.net> writes:
>> 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 "".
>
>
>
>
Actually in my case, it is `(abbreviate-file-name nil)`. As `fd` returns
relative path, common-parent-directory is nil.
--
Best Regards
Shuguang Sun
next prev parent reply other threads:[~2022-12-21 8:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-19 5:12 bug#60188: 30.0.50; zerop cpd-length are not all handled in project--read-file-cpd-relative Shuguang Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-19 19:50 ` Juri Linkov
2022-12-21 8:48 ` Shuguang Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-12-19 21:55 ` Dmitry Gutov
2022-12-19 23:45 ` bug#60188: 30.0.50; zerop cpd-length are not all handled inproject--read-file-cpd-relative Shuguang Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-20 8:41 ` Juri Linkov
2022-12-19 23:48 ` Shuguang Sun via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-20 0:55 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_27148E8E81FFF29C7B5D9A332E4B1C78D705@qq.com \
--to=bug-gnu-emacs@gnu.org \
--cc=60188@debbugs.gnu.org \
--cc=juri@linkov.net \
--cc=shuguang79@qq.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.