From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs 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 Organization: LINKOV.NET Message-ID: <86v8m7dvh1.fsf@mail.linkov.net> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4183"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 60188@debbugs.gnu.org To: Shuguang Sun Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 19 20:51:14 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p7MAK-0000o5-WF for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Dec 2022 20:51:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p7MAB-0003XF-Nz; Mon, 19 Dec 2022 14:51:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p7MAA-0003Ww-Bb for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2022 14:51:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p7MAA-0000Hc-3z for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2022 14:51:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p7MA9-0006mo-QJ for bug-gnu-emacs@gnu.org; Mon, 19 Dec 2022 14:51:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Dec 2022 19:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60188 X-GNU-PR-Package: emacs Original-Received: via spool by 60188-submit@debbugs.gnu.org id=B60188.167147944426080 (code B ref 60188); Mon, 19 Dec 2022 19:51:01 +0000 Original-Received: (at 60188) by debbugs.gnu.org; 19 Dec 2022 19:50:44 +0000 Original-Received: from localhost ([127.0.0.1]:40089 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7M9r-0006ma-S7 for submit@debbugs.gnu.org; Mon, 19 Dec 2022 14:50:44 -0500 Original-Received: from relay11.mail.gandi.net ([217.70.178.231]:58419) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p7M9q-0006mR-1z for 60188@debbugs.gnu.org; Mon, 19 Dec 2022 14:50:42 -0500 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id 86C17100003; Mon, 19 Dec 2022 19:50:33 +0000 (UTC) In-Reply-To: (Shuguang Sun via's message of "Mon, 19 Dec 2022 13:12:09 +0800") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:251461 Archived-At: > 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 "".