doomemacs/modules/editor/file-templates/templates/org-mode/__
yoavm448 ad89f79926 Better title heuristic for org template
Uses a stripped version of s-titleized-words, to not add s.el as a dependency.
2020-02-28 20:45:00 +02:00

20 lines
No EOL
647 B
Text

# -*- mode: snippet -*-
# name: Org template
# --
#+TITLE: ${1:`
(string-join
(mapcar #'capitalize
;; Replace -,_... with space
(split-string
(let (case-fold-search)
;; Seperating lower from upper: hello|World
(replace-regexp-in-string
"\\([[:lower:]]\\)\\([[:upper:]]\\)" "\\1 \\2"
;; Separating upper from (upper and lower): HTTP|Server
(replace-regexp-in-string "\\([[:upper:]]\\)\\([[:upper:]][0-9[:lower:]]\\)"
"\\1 \\2" (file-name-base buffer-file-name))))
"[^[:word:]0-9]+"
)) " " )
`}
$0