Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 

46 Zeilen
1.4 KiB

  1. ;;-*-mode: emacs-lisp; coding: utf-8;-*-
  2. ;; Default file template definitions
  3. (add-hook 'find-file-hooks 'maybe-load-template)
  4. (setq template-file-prefix (concat (getenv "HOME") "/.emacs.d/templates"))
  5. (defun maybe-load-template ()
  6. (interactive)
  7. (when (and
  8. (string-match "\\.rb$" (buffer-file-name))
  9. (eq 1 (point-max)))
  10. (insert-file (concat template-file-prefix "/ruby.rb"))
  11. (ruby-mode))
  12. (when (and
  13. (string-match "\\.sh$" (buffer-file-name))
  14. (eq 1 (point-max)))
  15. (insert-file (concat template-file-prefix "/shell.sh"))
  16. (sh-mode))
  17. (when (and
  18. (string-match "\\.ksh$" (buffer-file-name))
  19. (eq 1 (point-max)))
  20. (insert-file (concat template-file-prefix "/shell.ksh"))
  21. (sh-mode))
  22. (when (and
  23. (string-match "\\.pl$" (buffer-file-name))
  24. (eq 1 (point-max)))
  25. (insert-file (concat template-file-prefix "/perl.pl"))
  26. (perl-mode))
  27. (when (and
  28. (string-match "\\.py$" (buffer-file-name))
  29. (eq 1 (point-max)))
  30. (insert-file (concat template-file-prefix "/python.py"))
  31. (python-mode))
  32. (when (and
  33. (string-match "\\.pm$" (buffer-file-name))
  34. (eq 1 (point-max)))
  35. (insert-file (concat template-file-prefix "/perl-module.pm"))
  36. (perl-mode))
  37. (when (and
  38. (string-match "\\.el$" (buffer-file-name))
  39. (eq 1 (point-max)))
  40. (insert-file (concat template-file-prefix "/elisp.el"))
  41. (emacs-lisp-mode))
  42. )