branch: externals/beardbolt
commit 0e0d82d774bc1647ea1ee95239cd4f9899c24e0d
Author: Jay Kamat <[email protected]>
Commit: Jay Kamat <[email protected]>
Override default directory to prevent rouge executables
---
rmsbolt.el | 6 +++++-
starters/rmsbolt.rs | 34 +++++++++++-----------------------
2 files changed, 16 insertions(+), 24 deletions(-)
diff --git a/rmsbolt.el b/rmsbolt.el
index d4182dc3a2..4486e3ecf5 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -739,13 +739,15 @@ Outputs assembly file if ASM."
;; We cannot compile asm-mode files
(message "Cannot compile assembly files. Are you sure you are not in the
output buffer?")
(rmsbolt--parse-options)
+ (rmsbolt--gen-temp)
(let* ((src-buffer (current-buffer))
(lang (rmsbolt--get-lang))
(func (rmsbolt-l-compile-cmd-function lang))
;; Generate command
(cmd (funcall func :src-buffer src-buffer))
;; Convert to demangle if we need to
- (cmd (rmsbolt--demangle-command cmd lang src-buffer)))
+ (cmd (rmsbolt--demangle-command cmd lang src-buffer))
+ (default-directory rmsbolt-temp-dir))
(when (buffer-local-value 'rmsbolt-disassemble src-buffer)
(pcase
@@ -858,6 +860,8 @@ Outputs assembly file if ASM."
(if-let* ((should-run rmsbolt-use-overlays)
(src-buffer
(buffer-local-value 'rmsbolt-src-buffer (current-buffer)))
+ ;; Don't run on unsaved buffers
+ (should-run (not (buffer-modified-p src-buffer)))
(output-buffer (get-buffer-create rmsbolt-output-buffer))
(current-line (line-number-at-pos))
(src-current-line
diff --git a/starters/rmsbolt.rs b/starters/rmsbolt.rs
index 80e90ed5b5..23c7bfed24 100644
--- a/starters/rmsbolt.rs
+++ b/starters/rmsbolt.rs
@@ -6,30 +6,18 @@
// End:
-fn main() {
- let number = 13;
- // TODO ^ Try different values for `number`
-
- println!("Tell me about {}", number);
- match number {
- // Match a single value
- 1 => println!("One!"),
- // Match several values
- 2 | 3 | 5 | 7 | 11 => println!("This is a prime"),
- // Match an inclusive range
- 13...19 => println!("A teen"),
- // Handle the rest of cases
- _ => println!("Ain't special"),
+fn is_rms(a: char) -> i32 {
+ match a {
+ 'R' => 1,
+ 'M' => 2,
+ 'S' => 3,
+ _ => 0,
}
+}
- let boolean = true;
- // Match is an expression too
- let binary = match boolean {
- // The arms of a match must cover all the possible values
- false => 0,
- true => 1,
- // TODO ^ Try commenting out one of these arms
+fn main() {
+ let a: u8 = 1 + 1;
+ if is_rms(a as char) != 0 {
+ println!("{}", a);
};
-
- println!("{} -> {}", boolean, binary);
}