unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Theodor Thornhill <theo@thornhill.no>
To: emacs-devel@gnu.org
Subject: Project.el - running processes in root
Date: Thu, 04 Jun 2020 21:53:33 +0000	[thread overview]
Message-ID: <87img65wh2.fsf@thornhill.no> (raw)


Hello!

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

This seems like a nice solution, but if there already exists something like
this, please tell.  Otherwise, would this be something appropriate for
project.el to expose?

Have a nice day,

Theo




             reply	other threads:[~2020-06-04 21:53 UTC|newest]

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

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=87img65wh2.fsf@thornhill.no \
    --to=theo@thornhill.no \
    --cc=emacs-devel@gnu.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).