Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Described *1-*3,*e in repl-welcome #1310

Merged
merged 1 commit into from

3 participants

@jakubholynet

I have learned only by chance about the fact that REPL stores evaluation results in *1 - *3 and the last exception in *e. I am certainly not the only one unaware of this so it would be good to include it in the welcome message.

(For random visitors: they are defined in clojure's ./src/clj/clojure/main.clj.)

@jakubholynet jakubholynet Described *1-*3,*e in repl-welcome
I have learned only by chance about the fact that REPL stores evaluation results in *1 - *3 and the last exception in *e. I am certainly not the only one unaware of this so it would be good to include it in the welcome message.

(For random visitors: they are defined in clojure's [`./src/clj/clojure/main.clj`](https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.clj).)
ac36df6
@hyPiRion
Collaborator

Hey, (sorry for not chiming in earlier)

My 2 cents: I think this sounds like a reasonable thing to add in. But adding more than this (after it has been merged in) would make the REPL welcome message a bit large.

@technomancy
Owner

Thanks for submitting this. We've actually been intending to include a more comprehensive repl help, but we were blocked for a while on trptcolin/reply#114. But now that's been fixed, so we should give that another go instead of showing this every time the repl starts up.

@jakubholynet

Great! I am looking forward to that.

@technomancy
Owner
@jakubholynet

I'd be happy to implement it but am not sure how, could you point me in the right direction?

@jakubholynet

I.e. I suppose that the solution is to supply REPLy with Leiningen-specific help function upon start and to modify the welcome message be removing everything from it and just mentioning that people can run (user/help) to learn more, right?

I suppose that to https://github.com/technomancy/leiningen/blob/master/src/leiningen/repl.clj#L58 I'd need to add :custom help (list 'println (slurp (io/resource "repl-help")))
where custom-help would be a new file with more info than custom-repl. Is that corect?

@hyPiRion
Collaborator

@jakubholynet That's almost right: The :welcome keyword is renamed to :custom-help, which is always printed on startup. The most "elegant" way to solve this, as far as I know, is by having :custom-init make a form which redefines user/help at startup. Add the following line into ~/.lein/profiles.clj, in your :user: profile, to see the effect:

:repl-options {:custom-init (defn help [] (println "Here's the helper fn."))}

Whenever you now call (help), you should see the changes.

We're doing initialization directly in nREPL, so using :custom-init shouldn't affect the :init option in :repl-options at all.

Not sure if there are better ways to handle that, @trptcolin may have some thoughts on it.

@technomancy
Owner

Hrm; for some reason I thought reply already supported a help message that isn't shown on repl startup, but it looks like that's not the case. Redefining it in :custom-init might not be the best because IIRC it's not guaranteed to be run in the user namespace. But I could be wrong about that.

@technomancy
Owner

Sorry for spiralling this out of control; we'll go ahead and merge this and maybe come back to a split help message later.

@technomancy technomancy merged commit 4d3c46d into technomancy:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 24, 2013
  1. @jakubholynet

    Described *1-*3,*e in repl-welcome

    jakubholynet authored
    I have learned only by chance about the fact that REPL stores evaluation results in *1 - *3 and the last exception in *e. I am certainly not the only one unaware of this so it would be good to include it in the welcome message.
    
    (For random visitors: they are defined in clojure's [`./src/clj/clojure/main.clj`](https://github.com/clojure/clojure/blob/master/src/clj/clojure/main.clj).)
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 0 deletions.
  1. +1 −0  resources/repl-welcome
View
1  resources/repl-welcome
@@ -3,3 +3,4 @@
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
+ Results: Stored in vars *1, *2, *3, an exception in *e
Something went wrong with that request. Please try again.