diff options
Diffstat (limited to 'scheme/format.scm')
-rw-r--r-- | scheme/format.scm | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/scheme/format.scm b/scheme/format.scm new file mode 100644 index 0000000..61a98cc --- /dev/null +++ b/scheme/format.scm @@ -0,0 +1,36 @@ +;; This file is part of Idest +;; Copyright (C) 2011 Sergey Poznyakoff +;; Idest is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3, or (at your option) +;; any later version. +;; +;; Idest is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with Idest. If not, see <http://www.gnu.org/licenses/>. + +(define-module (format)) + +(use-modules (guile-user)) + +(let ((cmd (command-line)) + (mod-pathname #f) + (saved-load-hook %load-hook)) + + (set! %load-hook (lambda (filename) + (set! mod-pathname filename) + (set! %load-hook saved-load-hook))) + + (let ((mod-name (list-ref cmd 1))) + (set-program-arguments (cons (car cmd) (list-tail cmd 2))) + (set! idest-main + (module-ref + (resolve-module (list 'idest 'format (string->symbol mod-name))) + 'idest-main)) + + (if (not idest-readonly) + (error (format #f "~A wants to modify files!" mod-pathname))))) |