Opened 16 months ago

Last modified 8 months ago

#9089 infoneeded feature request

Local .ghci_history

Reported by: jcristovao Owned by:
Priority: normal Milestone: 7.12.1
Component: GHCi Version: 7.8.2
Keywords: Cc: hvr, nsch, ibotty
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions:

Description

Hello,

It would be nice to allow a local .ghci_history to be used (when available) instead of the global .ghc/ghci_history.

This would be similar in behaviour to the .ghci rules: http://www.haskell.org/ghc/docs/7.8.2/html/users_guide/ghci-dot-files.html

And I believe this should not be too complicated to do (I can even try it myself, if there is interest).

Attachments (2)

ghci_history_patch.diff (931 bytes) - added by jcristovao 15 months ago.
Patch to use local .ghci_history if available
ghci_history_patch.2.diff (2.2 KB) - added by jcristovao 14 months ago.
Proper diff (code)

Download all attachments as: .zip

Change History (13)

Changed 15 months ago by jcristovao

Patch to use local .ghci_history if available

comment:1 Changed 15 months ago by jcristovao

I've added a diff showing a very simple implementation of this (against 7.8.2). I've only included code, not the corresponding documentation patch, but I can also do that, of course. What do you think?

Last edited 15 months ago by jcristovao (previous) (diff)

comment:2 Changed 15 months ago by nsch

  • Cc nsch added

comment:3 Changed 14 months ago by jcristovao

  • Status changed from new to patch

comment:4 Changed 14 months ago by rwbarton

This kind of diff with no context is hard to read and in danger of getting out of date with upstream. Can you attach a diff produced by git diff or, failing that, at least with diff -u? (I think the attached diff is backwards, too.)

Also, a documentation patch would be helpful. It's somewhat less obvious how I'm supposed to use a local .ghci_history file than a local .ghci file, since a .ghci file is written by the user, but a .ghci_history is (usually) produced by .ghci. Am I supposed to just create an empty .ghci_history file in the directory where I want to use local history?

Version 0, edited 14 months ago by rwbarton (next)

comment:5 Changed 14 months ago by thomie

  • Status changed from patch to new

Changed 14 months ago by jcristovao

Proper diff (code)

comment:6 Changed 14 months ago by jcristovao

I am so sorry about this... I should have checked the diff, it was almost useless. Attached is a proper diff (I hope), against HEAD.

Am I supposed to just create an empty .ghci_history

file in the directory where I want to use local history?

Yes, that is basically it. Just as you need to create a local .ghci file when you want one. The other alternative would be a command line option, but this seems simpler.

What do you think?

When we reach an agreement, I'll add the documentation patch.

Thanks!

Last edited 14 months ago by jcristovao (previous) (diff)

comment:7 Changed 14 months ago by jcristovao

  • Status changed from new to patch

comment:8 Changed 13 months ago by joe9mail

I would love to have this feature. Thanks a lot for adding it in.

comment:9 Changed 12 months ago by thoughtpolice

  • Milestone set to 7.10.1
  • Status changed from patch to infoneeded

I'm +1 on this feature, but I personally think this should have a command line flag, for example, ghc --interactive --local-ghci-history, perhaps with a short-name if one is sensible. This is much easier for users to understand (e.g. they can look at man ghc to find it) I think.

Please also update the documentation and I'll get to this - thanks!

comment:10 Changed 10 months ago by ibotty

  • Cc ibotty added

i would also prefer a command-line option (and make it cabal repl's default).

comment:11 Changed 8 months ago by thoughtpolice

  • Milestone changed from 7.10.1 to 7.12.1

Moving to 7.12.1 milestone; if you feel this is an error and should be addressed sooner, please move it back to the 7.10.1 milestone.

Note: See TracTickets for help on using tickets.