Files
gnatstudio/examples/python/skeleton.py
Emmanuel Briot ccb5e5adbb Updated to new API for hooks
git-svn-id: svn+ssh://svn.eu/Dev/importfromcvs/trunk@88880 936e1b1b-40f2-da11-902a-00137254ae57
2004-09-24 16:00:19 +00:00

21 lines
708 B
Python

## This file provides a basic implementation for skeletons.
## Whenever a new file is created, it inserts a skeleton at the beginning
## of the file.
## Possible enhancements: if we knew the type/language of the file, we could
## insert one skeleton or another
import GPS, os.path
skeleton="""------------------------------------------------------------------
-- Demo for a skeleton, see skeleton.py in the GPS installation --
------------------------------------------------------------------
"""
def add_skeleton (hook_name, file):
# Only for new files:
if not os.path.exists (file.name()):
GPS.Editor.replace_text (file.name(), 1, 1, skeleton)
GPS.Hook ("file_edited").add (add_skeleton)