Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Override clojure.core/doc #1

Open
neotyk opened this issue Apr 15, 2010 · 3 comments
Open

Override clojure.core/doc #1

neotyk opened this issue Apr 15, 2010 · 3 comments

Comments

@neotyk
Copy link
Member

neotyk commented Apr 15, 2010

Figure out how and if it is possible to override clojure.core/doc.

@LaPingvino
Copy link
Contributor

In which context?

@LaPingvino
Copy link
Contributor

From the mailing list

On Apr 15, 1:38 pm, Jeff [email protected] wrote:

Does anyone know if there is some way we can make it easy to put
clansi into your user.clj, and have it overload clojure.core/doc so by
default the printed doc strings are colorized? I tried with set! and
def with no luck.

Since clojure.core/doc is a macro, your best bet is

(ns clojure.core)
(defmacro doc [v] `(clansi/color-doc ~v))

The problem is that clansi/color-doc calls clojure.core/doc, so this
will lead to a stack overflow.
It's arguably "best" to just copy the implementation of clojure.core/
doc into clansi/color-doc -
you're already overwriting core functionality anyway.

Also, the whole strategy of using (binding) to override clojure core
functions will not work in the
current clojure 1.2 branch. See the thread I started on the clojure
mailing list yesterday:

http://groups.google.com/group/clojure/t/7b9245a2ac09512d

Cheers,
Joost.

@LaPingvino
Copy link
Contributor

I changed my fork to such an implementation, and added some more stuff. Merge it in?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants