From e3236fe7cdbb6bc35f3d567345ca4c5421c1c491 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 9 Sep 2024 15:35:35 +0200 Subject: emacs: Add tempel templates --- .config/emacs/templates | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .config/emacs/templates diff --git a/.config/emacs/templates b/.config/emacs/templates new file mode 100644 index 0000000..edd8461 --- /dev/null +++ b/.config/emacs/templates @@ -0,0 +1,21 @@ +;; NOTE: https://github.com/minad/tempel/issues/23 + +c-mode c-ts-mode c++-mode c++-ts-mode + +(guard + "#ifndef " + (p + (thread-last + (file-name-base (or (buffer-file-name) + (buffer-name))) + (concat (if-let ((project (project-current))) + (concat (project-name project) "_"))) + (upcase) + (string-replace "-" "_") + (replace-regexp-in-string "^[0-9]+" "_\\&") + (replace-regexp-in-string "[^A-Z0-9_]+" "") + (format "%s_H")) + header) + n + "#define " header n n r n n + "#endif /* !" header " */") -- cgit v1.2.3