Mercurial > laserkard
annotate temp342423/kill-comments @ 102:8ed3394e6b73 laserkard
wrote comment-killer
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 27 Jul 2010 22:23:13 -0400 |
parents | |
children |
rev | line source |
---|---|
rlm@102 | 1 #!/usr/bin/python |
rlm@102 | 2 |
rlm@102 | 3 import subprocess |
rlm@102 | 4 import sys |
rlm@102 | 5 import os |
rlm@102 | 6 |
rlm@102 | 7 target_file = sys.argv[1] |
rlm@102 | 8 |
rlm@102 | 9 command = "emacs -batch -l ~/.emacs-bash " + \ |
rlm@102 | 10 target_file + \ |
rlm@102 | 11 " --eval '(kill-comment (count-lines (point-min) (point-max)))'" |
rlm@102 | 12 |
rlm@102 | 13 #to load a custom .emacs script (for more syntax support), |
rlm@102 | 14 #use -l <file> in the above command |
rlm@102 | 15 |
rlm@102 | 16 #print command |
rlm@102 | 17 |
rlm@102 | 18 fnull = open(os.devnull, 'w') |
rlm@102 | 19 result = subprocess.call(command, shell = True, stdout = fnull, stderr = fnull) |
rlm@102 | 20 fnull.close() |
rlm@102 | 21 |
rlm@102 | 22 |
rlm@102 | 23 |
rlm@102 | 24 |
rlm@102 | 25 |
rlm@102 | 26 |
rlm@102 | 27 |
rlm@102 | 28 |