]> git.eshelyaron.com Git - emacs.git/commitdiff
Add project-compile command
authorPhilip K <philip@warpmail.net>
Tue, 19 May 2020 17:30:14 +0000 (19:30 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 19 May 2020 23:07:01 +0000 (02:07 +0300)
* lisp/progmodes/project.el (project-compile):
  New function.

lisp/progmodes/project.el

index 06e882b9f06b41567b2b531f6f0fdb0e5064bdce..41e34a37507f162e6cc53e8187210fa2beeb8d46 100644 (file)
@@ -681,5 +681,17 @@ loop using the command \\[fileloop-continue]."
    from to (project-files (project-current t)) 'default)
   (fileloop-continue))
 
+;;;###autoload
+(defun project-compile ()
+  "Run `compile' in the project root."
+  (interactive)
+  (let* ((pr (project-current t))
+         (roots (project-roots pr))
+         ;; TODO: be more intelligent when choosing a directory. This
+         ;; currently isn't a priority, since no `project-roots'
+         ;; implementation returns more that one directory.
+         (default-directory (car roots)))
+    (call-interactively 'compile)))
+
 (provide 'project)
 ;;; project.el ends here