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

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

bug#60100: 29.0.60; project-current is not resilient


From: Dmitry Gutov
Subject: bug#60100: 29.0.60; project-current is not resilient
Date: Sun, 18 Dec 2022 02:41:05 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2

On 15/12/2022 21:00, Juri Linkov wrote:
Is this intentional that

```
(project-current nil "/tmp/nonexistent/")
```

raises the error

   Debugger entered--Lisp error: (file-missing "Opening directory" "No such file or 
directory" "/tmp/nonexistent")

instead of silently returning nil.

I would say this is expected.

How could we avoid this? By adding a file-exists-p check somewhere inside, right? And failing silently if it returns nil.

Right now the caller code needs to use that check. Or, more likely, figure out why they are passing in a directory that does not exist.

Because when called with
an existing non-project dir, it just returns nil:

```
(project-current nil "/tmp/") => nil
```

nil is a normal return value in this case: it means "no project here", that's a regular occasion. The callers who don't want to deal with nil should pass t as the first argument.





reply via email to

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