emacs-devel
[Top][All Lists]
Advanced

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

Re: master 6a6de68 1/3: Add new macro `with-existing-directory'


From: Robert Pluim
Subject: Re: master 6a6de68 1/3: Add new macro `with-existing-directory'
Date: Fri, 24 Sep 2021 11:07:49 +0200

>>>>> 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 via email to

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