-
Notifications
You must be signed in to change notification settings - Fork 2
/
run-command-recipes-csharp.el
52 lines (44 loc) · 1.97 KB
/
run-command-recipes-csharp.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
;;; run-command-recipes-csharp.el --- Recipe of `run-command' for c# -*- lexical-binding: t; -*-
;; Author: semenInRussia <[email protected]>
;; Version: 0.1.0
;; Keywords: extensions run-command
;; Homepage: https://github.com/semenInRussia/emacs-run-command-recipes
;; URL: https://github.com/semenInRussia/emacs-run-command-recipes/blob/main/docs/csharp.md
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; For use this code put the following to your Emacs configuration:
;;
;; (run-command-recipes-use 'csharp)
;;
;;; Code:
(defcustom run-command-recipes-csharp-modes
'(csharp-mode)
"List of major modes in which the recipe of `run-command' for C# should work."
:type '(repeat symbol)
:group 'run-command-recipes)
(defun run-command-recipes-csharp-p ()
"Return t, when `run-command' recipe for c# should work."
(and (buffer-file-name)
(memq major-mode run-command-recipes-csharp-modes)))
(defun run-command-recipes-csharp ()
"Recipe of `run-command' for c#."
(when (and (executable-find "dotnet") (run-command-recipes-csharp-p))
(list
:command-name "run-dotnet-project"
:display ".NET: run the project"
:command-line "dotnet run")
(list
:command-name "compile-dotnet-project"
:display ".NET: build, compile the project"
:command-line "dotnet build")))
(provide 'run-command-recipes-csharp)
;;; run-command-recipes-csharp.el ends here