what is the emacs equivalent of vim skeleton files with autocmds? reddit / emacs ---------------------------------------------------------------------- LowCom · 2022-06-17 10:11 For eg., the vim autocommand below insert "#!/usr/bin/bash" into every new file ending with .sh. The shebang line above will be pasted into a skeleton bash file. autocmd BufNewfile *.sh 0r ~/.vim/skeletons/bashSkeleton ---------------------------------------------------------------------- _viz_ · 2022-06-17 10:25 Read the autotype manual for this and more. (info "(autotype) Top") ---------------------------------------------------------------------- xircon · 2022-06-17 11:33 There is a package that does it - search melpa for shebang (at work, so can't). ---------------------------------------------------------------------- doolio_ · 2022-06-17 11:53 Does your work block melpa? ---------------------------------------------------------------------- xircon · 2022-06-17 12:08 I work for the national health service in the UK, I can't use Emacs at work, they do allow notepad++ (groan!!) ---------------------------------------------------------------------- hkjels · 2022-06-17 13:14 It’s called Skelton in Emacs also and there’s the more popular yasnippet as well ---------------------------------------------------------------------- Gallipo · 2022-06-17 13:25 There is the built-in autoinsert-mode https://www.gnu.org/software/emacs/manual/html\_node/autotype/Autoinse rting.html ---------------------------------------------------------------------- timmymayes · 2022-06-17 15:08 Ugh. ---------------------------------------------------------------------- timmymayes · 2022-06-17 15:08 The one true failing of the NHS ---------------------------------------------------------------------- Illiamen · 2022-06-17 16:17 Besides what others have said, you might also be interested in the below for automatically making scripts executable. (add-hook 'after-save-hook 'executable-make-buffer-file- executable-if-script-p) ---------------------------------------------------------------------- LowCom · 2022-06-18 05:56 I do use yasnippet. But it uses triggers to insert templates while skeletons is like boilerplate for certain filetypes. Both are required. ---------------------------------------------------------------------- hkjels · 2022-06-18 09:42 With Skeleton I use auto-insert-mode. There's likely an alternative for yasnippet as well, or you could just create a hook that triggers it, shouldn't be many lines of code. https://www.emacswiki.org/emacs/AutoInsertMode ---------------------------------------------------------------------- onetom · 2022-06-18 15:51 at least that's free software too :) could FSF help somehow to get Emacs approved? what could be the reason for not allowing Emacs? could it be its extensibility? ---------------------------------------------------------------------- xircon · 2022-06-18 17:30 I seriously doubt it, our computers are tied down tight. ---------------------------------------------------------------------- TheGramm · 2022-06-19 23:08 While I love emacs, a lot, I get why a securiry guy wouldn't want a "lisp machine" in NHS computers. It's not that you cant secure it, but its so niche so why bother. ---------------------------------------------------------------------- onetom · 2022-06-20 18:16 why bother? I would love to hear some pros & cons answers to that :) it made me wonder, what else might be approved, which is worse from security perspective? why did they approve notepad++? what is it used for? what's the approval process? ---------------------------------------------------------------------- TheGramm · 2022-06-20 21:46 Notepad++ is not extendable in the same way