aboutsummaryrefslogtreecommitdiff
path: root/eb.el
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-27 14:50:05 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-27 14:57:01 +0200
commitff566993defe78a705173ab7ba883c19b37c8143 (patch)
tree93ffecb6fbbdfdd5b9e877295401e3ab16d7bfef /eb.el
parenta4ebd0354b0bbbe81ea43d2b83fb21dd5a88d3e1 (diff)
downloadEpisodeBrowser-ff566993defe78a705173ab7ba883c19b37c8143.tar.gz
Support Debug/Release configurations.
Diffstat (limited to 'eb.el')
-rw-r--r--eb.el50
1 files changed, 40 insertions, 10 deletions
diff --git a/eb.el b/eb.el
index b3691b1..c9877c9 100644
--- a/eb.el
+++ b/eb.el
@@ -4,6 +4,8 @@
;;; Code:
+(defgroup eb nil "Episode Browser development environment")
+
;;;###autoload
(defun eb-quit-or-bury ()
"Quit window or bury buffer."
@@ -80,9 +82,14 @@
(call-interactively #'grep)))
(defcustom eb-system "vs2019"
- "Build system (mingw/vs2019)."
+ "Build system."
+ :group 'eb
+ :type '(radio (const "mingw") (const "vs2019")))
+
+(defcustom eb-config "Debug"
+ "Build configuration type."
:group 'eb
- :type 'string)
+ :type '(radio (const "Debug") (const "Release")))
(defcustom eb-cwd "b"
"Working directory for executable."
@@ -97,8 +104,10 @@
(let ((buf (get-buffer-create "*eb-run*"))
(exe (concat (projectile-project-root)
"/b/"
- eb-system
- (if (not (string-equal eb-system "mingw")) "/Debug/" "")
+ eb-system "/"
+ (if (not (string-equal eb-system "mingw"))
+ (concat eb-config "/")
+ "")
"EpisodeBrowser.exe"))
(default-directory eb-cwd))
(with-current-buffer buf
@@ -113,16 +122,24 @@
;;;###autoload
(defun eb-compile ()
- "Compile without prompt."
+ "Compile project without prompt. Use `eb-system'."
(interactive)
(require 'projectile)
(when (and (eq major-mode 'compilation-mode)
(window-parameter (selected-window) 'quit-restore))
(quit-window))
(if (projectile-project-p)
- (let ((compilation-read-command nil))
- (call-interactively #'projectile-compile-project))
- (call-interactively #'compile)))
+ (let ((compilation-read-command nil)
+ (command (concat "make SYSTEM=" eb-system " CONFIG=" eb-config)))
+ (projectile--run-project-cmd command nil
+ :show-prompt nil
+ :prompt-prefix "Compile command: "
+ :save-buffers t
+ :use-comint-mode projectile-compile-use-comint-mode))
+ (call-interactively #'compile))
+ (with-current-buffer "*compilation*"
+ (when (eql (point) (point-min))
+ (goto-char (point-max)))))
;;;###autoload
(defun eb-check ()
@@ -146,6 +163,12 @@
(when eb--list-buffers (quit-window))
(projectile-vc (or (projectile-project-root) default-directory)))
+;;;###autoload
+(defun eb-customize ()
+ "Customize group `eb'."
+ (interactive)
+ (customize-group 'eb))
+
(defvar-local eb-tool-bar-mode--old-map nil)
(defvar-local eb-tool-bar-mode--old-back-button-mode nil)
(defvar-local eb-tool-bar-mode--old-back-button-show-toolbar-buttons nil)
@@ -163,7 +186,8 @@
(back-button-mode 1)
(setq-local back-button-show-toolbar-buttons nil))
(let ((map (make-sparse-keymap)))
- ;; Windows, buffers and files
+
+ ;; Windows, buffers and files.
(tool-bar-local-item "cancel" #'eb-quit-or-bury 'quit-or-bury map
:label "Bury" :help "Bury buffer or window")
(define-key map [(shift quit-or-bury)] #'eb-exhume-buffer)
@@ -177,7 +201,7 @@
(tool-bar-local-item "search-replace" #'eb-grep 'grep map
:label "Grep" :help "Grep project")
- ;; Compilation and version control
+ ;; Compilation and version control.
(define-key-after map [separator-1] menu-bar-separator)
(tool-bar-local-item "newsticker/next-item" #'eb-run 'run map
:label "Run" :help "Run executable")
@@ -190,6 +214,7 @@
(tool-bar-local-item "mail/inbox" #'eb-vc 'vc map
:label "Version Control" :help "Open project version control")
+ ;; Mark control.
(when (require 'back-button nil t)
(define-key-after map [separator-2] menu-bar-separator)
(tool-bar-local-item "left-arrow" #'back-button-global-backward 'previous-mark map
@@ -202,6 +227,11 @@
:label "Next Mark" :help "Next Mark")
(define-key map [(shift next-mark)] #'back-button-local-forward))
+ ;; Miscellaneous.
+ (define-key-after map [separator-3] menu-bar-separator)
+ (tool-bar-local-item "preferences" #'eb-customize 'customize map
+ :label "Customize" :help "Customize user options")
+
(setq-local tool-bar-map map)))
(setq-local tool-bar-map eb-tool-bar-mode--old-map)
(when (require 'back-button nil t)