[Top][All Lists]

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

Re: New feature in project.el: Remembering the previously used projects

From: Philip K.
Subject: Re: New feature in project.el: Remembering the previously used projects
Date: Fri, 05 Jun 2020 15:59:15 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

philip@warpmail.net (Philip K.) writes:

> Sure, I'll try it out.

An initial attempt attached below. It seems like everything works, the
only thing I wasn't sure about was execute-extended-command's "typed"
argument, since it seems to always be nil, when invoked interactivly?

        Philip K.
>From 192bdfe0b775c0456fe0ec45b58134b3d2630913 Mon Sep 17 00:00:00 2001
From: Philip K <philip@warpmail.net>
Date: Fri, 5 Jun 2020 15:07:04 +0200
Subject: [PATCH] Add project-execute-command

 lisp/progmodes/project.el | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index a94a27dbc2..e8c35a0fb1 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -744,6 +744,15 @@ project-compile
          (default-directory (project-root pr)))
     (compile command comint)))
+(defun project-execute-command (prefix command)
+  "Execute an extended COMMAND in project root."
+  (interactive (list current-prefix-arg
+                     (read-extended-command)))
+  (let* ((pr (project-current t))
+         (default-directory (project-root pr)))
+    (execute-extended-command prefix command)))
 ;;; Project list
@@ -830,7 +839,8 @@ project-switch-commands
     ("d" "Dired" project-dired)
     ("v" "VC-Dir" project-vc-dir)
     ("s" "Shell" project-shell)
-    ("e" "Eshell" project-eshell))
+    ("e" "Eshell" project-eshell)
+    ("x" "Execute command" project-execute-command))
   "Alist mapping keys to project switching menu entries.
 Used by `project-switch-project' to construct a dispatch menu of
 commands available upon \"switching\" to another project.

reply via email to

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