Ticket #2050: ghci-history-1.patch

File ghci-history-1.patch, 1.2 KB (added by ajd, 6 years ago)

Patch to GHCi to implement history file

  • compiler/ghci/InteractiveUI.hs

    Fri Jan 18 22:09:07 PST 2008  alexander.dunlap@gmail.com
      * GHC Trac 2050: Added persistant history tracking
    diff -rN -u old-ghc/compiler/ghci/InteractiveUI.hs new-ghc/compiler/ghci/InteractiveUI.hs
    old new  
    307307        is_tty <- hIsTerminalDevice stdin 
    308308        when is_tty $ do 
    309309            Readline.initialize 
     310            home <- getHomeDirectory 
     311            Readline.readHistory $ home ++ "/.ghci_history" 
    310312            Readline.setAttemptedCompletionFunction (Just completeWord) 
    311313            --Readline.parseAndBind "set show-all-if-ambiguous 1" 
    312314 
     
    340342                 } 
    341343 
    342344#ifdef USE_READLINE 
     345   home <- getHomeDirectory 
     346   Readline.writeHistory (home ++ "/.ghci_history") 
    343347   Readline.resetTerminal Nothing 
    344348#endif 
    345349 
     
    377381               case either_hdl of 
    378382                  Left _e   -> return () 
    379383                  Right hdl -> runCommands (fileLoop hdl False False) 
    380  
    381384  -- Perform a :load for files given on the GHCi command line 
    382385  -- When in -e mode, if the load fails then we want to stop 
    383386  -- immediately rather than going on to evaluate the expression.