aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Triguba <hello@eugenetriguba.com>2026-04-02 21:39:04 -0400
committerEugene Triguba <hello@eugenetriguba.com>2026-04-02 21:39:04 -0400
commited0276a95dafabe3bf571f63054569ab90f6493f (patch)
tree2e0b52a6a80c2cb57515fc79b85196a9b32c7d05
parentAdd slime with sbcl to emacs config (diff)
downloaddotfiles-ed0276a95dafabe3bf571f63054569ab90f6493f.zip
Add et-insert-elisp-template function to emacs config
-rw-r--r--.emacs.d/modules/et-utils.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/.emacs.d/modules/et-utils.el b/.emacs.d/modules/et-utils.el
index a924389..2c96ab1 100644
--- a/.emacs.d/modules/et-utils.el
+++ b/.emacs.d/modules/et-utils.el
@@ -8,5 +8,30 @@
"Check if the current system is my desktop system."
(string-match-p "desktop" (system-name)))
+(defun et-insert-elisp-template (summary)
+ "Insert a elisp template into the buffer.
+
+SUMMARY will be inserted into the header docstring
+as the file summary."
+ (interactive (list (read-string "summary: ")))
+ (let ((move-to-center-of-code-section (lambda () (forward-line -3)))
+ (get-current-file-name (lambda () (file-name-sans-extension (file-name-nondirectory buffer-file-name))))
+ (get-module-template (lambda (module-name summary)
+ (format ";;; %s.el --- %s -*- lexical-binding: t; -*-
+;;
+;;; Commentary:
+;;
+;;; Code:
+
+
+
+(provide '%s)
+;;; %s.el ends here" module-name summary module-name module-name))))
+ (if (not (buffer-file-name))
+ (message "No file visited.")
+ (progn
+ (insert (funcall get-module-template (funcall get-current-file-name) summary))
+ (funcall move-to-center-of-code-section)))))
+
(provide 'et-utils)
;;; et-utils.el ends here