Auto-insert snippet for python emacs

A small skeleton you can put into your python emacs editing session:

;; insert python skeleton with auto-insert
(eval-after-load 'autoinsert
'(define-auto-insert
'("\\.\\py\\'" . "python skeleton")
'(""
"#!/usr/bin/env python" \n
"# "
(file-name-nondirectory (buffer-file-name)) \n \n
"def main():" \n
"pass" \n \n
"if __name__ == '__main__':" \n
"main()" \n \n)))

Leave a Reply

Your email address will not be published. Required fields are marked *