# Best way to access docstings (like ? mode)

**URL:** <https://discourse.julialang.org/t/best-way-to-access-docstings-like-mode/32096>\
**Category:** General Usage\
**Tags:** question\
**Created:** [December 10, 2019, 12:48pm UTC](https://discourse.julialang.org/t/best-way-to-access-docstings-like-mode/32096 "2019-12-10T12:48:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 10, 2019, 12:48pm UTC](https://discourse.julialang.org/t/best-way-to-access-docstings-like-mode/32096/1 "2019-12-10T12:48:56Z")

</div>

In the emacs interface [julia-repl.el](https://github.com/tpapp/julia-repl) currently we access docstrings with `@docs`, eg when the user requests help for `foo`,

```julia
@docs foo

```

is sent to the Julia REPL.

But this does not work for keywords like `break` or `continue`, among other things. What’s the best way to replicate what `?foo` does?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 10, 2019, 1:09pm UTC](https://discourse.julialang.org/t/best-way-to-access-docstings-like-mode/32096/2 "2019-12-10T13:09:50Z")

</div>

```julia
import REPL
Core.eval(Main, REPL.helpmode("break"))

```

You can intercept the output with:

```julia
buf = IOBuffer()
help = Core.eval(Main, REPL.helpmode(buf, "break"))
helpstdout = String(take!(buf))

```

The `helpstdout` string is the search output for related things, e.g. `search: break AbstractVecOrMat`, and the `help` object is what you `show` or `display` to see the actual help (typically it is a `Markdown.MD` object, but you can of course `show` it as `text/plain`, `text/markdown`, `text/html`, etc.

---

<div class="post-metadata">

**Author:** ![orialb](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@orialb](https://discourse.julialang.org/u/orialb)\
**Post date:** [December 10, 2019, 1:16pm UTC](https://discourse.julialang.org/t/best-way-to-access-docstings-like-mode/32096/3 "2019-12-10T13:16:02Z")

</div>

Just out of curiosity- why is it not possible to have julia-repl just send “? foo” to the Julia REPL (or what are the disadvantages of this? )  
This seems to work (at least with N=1 test cases 🙂 ) , but probably I’m missing something about the cases when one needs bracketed pasting ?

```julia
(defun julia-repl-doc2 ()
  "Documentation for symbol at point."
  (interactive)
  (julia-repl--send-string (concat "? " (thing-at-point 'symbol t)) nil t))

```

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [December 10, 2019, 1:17pm UTC](https://discourse.julialang.org/t/best-way-to-access-docstings-like-mode/32096/4 "2019-12-10T13:17:40Z")

</div>

It should be feasible, I just probably need to check and restore the char/line mode.
