[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt 3bfc7ed2e3 012/323: Allow custom functions to
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt 3bfc7ed2e3 012/323: Allow custom functions to parse arguments |
Date: |
Thu, 9 Mar 2023 10:57:50 -0500 (EST) |
branch: externals/beardbolt
commit 3bfc7ed2e3fc121862b1de80802a235f0dc8a69a
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>
Allow custom functions to parse arguments
---
rmsbolt.el | 39 ++++++++++++++++++++++++++-------------
1 file changed, 26 insertions(+), 13 deletions(-)
diff --git a/rmsbolt.el b/rmsbolt.el
index c69ff8efe1..fd25f643e2 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -123,8 +123,25 @@
(starter-file-name
nil
:type 'string
- :documentation "The starter filename to use"))
+ :documentation "The starter filename to use")
+ (compile-cmd-function
+ nil
+ :type 'function
+ :documentation "A function which takes in a compile command (could be the
default) and adds needed args to it."))
+
+(defun rmsbolt--c-compile-cmd (options)
+ "Process a compile command for gcc/clang."
+ (let* ((cmd (rmsbolt-o-compile-cmd options))
+ (cmd (mapconcat 'identity
+ (list cmd
+ "-g"
+ "-S" (buffer-file-name)
+ "-o" (rmsbolt-output-filename)
+ (when rmsbolt-intel-x86
+ "-masm=intel"))
+ " ")))
+ cmd))
(defvar rmsbolt-languages)
(setq
rmsbolt-languages
@@ -134,6 +151,7 @@
:compile-cmd "gcc")
:supports-binary t
:starter-file-name "rmsbolt.c"
+ :compile-cmd-function #'rmsbolt--c-compile-cmd
:starter-file
"#include <stdio.h>
@@ -165,6 +183,7 @@ int main() {
:compile-cmd "g++")
:supports-binary t
:starter-file-name "rmsbolt.cpp"
+ :compile-cmd-function #'rmsbolt--c-compile-cmd
:starter-file
"#include <iostream>
@@ -354,6 +373,8 @@ int main() {
(display-buffer buffer))))))
;;;;; Parsing Options
+(defun rmsbolt--get-lang ()
+ (cdr-safe (assoc major-mode rmsbolt-languages)))
(defun rmsbolt--get-cmd ()
"Gets the rms command from the buffer, if available."
(save-excursion
@@ -362,7 +383,7 @@ int main() {
(match-string-no-properties 1)))
(defun rmsbolt--parse-options ()
"Parse RMS options from file."
- (let* ((lang (cdr-safe (assoc major-mode rmsbolt-languages)))
+ (let* ((lang (rmsbolt--get-lang))
(options (copy-rmsbolt-options (rmsbolt-l-options lang)))
(cmd (rmsbolt--get-cmd)))
(when cmd
@@ -375,16 +396,8 @@ int main() {
(interactive)
(save-some-buffers nil (lambda () rmsbolt-mode))
(let* ((options (rmsbolt--parse-options))
- (cmd (rmsbolt-o-compile-cmd options))
- (cmd (mapconcat 'identity
- (list cmd
- "-g"
- "-S" (buffer-file-name)
- "-o" (rmsbolt-output-filename)
- (when rmsbolt-intel-x86
- "-masm=intel"))
- " ")))
-
+ (func (rmsbolt-l-compile-cmd-function (rmsbolt--get-lang)))
+ (cmd (funcall func options)))
(rmsbolt-with-display-buffer-no-window
(with-current-buffer (compilation-start cmd)
(add-hook 'compilation-finish-functions
@@ -402,7 +415,7 @@ int main() {
(defun rmsbolt-starter (lang-mode)
"Code for "
- (let* ((lang-def (cdr-safe (assoc lang-mode rmsbolt-languages)))
+ (let* ((lang-def (rmsbolt--get-lang))
(file-name
(expand-file-name (rmsbolt-l-starter-file-name lang-def)
rmsbolt-temp-dir))
(exists (file-exists-p file-name)))
- [elpa] externals/beardbolt 2e6163c95a 047/323: Add testing framework, (continued)
- [elpa] externals/beardbolt 2e6163c95a 047/323: Add testing framework, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 5efa347027 046/323: Update readme, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 082cbc7b1c 048/323: Add new tests, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt ff6f376d87 053/323: Update README.org, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3ca3f35cdb 050/323: Add very basic support for rust, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 65a1ac7b6e 054/323: Add support for demangling, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt bb64352f8d 034/323: Store and use ranges to view highlighted regions, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 1419a90465 040/323: Add C/C++ demo, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 39f1e05667 009/323: Add filter for commentOnly, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 4a35528d7d 021/323: Configure all variables with buffer-local values, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3bfc7ed2e3 012/323: Allow custom functions to parse arguments,
ELPA Syncer <=
- [elpa] externals/beardbolt 98cea6e8e0 023/323: Simplify creation of new starters with a macro, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 547a47e58f 022/323: Fix default commands, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2530003c71 020/323: Remove rmsbolt-options, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt cf7d2787bc 027/323: Implement line number parsing, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 8fc36eacd8 044/323: Add option to force assembling, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt d37f8a0ebf 042/323: Remove reliance on hl-line-mode, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt a0527f16af 045/323: Add very basic support for common lisp, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt d7acfdd127 041/323: Fix rmsbolt temp directory generation being too late, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f0d13c4ac2 036/323: Add a stronger blacklist for ocaml asm, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 22810d69a7 062/323: Add docs for python, ELPA Syncer, 2023/03/09