Skip to content

Instantly share code, notes, and snippets.

@cxxxr cxxxr/fmt.ros

Last active Jun 8, 2018
What would you like to do?
#|-*- mode:lisp -*-|#
#| <Put a one-line description here>
exec ros -Q -- $0 "$@"
(progn ;;init forms
#+quicklisp (ql:quickload '(:lem-base :lem-lisp-syntax) :silent t)
;; TODO: あまり速くないのでファイル毎にマルチスレッドでやりたい (lemはスレッドセーフではないから排他制御をうまくやる必要がある)
(defpackage :ros.script.fmt.3707812168
(:use :cl))
(in-package :ros.script.fmt.3707812168)
(defun indent-buffer (buffer)
(lem-base:indent-region (lem-base:buffer-start-point buffer)
(lem-base:buffer-end-point buffer)))
(defun fmt (file)
(let ((buffer (lem-base:find-file-buffer file)))
(lem-base:buffer-disable-undo buffer)
(setf (lem-base:buffer-syntax-table buffer)
(setf (lem-base:variable-value 'lem-base:calc-indent-function :buffer buffer)
(indent-buffer buffer)
(lem-base:write-to-file buffer (lem-base:buffer-filename buffer))))
(defun main (&rest argv)
(declare (ignorable argv))
(loop :for arg :in argv
:do (fmt arg)))
;;; vim: set ft=lisp lisp:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.