emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/beardbolt 28fc329861 262/323: Rework bb-compile a bit


From: ELPA Syncer
Subject: [elpa] externals/beardbolt 28fc329861 262/323: Rework bb-compile a bit
Date: Thu, 9 Mar 2023 10:58:37 -0500 (EST)

branch: externals/beardbolt
commit 28fc329861dc464e69b45e0e295b3c38897b3e3f
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Rework bb-compile a bit
    
    * beardbolt.el (bb-compile): Add LANG argument.
    Simplify.
    (beardbolt, bb--after-save): Call bb--get-lang.
---
 beardbolt.el | 27 +++++++++------------------
 1 file changed, 9 insertions(+), 18 deletions(-)

diff --git a/beardbolt.el b/beardbolt.el
index 70e30ec4ac..075449c35d 100644
--- a/beardbolt.el
+++ b/beardbolt.el
@@ -1584,29 +1584,21 @@ and return it."
   (get-buffer-create "*bb-compilation*"))
 
 ;;;;; UI Functions
-(defun bb-compile ()
-  "Compile the current beardbolt buffer."
-  (interactive)
-  (when (and (buffer-modified-p)
-             (yes-or-no-p (format "Save buffer %s? " (buffer-name))))
-    (save-buffer))
-  (bb--gen-temp)
+(defun bb-compile (lang)
+  "Run beardbolt on current buffer for LANG.
+Interactively, determine LANG from `major-mode'."
+  (interactive (list (bb--get-lang)))
   ;; Current buffer = src-buffer at this point
-  (setq bb-src-buffer (current-buffer))
   (cond
-   ((eq major-mode 'asm-mode)
-    ;; We cannot compile asm-mode files
-    (message "Cannot compile assembly files. Are you sure you are not in the 
output buffer?"))
-   ((bb-l-elisp-compile-override (bb--get-lang))
+   ((bb-l-elisp-compile-override lang)
     (with-current-buffer (or (buffer-base-buffer) (current-buffer))
       (funcall
-       (bb-l-elisp-compile-override (bb--get-lang))
+       (bb-l-elisp-compile-override lang)
        :src-buffer (current-buffer))))
    (t
     (bb--stop-running-compilation)
     (bb--parse-options)
     (let* ((src-buffer (current-buffer))
-           (lang (bb--get-lang))
            (func (bb-l-compile-cmd-function lang))
            ;; Generate command
            (cmd
@@ -1840,7 +1832,7 @@ and return it."
   (when (and (bb--is-active-src-buffer)
              bb-automatic-recompile)
     (setq bb--automated-compile t)
-    (bb-compile)))
+    (bb-compile (bb--get-lang))))
 
 ;; Auto-save the src buffer after it has been unchanged for `bb-compile-delay' 
seconds.
 ;; The buffer is then automatically recompiled via `bb--after-save'.
@@ -1903,12 +1895,11 @@ This mode is enabled in both src and assembly output 
buffers."
 
 ;;;###autoload
 (defun beardbolt ()
-  "Start a beardbolt compilation and enable `bb-mode' for code region
-highlighting and automatic recompilation."
+  "Start beardbolt compilation, enable `bearbolt-mode'."
   (interactive)
   (unless bb-mode
     (bb-mode))
-  (bb-compile))
+  (bb-compile (bb--get-lang)))
 
 (provide 'beardbolt)
 



reply via email to

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