Skip to content

Commit

Permalink
Add a command to display useful usage tips
Browse files Browse the repository at this point in the history
  • Loading branch information
bbatsov committed Feb 8, 2016
1 parent 044e279 commit 475d58c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -18,6 +18,7 @@ and try to associate the created connection with this project automatically.
* Typing `h` (as in *h*ere) skips all sexps until the current point position.
* [#1507](https://github.com/clojure-emacs/cider/issues/1507): Add the ability to control the REPL's scroll on output functionality via `cider-repl-scroll-on-output`.
* [#1543](https://github.com/clojure-emacs/cider/issues/1543): Add some getting started instructions to the welcome banner.
* New command `cider-drink-a-sip`. Use in case you're thirsty for knowledge.

### Changes

Expand Down
2 changes: 1 addition & 1 deletion cider-repl.el
Expand Up @@ -313,7 +313,7 @@ client process connection. Unless NO-BANNER is non-nil, insert a banner."
; * Press <\\[cider-doc]> to view the documentation for something (e.g. a var, a Java method)
;
; CIDER is super customizable - try <M-x customize-group cider> to get
; a feel for this.
; a feel for this. If you're thirsty for knowledge you should try <\\[cider-drink-a-sip]>.
;
; If you think you've encountered a bug (or have some suggestions for improvements) press <\\[cider-report-bug]>.
;
Expand Down
25 changes: 25 additions & 0 deletions cider-util.el
Expand Up @@ -408,6 +408,31 @@ Any other value is just returned."
(eval (nth (random (length cider-words-of-inspiration))
cider-words-of-inspiration)))

(defvar cider-tips
'("Press <\\[cider-view-manual]> to view CIDER's manual."
"Press <\\[describe-mode]> to see a list of the keybindings available (this will work in every Emacs buffer)"
"Press <\\[cider-repl-handle-shortcut]> to quickly invoke some REPL command"
"Press <\\[cider-switch-to-last-clojure-buffer]> to switch between the REPL and a Clojure source buffer"
"Press <\\[cider-find-var]> to jump to the source of something (e.g. a var, a Java method)"
"Press <\\[cider-doc]> to view the documentation for something (e.g. a var, a Java method)"
"Press <\\[cider-selector]> to quickly select a CIDER buffer or command."
"Press <\\[cider-test-run-ns-tests]> to run the tests for the current namespace."
"Press <\\[cider-test-run-loaded-tests]> to run all loaded tests."
"Press <\\[cider-test-run-project-tests]> to run all tests for the current project."
"Press <\\[cider-apropos]> to look for a symbol by some search string."
"Press <\\[cider-apropos-documentation]> to look for a symbol that has some string in its docstring.")
"Some handy CIDER tips."
)

(defun cider-random-tip ()
"Select a random tip from `cider-tips'."
(substitute-command-keys (nth (random (length cider-tips)) cider-tips)))

(defun cider-drink-a-sip ()
"Show a random tip."
(interactive)
(message (cider-random-tip)))

(defun cider-column-number-at-pos (pos)
"Analog to `line-number-at-pos'."
(save-excursion (goto-char pos) (current-column)))
Expand Down

0 comments on commit 475d58c

Please sign in to comment.