unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Robert Pluim <rpluim@gmail.com>
To: emacs-devel@gnu.org
Cc: Lars Ingebrigtsen <larsi@gnus.org>
Subject: Re: master 6a6de68 1/3: Add new macro `with-existing-directory'
Date: Fri, 24 Sep 2021 11:07:49 +0200	[thread overview]
Message-ID: <87a6k2fije.fsf@gmail.com> (raw)
In-Reply-To: <20210901142716.98FD020B71@vcs0.savannah.gnu.org> (Lars Ingebrigtsen's message of "Wed, 1 Sep 2021 10:27:16 -0400 (EDT)")

>>>>> On Wed,  1 Sep 2021 10:27:16 -0400 (EDT), larsi@gnus.org (Lars Ingebrigtsen) said:
    Lars> +(defmacro with-existing-directory (&rest body)
    Lars> +  "Execute BODY with `default-directory' bound to an existing directory.
    Lars> +If `default-directory' is already an existing directory, it's not changed."
    Lars> +  (declare (indent 0) (debug t))
    Lars> +  `(let ((default-directory (seq-find (lambda (dir)
    Lars> +                                        (and dir
    Lars> +                                             (file-exists-p dir)))
    Lars> +                                      (list default-directory
    Lars> +                                            (expand-file-name "~/")
    Lars> +                                            (getenv "TMPDIR")
    Lars> +                                            "/tmp/")
    Lars> +                                      "/")))
    Lars> +     ,@body))

Hmm. 'temporary-file-directory'?

Robert
-- 



       reply	other threads:[~2021-09-24  9:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210901142714.25847.48045@vcs0.savannah.gnu.org>
     [not found] ` <20210901142716.98FD020B71@vcs0.savannah.gnu.org>
2021-09-24  9:07   ` Robert Pluim [this message]
2021-09-25  0:56     ` master 6a6de68 1/3: Add new macro `with-existing-directory' Lars Ingebrigtsen

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6k2fije.fsf@gmail.com \
    --to=rpluim@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).