unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: master 6a6de68 1/3: Add new macro `with-existing-directory'
       [not found] ` <20210901142716.98FD020B71@vcs0.savannah.gnu.org>
@ 2021-09-24  9:07   ` Robert Pluim
  2021-09-25  0:56     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Pluim @ 2021-09-24  9:07 UTC (permalink / raw)
  To: emacs-devel; +Cc: Lars Ingebrigtsen

>>>>> 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
-- 



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: master 6a6de68 1/3: Add new macro `with-existing-directory'
  2021-09-24  9:07   ` master 6a6de68 1/3: Add new macro `with-existing-directory' Robert Pluim
@ 2021-09-25  0:56     ` Lars Ingebrigtsen
  0 siblings, 0 replies; 2+ messages in thread
From: Lars Ingebrigtsen @ 2021-09-25  0:56 UTC (permalink / raw)
  To: Robert Pluim; +Cc: emacs-devel

Robert Pluim <rpluim@gmail.com> writes:

> Hmm. 'temporary-file-directory'?

Good idea.  I've now added it to the list.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-25  0:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210901142714.25847.48045@vcs0.savannah.gnu.org>
     [not found] ` <20210901142716.98FD020B71@vcs0.savannah.gnu.org>
2021-09-24  9:07   ` master 6a6de68 1/3: Add new macro `with-existing-directory' Robert Pluim
2021-09-25  0:56     ` Lars Ingebrigtsen

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).