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

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

[elpa] externals/beardbolt 98cea6e8e0 023/323: Simplify creation of new


From: ELPA Syncer
Subject: [elpa] externals/beardbolt 98cea6e8e0 023/323: Simplify creation of new starters with a macro
Date: Thu, 9 Mar 2023 10:57:55 -0500 (EST)

branch: externals/beardbolt
commit 98cea6e8e0c84249e2d045f5384562153812c0a8
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>

    Simplify creation of new starters with a macro
---
 rmsbolt.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/rmsbolt.el b/rmsbolt.el
index 67ebb96fae..d897288f75 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -546,16 +546,16 @@ int main() {
       (insert
        (rmsbolt-l-starter-file lang-def))
       (save-buffer))
-
     (unless rmsbolt-mode
-      (rmsbolt-mode 1)))
-  )
-(defun rmsbolt-c ()
-  (interactive)
-  (rmsbolt-starter 'c-mode))
-(defun rmsbolt-c++ ()
-  (interactive)
-  (rmsbolt-starter 'c++-mode))
+      (rmsbolt-mode 1))))
+(defmacro rmsbolt-defstarter (lang mode)
+  "Defines a starter for LANG and MODE."
+  `(defun ,(intern (concat "rmsbolt-" lang)) ()
+     ,(concat "Open a rmsbolt starter file for " lang ".")
+     (interactive)
+     (rmsbolt-starter ,mode)))
+(rmsbolt-defstarter "c" 'c-mode)
+(rmsbolt-defstarter "c++" 'c++-mode)
 
 ;;;; Mode Definition:
 



reply via email to

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