summaryrefslogtreecommitdiff
path: root/.config/emacs/templates
blob: edd8461e75f031b0efd868499705988077b8b282 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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 " */")