all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Juri Linkov <juri@linkov.net>, 60100@debbugs.gnu.org
Subject: bug#60100: 29.0.60; project-current is not resilient
Date: Sun, 18 Dec 2022 02:41:05 +0200	[thread overview]
Message-ID: <525c62db-7562-46e3-b58c-92d97e0a4322@yandex.ru> (raw)
In-Reply-To: <86mt7o4hmx.fsf@mail.linkov.net>

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	other threads:[~2022-12-18  0:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-15 19:00 bug#60100: 29.0.60; project-current is not resilient Juri Linkov
2022-12-18  0:41 ` Dmitry Gutov [this message]
2022-12-18  8:38   ` Juri Linkov

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=525c62db-7562-46e3-b58c-92d97e0a4322@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=60100@debbugs.gnu.org \
    --cc=juri@linkov.net \
    /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.