summaryrefslogtreecommitdiff
path: root/cider-util.el
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2018-09-08 10:27:30 -0700
committerSean Whitton <spwhitton@spwhitton.name>2018-09-08 10:27:30 -0700
commit9148631b2f93ae849cfa141ac11447be42c8f31c (patch)
tree037f9fa2cbb72d7ca0118c1f89961efbafb64065 /cider-util.el
parent42d3b3f307a8d59632bba30a35d2695f72cf63dc (diff)
parent58f79015f3a28d6aee2fb841b31db3d8a46829d5 (diff)
Merge tag 'v0.18.0+dfsg' into wip/master
DFSG-clean upstream version 0.18.0
Diffstat (limited to 'cider-util.el')
-rw-r--r--cider-util.el28
1 files changed, 21 insertions, 7 deletions
diff --git a/cider-util.el b/cider-util.el
index fe7e275d..f09fb9ab 100644
--- a/cider-util.el
+++ b/cider-util.el
@@ -36,6 +36,7 @@
(require 'color)
(require 'seq)
(require 'subr-x)
+(require 'thingatpt)
;; clojure-mode and CIDER
(require 'cider-compat)
@@ -96,6 +97,14 @@ If BUFFER is provided act on that buffer instead."
;;; Thing at point
+
+(defun cider--text-or-limits (bounds start end)
+ "Returns the substring or the bounds of text.
+If BOUNDS is non-nil, returns the list (START END) of character
+positions. Else returns the substring from START to END."
+ (funcall (if bounds #'list #'buffer-substring-no-properties)
+ start end))
+
(defun cider-defun-at-point (&optional bounds)
"Return the text of the top level sexp at point.
If BOUNDS is non-nil, return a list of its starting and ending position
@@ -105,8 +114,7 @@ instead."
(end-of-defun)
(let ((end (point)))
(clojure-backward-logical-sexp 1)
- (funcall (if bounds #'list #'buffer-substring-no-properties)
- (point) end)))))
+ (cider--text-or-limits bounds (point) end)))))
(defun cider-ns-form ()
"Retrieve the ns form."
@@ -666,9 +674,9 @@ through a stack of help buffers. Variables `help-back-label' and
"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-find-resource]> to find a resource on the classpath."
+ "Press <\\[cider-find-var]> to jump to the source of something (e.g. a var, a Java method)."
"Press <\\[cider-selector]> to quickly select a CIDER buffer."
"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."
@@ -676,6 +684,10 @@ through a stack of help buffers. Variables `help-back-label' and
"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."
"Press <\\[cider-eval-defun-at-point]> to eval the top-level form at point."
+ "Press <\\[cider-eval-defun-up-to-point]> to eval the top-level form up to the point."
+ "Press <\\[cider-eval-sexp-up-to-point]> to eval the current form up to the point."
+ "Press <\\[cider-eval-sexp-at-point]> to eval the current form around the point."
+ "Press <\\[cider-eval-sexp-at-point-in-context]> to eval the current form around the point in a user-provided context."
"Press <\\[cider-eval-buffer]> to eval the entire source buffer."
"Press <\\[cider-scratch]> to create a Clojure scratchpad. Pretty handy for prototyping."
"Press <\\[cider-read-and-eval]> to evaluate some Clojure expression directly in the minibuffer."
@@ -687,9 +699,9 @@ through a stack of help buffers. Variables `help-back-label' and
"Press <\\[cider-inspect]> to inspect the preceding expression's result."
"Press <C-u \\[cider-inspect]> to inspect the defun at point's result."
"Press <C-u C-u \\[cider-inspect]> to read Clojure code from the minibuffer and inspect its result."
- "Press <\\[cider-refresh]> to reload modified and unloaded namespaces."
- "You can define Clojure functions to be called before and after `cider-refresh' (see `cider-refresh-before-fn' and `cider-refresh-after-fn'."
- "Press <\\[cider-display-connection-info]> to view information about the connection."
+ "Press <\\[cider-ns-refresh]> to reload modified and unloaded namespaces."
+ "You can define Clojure functions to be called before and after `cider-ns-refresh' (see `cider-ns-refresh-before-fn' and `cider-ns-refresh-after-fn'."
+ "Press <\\[cider-describe-connection]> to view information about the connection."
"Press <\\[cider-undef]> to undefine a symbol in the current namespace."
"Press <\\[cider-interrupt]> to interrupt an ongoing evaluation."
"Use <M-x customize-group RET cider RET> to see every possible setting you can customize."
@@ -700,7 +712,9 @@ through a stack of help buffers. Variables `help-back-label' and
"Exploring CIDER's menu-bar entries is a great way to discover features."
"Keep in mind that some commands don't have a keybinding by default. Explore CIDER!"
"Tweak `cider-repl-prompt-function' to customize your REPL prompt."
- "Tweak `cider-eldoc-ns-function' to customize the way namespaces are displayed by eldoc.")
+ "Tweak `cider-eldoc-ns-function' to customize the way namespaces are displayed by eldoc."
+ "For no middleware, low-tech and reliable namespace reloading use <\\[cider-ns-reload]>."
+ "Press <\\[cider-load-buffer-and-switch-to-repl-buffer]> to load the current buffer and switch to the REPL buffer afterwards.")
"Some handy CIDER tips."
)