unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Theodor Thornhill <theo@thornhill.no>, emacs-devel@gnu.org
Subject: Re: Project.el - running processes in root
Date: Fri, 5 Jun 2020 01:07:40 +0300	[thread overview]
Message-ID: <8c6b3360-f5a4-b10a-55a8-f79d843192da@yandex.ru> (raw)
In-Reply-To: <87img65wh2.fsf@thornhill.no>

Hello!

On 05.06.2020 00:53, Theodor Thornhill wrote:

> What is the best way to run a subprocess in root of a project currently?
> 
> Right now I've made a small convenience macro for this:
> 
> (defmacro with-project-root (&rest body)
>    "Dynamically bind default directory to project root."
>    (declare (debug t) (indent 0))
>    `(let ((default-directory (project-root (project-current))))
>       ,@body))
> 
> 
> Then I can:
> 
> (defun elm-repl ()
>    "Create a new buffer with Elm repl started and switch to it."
>    (interactive)
>    (with-project-root
>      (switch-to-buffer-other-window
>       (make-comint "Elm Repl" "elm" nil "repl"))))

It's as good a solution as any.

> Otherwise, would this be something appropriate for
> project.el to expose?

I'm not sure... It doesn't even save one line. Just shortens it.



      reply	other threads:[~2020-06-04 22:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-04 21:53 Project.el - running processes in root Theodor Thornhill
2020-06-04 22:07 ` Dmitry Gutov [this message]

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=8c6b3360-f5a4-b10a-55a8-f79d843192da@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=theo@thornhill.no \
    /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).