script 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/run/current-system/profile/bin/guile \
  2. --no-auto-compile -e (`(s-chop-prefix "guile-" (file-name-nondirectory (buffer-file-name)))`) -s
  3. !#
  4. ;;;; `(s-chop-prefix "guile-" (file-name-nondirectory (buffer-file-name)))` --- SYNOPSIS
  5. ;;;; Copyright © `(nth 5 (decode-time))` `user-full-name` <`user-mail-address`>
  6. ;;;; Released under the GNU GPLv3 or any later version.
  7. (define-module (`(s-chop-prefix "guile-" (file-name-nondirectory (buffer-file-name)))`)
  8. #:use-module (srfi srfi-37)
  9. #:export (main))
  10. ;;; Commentary:
  11. ;;;
  12. ;;; DESCRIPTION
  13. ;;;
  14. ;;; Code:
  15. (define %options
  16. (let ((display-and-exit-proc (lambda (msg)
  17. (lambda (opt name arg loads)
  18. (display msg) (quit)))))
  19. (list (option '(#\v "version") #f #f
  20. (display-and-exit-proc "`(s-chop-prefix "guile-" (file-name-nondirectory (buffer-file-name)))` version 0.0.1\n"))
  21. (option '(#\h "help") #f #f
  22. (display-and-exit-proc
  23. "Usage: `(s-chop-prefix "guile-" (file-name-nondirectory (buffer-file-name)))` ...")))))
  24. (define %default-options
  25. '())
  26. (define (main args)
  27. (define opts
  28. (args-fold (cdr (program-arguments))
  29. %options
  30. (lambda (opt name arg loads)
  31. (error "Unrecognized option \`~A'" name))
  32. (lambda (op loads)
  33. (cons op loads))
  34. %default-options))
  35. )
  36. ;;; `(let* ((bfn (buffer-file-name)) (file (s-chop-prefix "guile-" (file-name-nondirectory bfn))) (directory (file-name-directory bfn))) (rename-buffer file) (setq buffer-file-name (concat directory file)) file)` ends here