saveCommandHistory :: IORef IntState -> String -> IO ()
saveCommandHistory c f = do
  h <- readIORef c
  let history = [ "# automatically generated hets proof-script", ""
                , "use " ++ filename h, ""]
                ++ reverse (map (showCmd . command) $ undoList $ i_hist h)
  writeFile f $ unlines history
saveCommandHistory :: IORef IntState -> String -> IO ()
saveCommandHistory c f = do
  h <- readIORef c
  let history = [ "# automatically generated hets proof-script", ""
                , "use " ++ filename h, ""]
                ++ reverse (map (showCmd . command) $ undoList $ i_hist h)
  writeFile f $ unlines history
saveCommandHistory c f = do
  h <- readIORef c
  let history = [ "# automatically generated hets proof-script", ""
                , "use " ++ filename h, ""]
                ++ reverse (map (showCmd . command) $ undoList $ i_hist h)
  writeFile f $ unlines history