rlm@103: #!/usr/bin/python rlm@102: rlm@102: import subprocess rlm@102: import sys rlm@103: import os rlm@102: rlm@102: target_file = sys.argv[1] rlm@102: rlm@103: command = "emacs -batch -l ~/.emacs-batch " + \ rlm@102: target_file + \ rlm@103: " --eval '(kill-comment (count-lines (point-min) (point-max)))'" + \ rlm@103: " -f save-buffer" rlm@102: rlm@103: #to load a custom .emacs script (for more syntax support), rlm@103: #use -l in the above command rlm@103: rlm@103: #print command rlm@103: rlm@103: fnull = open(os.devnull, 'w') rlm@103: subprocess.call(command, shell = True, stdout = fnull, stderr = fnull) rlm@103: fnull.close() rlm@103: rlm@103: rlm@103: rlm@103: rlm@103: rlm@103: rlm@103: rlm@103: