From f40014b9ca8bd89ceb9c2334736375cbcbdd927e Mon Sep 17 00:00:00 2001 From: Vitalie Spinu Date: Tue, 22 Aug 2017 02:37:32 +0200 Subject: Faster REPL - don't load extra middleware on first sync request - Sending :inhibit-cider-middleware condition on first request - Combining require-repl-utils and set-initial-ns into one sync request for efficiency --- cider-repl.el | 62 +++++++++++++++++++++++++++++------------------------------ 1 file changed, 30 insertions(+), 32 deletions(-) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index 897a9085..c420223f 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -255,26 +255,25 @@ ENDPOINT is a plist as returned by `nrepl-connect'." (add-hook 'nrepl-disconnected-hook 'cider--disconnected-handler nil 'local) (current-buffer)))) -(defun cider-repl-require-repl-utils () - "Require standard REPL util functions into the current REPL." - (interactive) - (cider-nrepl-request:eval - "(when (clojure.core/resolve 'clojure.main/repl-requires) - (clojure.core/map clojure.core/require clojure.main/repl-requires))" - (lambda (_response) nil))) - (declare-function cider-set-buffer-ns "cider-mode") -(defun cider-repl-set-initial-ns (buffer) - "Set the REPL BUFFER's initial namespace (by altering `cider-buffer-ns'). -This is \"user\" by default but can be overridden in apps like lein (:init-ns)." +(defun cider-repl-require-repl-utils-and-set-ns (buffer) + "Require standard REPL util functions and set the ns of the REPL's BUFFER. +Namespace is \"user\" by default, but can be overridden in apps like +lein (:init-ns). Both of these operations need to be done as a sync +request at the beginning of the session. Bundling them together for +efficiency." ;; we don't want to get a timeout during init (let ((nrepl-sync-request-timeout nil)) (with-current-buffer buffer - (let ((initial-ns (or (read - (nrepl-dict-get - (cider-nrepl-sync-request:eval "(str *ns*)") - "value")) - "user"))) + (let* ((command "(do (when (clojure.core/resolve 'clojure.main/repl-requires) + (clojure.core/map clojure.core/require clojure.main/repl-requires)) + (str *ns*))") + (response (nrepl-send-sync-request + (lax-plist-put (nrepl--eval-request command) + "inhibit-cider-middleware" "true") + (cider-current-connection))) + (initial-ns (or (read (nrepl-dict-get response "value")) + "user"))) (cider-set-buffer-ns initial-ns))))) (defvar cider-current-clojure-buffer nil @@ -289,18 +288,29 @@ to call `cider-remember-clojure-buffer'.") "Initialize the REPL in BUFFER. BUFFER must be a REPL buffer with `cider-repl-mode' and a running client process connection. Unless NO-BANNER is non-nil, insert a banner." - (cider-repl-set-initial-ns buffer) - (cider-repl-require-repl-utils) - (unless no-banner - (cider-repl--insert-banner-and-prompt buffer)) (when cider-repl-display-in-current-window (add-to-list 'same-window-buffer-names (buffer-name buffer))) (pcase cider-repl-pop-to-buffer-on-connect (`display-only (display-buffer buffer)) ((pred identity) (pop-to-buffer buffer))) + (cider-repl-require-repl-utils-and-set-ns buffer) + (unless no-banner + (cider-repl--insert-banner-and-prompt buffer)) (cider-remember-clojure-buffer cider-current-clojure-buffer) buffer) +(defun cider-repl--insert-banner-and-prompt (buffer) + "Insert REPL banner and REPL prompt in BUFFER." + (with-current-buffer buffer + (when (zerop (buffer-size)) + (insert (propertize (cider-repl--banner) 'font-lock-face 'font-lock-comment-face)) + (when cider-repl-display-help-banner + (insert (propertize (cider-repl--help-banner) 'font-lock-face 'font-lock-comment-face)))) + (goto-char (point-max)) + (cider-repl--mark-output-start) + (cider-repl--mark-input-start) + (cider-repl--insert-prompt cider-buffer-ns))) + (defun cider-repl--banner () "Generate the welcome REPL buffer banner." (let ((host (cider--connection-host (current-buffer))) @@ -359,18 +369,6 @@ client process connection. Unless NO-BANNER is non-nil, insert a banner." ;; ====================================================================== ")) -(defun cider-repl--insert-banner-and-prompt (buffer) - "Insert REPL banner and REPL prompt in BUFFER." - (with-current-buffer buffer - (when (zerop (buffer-size)) - (insert (propertize (cider-repl--banner) 'font-lock-face 'font-lock-comment-face)) - (when cider-repl-display-help-banner - (insert (propertize (cider-repl--help-banner) 'font-lock-face 'font-lock-comment-face)))) - (goto-char (point-max)) - (cider-repl--mark-output-start) - (cider-repl--mark-input-start) - (cider-repl--insert-prompt cider-buffer-ns))) - ;;; REPL interaction -- cgit v1.2.3 From f7f1256070536c5e5699e043e8af0bddffcc5b0c Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sun, 10 Dec 2017 19:10:17 +0200 Subject: Fix a regression related to requiring REPL util on REPL start In https://github.com/clojure-emacs/cider/commit/f40014b9ca8bd89ceb9c2334736375cbcbdd927e an optimization was attempted which combined two requests into one. However, it switched the order of requiring the utils and setting the initial namespace, thus ending up not requiring the utils in the initial namespace. --- cider-repl.el | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index c420223f..2682fa81 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -256,7 +256,7 @@ ENDPOINT is a plist as returned by `nrepl-connect'." (current-buffer)))) (declare-function cider-set-buffer-ns "cider-mode") -(defun cider-repl-require-repl-utils-and-set-ns (buffer) +(defun cider-repl-set-initial-ns (buffer) "Require standard REPL util functions and set the ns of the REPL's BUFFER. Namespace is \"user\" by default, but can be overridden in apps like lein (:init-ns). Both of these operations need to be done as a sync @@ -265,17 +265,25 @@ efficiency." ;; we don't want to get a timeout during init (let ((nrepl-sync-request-timeout nil)) (with-current-buffer buffer - (let* ((command "(do (when (clojure.core/resolve 'clojure.main/repl-requires) - (clojure.core/map clojure.core/require clojure.main/repl-requires)) - (str *ns*))") - (response (nrepl-send-sync-request - (lax-plist-put (nrepl--eval-request command) + (let* ((response (nrepl-send-sync-request + (lax-plist-put (nrepl--eval-request "(str *ns*))") "inhibit-cider-middleware" "true") (cider-current-connection))) (initial-ns (or (read (nrepl-dict-get response "value")) "user"))) (cider-set-buffer-ns initial-ns))))) +(defun cider-repl-require-repl-utils () + "Require standard REPL util functions into the current REPL." + (interactive) + (nrepl-send-sync-request + (lax-plist-put + (nrepl--eval-request + "(when (clojure.core/resolve 'clojure.main/repl-requires) + (clojure.core/map clojure.core/require clojure.main/repl-requires))") + "inhibit-cider-middleware" "true") + (cider-current-connection))) + (defvar cider-current-clojure-buffer nil "This variable holds current buffer temporarily when connecting to a REPL. It is set to current buffer when `cider' or `cider-jack-in' is called. @@ -293,7 +301,8 @@ client process connection. Unless NO-BANNER is non-nil, insert a banner." (pcase cider-repl-pop-to-buffer-on-connect (`display-only (display-buffer buffer)) ((pred identity) (pop-to-buffer buffer))) - (cider-repl-require-repl-utils-and-set-ns buffer) + (cider-repl-set-initial-ns buffer) + (cider-repl-require-repl-utils) (unless no-banner (cider-repl--insert-banner-and-prompt buffer)) (cider-remember-clojure-buffer cider-current-clojure-buffer) -- cgit v1.2.3 From 254f17d022353ae5dc95d8a5148a59c8ec9206ee Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sun, 10 Dec 2017 19:27:05 +0200 Subject: Add a REPL shortcut for `cider-repl-require-repl-utils` This makes it easy to require common REPL utility functions like `doc`, `source`, etc. in REPL buffers. Those utils are auto-required in the initial namespace (typically `user`), but you have to require them yourself after switching to new namespaces. --- cider-repl.el | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index 2682fa81..99d6398e 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -1381,6 +1381,7 @@ constructs." (cider-repl-add-shortcut "quit" #'cider-quit) (cider-repl-add-shortcut "restart" #'cider-restart) (cider-repl-add-shortcut "version" #'cider-version) +(cider-repl-add-shortcut "require-repl-utils" #'cider-repl-require-repl-utils) (defconst cider-repl-shortcuts-help-buffer "*CIDER REPL Shortcuts Help*") @@ -1507,6 +1508,7 @@ constructs." "--" ["Set REPL ns" cider-repl-set-ns] ["Toggle pretty printing" cider-repl-toggle-pretty-printing] + ["Require REPL utils" cider-repl-require-repl-utils] "--" ["Browse classpath" cider-classpath] ["Browse classpath entry" cider-open-classpath-entry] -- cgit v1.2.3 From dd0ecbc0e0439f85fbf3bdebec1ee024161c522e Mon Sep 17 00:00:00 2001 From: Vitalie Spinu Date: Mon, 11 Dec 2017 00:12:31 +0100 Subject: Remove cider-remember-clojure-buffer and cider-last-clojure-buffer --- cider-repl.el | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index 99d6398e..010c18c4 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -274,23 +274,15 @@ efficiency." (cider-set-buffer-ns initial-ns))))) (defun cider-repl-require-repl-utils () - "Require standard REPL util functions into the current REPL." - (interactive) - (nrepl-send-sync-request - (lax-plist-put - (nrepl--eval-request - "(when (clojure.core/resolve 'clojure.main/repl-requires) + "Require standard REPL util functions into the current REPL." + (interactive) + (nrepl-send-sync-request + (lax-plist-put + (nrepl--eval-request + "(when (clojure.core/resolve 'clojure.main/repl-requires) (clojure.core/map clojure.core/require clojure.main/repl-requires))") - "inhibit-cider-middleware" "true") - (cider-current-connection))) - -(defvar cider-current-clojure-buffer nil - "This variable holds current buffer temporarily when connecting to a REPL. -It is set to current buffer when `cider' or `cider-jack-in' is called. -After the REPL buffer is created, the value of this variable is used -to call `cider-remember-clojure-buffer'.") - -(declare-function cider-remember-clojure-buffer "cider-mode") + "inhibit-cider-middleware" "true") + (cider-current-connection))) (defun cider-repl-init (buffer &optional no-banner) "Initialize the REPL in BUFFER. @@ -305,7 +297,6 @@ client process connection. Unless NO-BANNER is non-nil, insert a banner." (cider-repl-require-repl-utils) (unless no-banner (cider-repl--insert-banner-and-prompt buffer)) - (cider-remember-clojure-buffer cider-current-clojure-buffer) buffer) (defun cider-repl--insert-banner-and-prompt (buffer) -- cgit v1.2.3 From b34057a1944354cbd2100e2beb08d6c6e1e06da3 Mon Sep 17 00:00:00 2001 From: Tianxiang Xiong Date: Mon, 11 Dec 2017 01:17:50 -0800 Subject: Replace `if-let` and `when-let` with starred versions Fix #2130. Emacs 26 obsoletes `if-let` and `when-let`, replacing them with `if-let*` and `when-let*`. This raises byte-compilation warnings (treated as errors) when testing against Emacs 26. See: http://git.savannah.gnu.org/cgit/emacs.git/tree/etc/NEWS?h=emacs-26#n1278 --- cider-repl.el | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index 99d6398e..367c68c0 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -219,11 +219,11 @@ via `cider-current-connection'.") ;; Metadata changed, so signatures may have changed too. (setq cider-eldoc-last-symbol nil) (when (or cider-mode (derived-mode-p 'cider-repl-mode)) - (when-let ((ns-dict (or (nrepl-dict-get changed-namespaces (cider-current-ns)) - (let ((ns-dict (cider-resolve--get-in (cider-current-ns)))) - (when (seq-find (lambda (ns) (nrepl-dict-get changed-namespaces ns)) - (nrepl-dict-get ns-dict "aliases")) - ns-dict))))) + (when-let* ((ns-dict (or (nrepl-dict-get changed-namespaces (cider-current-ns)) + (let ((ns-dict (cider-resolve--get-in (cider-current-ns)))) + (when (seq-find (lambda (ns) (nrepl-dict-get changed-namespaces ns)) + (nrepl-dict-get ns-dict "aliases")) + ns-dict))))) (cider-refresh-dynamic-font-lock ns-dict)))))))))) (declare-function cider-default-err-handler "cider-interaction") @@ -562,7 +562,7 @@ When there is a possible unfinished ansi control sequence, (defun cider-repl--ns-form-changed-p (ns-form connection) "Return non-nil if NS-FORM for CONNECTION changed since last eval." - (when-let ((ns (cider-ns-from-form ns-form))) + (when-let* ((ns (cider-ns-from-form ns-form))) (not (string= ns-form (lax-plist-get (buffer-local-value 'cider-repl--ns-forms-plist connection) @@ -580,7 +580,7 @@ When there is a possible unfinished ansi control sequence, (defun cider-repl--cache-ns-form (ns-form connection) "Given NS-FORM cache root ns in CONNECTION." (with-current-buffer connection - (when-let ((ns (cider-ns-from-form ns-form))) + (when-let* ((ns (cider-ns-from-form ns-form))) ;; cache ns-form (setq cider-repl--ns-forms-plist (lax-plist-put cider-repl--ns-forms-plist ns ns-form)) @@ -901,7 +901,7 @@ text property `cider-old-input'." (defun cider-repl-switch-to-other () "Switch between the Clojure and ClojureScript REPLs for the current project." (interactive) - (if-let (other-connection (cider-other-connection)) + (if-let* ((other-connection (cider-other-connection)) (switch-to-buffer other-connection) (message "There's no other REPL for the current project"))) @@ -1073,7 +1073,7 @@ for locref look up." This function is used from help-echo property inside REPL buffers and uses regexes from `cider-locref-regexp-alist' to infer locations at point." (interactive) - (if-let ((loc (cider-locref-at-point pos))) + (if-let* ((loc (cider-locref-at-point pos))) (let* ((var (plist-get loc :var)) (line (plist-get loc :line)) (file (or @@ -1108,7 +1108,7 @@ One for all REPLs.") "Function for help-echo property in REPL buffers. WIN, BUFFER and POS are the window, buffer and point under mouse position." (with-current-buffer buffer - (if-let ((hl (plist-get (cider-locref-at-point pos) :highlight))) + (if-let* ((hl (plist-get (cider-locref-at-point pos) :highlight))) (move-overlay cider-locref-hoover-overlay (car hl) (cdr hl)) (delete-overlay cider-locref-hoover-overlay)) nil)) -- cgit v1.2.3 From 8143c4afd79e165ff1bec43536839f1a27c67d33 Mon Sep 17 00:00:00 2001 From: dan sutton Date: Mon, 11 Dec 2017 10:36:55 -0600 Subject: Restore missing parens from conversion from when-let to when-let* --- cider-repl.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index 367c68c0..bb961d97 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -903,7 +903,7 @@ text property `cider-old-input'." (interactive) (if-let* ((other-connection (cider-other-connection)) (switch-to-buffer other-connection) - (message "There's no other REPL for the current project"))) + (message "There's no other REPL for the current project")))) (defvar cider-repl-clear-buffer-hook) -- cgit v1.2.3 From 3a98c1b9f931961132137a54e98d1ea03f0e6006 Mon Sep 17 00:00:00 2001 From: Tianxiang Xiong Date: Tue, 12 Dec 2017 19:18:02 -0800 Subject: Fix misplaced parentheses in `cider-repl-switch-to-other` Fixes #2136 This was causing [failures in CI](https://travis-ci.org/clojure-emacs/cider/jobs/314874715#L1412). --- cider-repl.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index bb961d97..18623c28 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -901,9 +901,9 @@ text property `cider-old-input'." (defun cider-repl-switch-to-other () "Switch between the Clojure and ClojureScript REPLs for the current project." (interactive) - (if-let* ((other-connection (cider-other-connection)) + (if-let* ((other-connection (cider-other-connection))) (switch-to-buffer other-connection) - (message "There's no other REPL for the current project")))) + (message "There's no other REPL for the current project"))) (defvar cider-repl-clear-buffer-hook) -- cgit v1.2.3 From 7bc6955e37ca1e9f4cf437bd7bffb5af591c15e0 Mon Sep 17 00:00:00 2001 From: Le Wang Date: Sat, 16 Dec 2017 09:40:30 -0500 Subject: Ensure cider-repl-result-prefix is only inserted before the first result chunk (#2117) Subsequent chunks of result should not have this re-inserted. See also https://github.com/clojure-emacs/cider/issues/315 --- cider-repl.el | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index b9487033..1fa6fb82 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -698,7 +698,7 @@ If BOL is non-nil, emit at the beginning of the line." (cider-repl--insert-prompt cider-buffer-ns)))) (cider-repl--show-maximum-output))) -(defun cider-repl-emit-result (buffer string &optional bol) +(defun cider-repl-emit-result (buffer string &optional bol show-prefix) "Emit into BUFFER the result STRING and mark it as an evaluation result. If BOL is non-nil insert at the beginning of the line." (with-current-buffer buffer @@ -708,7 +708,8 @@ If BOL is non-nil insert at the beginning of the line." (goto-char cider-repl-input-start-mark) (when (and bol (not (bolp))) (insert-before-markers "\n")) - (insert-before-markers (propertize cider-repl-result-prefix 'font-lock-face 'font-lock-comment-face)) + (when show-prefix + (insert-before-markers (propertize cider-repl-result-prefix 'font-lock-face 'font-lock-comment-face))) (if cider-repl-use-clojure-font-lock (insert-before-markers (cider-font-lock-as-clojure string)) (cider-propertize-region @@ -766,8 +767,10 @@ the symbol." (defun cider-repl-handler (buffer) "Make an nREPL evaluation handler for the REPL BUFFER." (nrepl-make-response-handler buffer - (lambda (buffer value) - (cider-repl-emit-result buffer value t)) + (let (after-first-call) + (lambda (buffer value) + (cider-repl-emit-result buffer value t (not after-first-call)) + (setq after-first-call t))) (lambda (buffer out) (cider-repl-emit-stdout buffer out)) (lambda (buffer err) @@ -775,8 +778,10 @@ the symbol." (lambda (buffer) (cider-repl-emit-prompt buffer)) nrepl-err-handler - (lambda (buffer pprint-out) - (cider-repl-emit-result buffer pprint-out nil)))) + (let (after-first-call) + (lambda (buffer pprint-out) + (cider-repl-emit-result buffer pprint-out nil (not after-first-call)) + (setq after-first-call t))))) (defun cider-repl--send-input (&optional newline) "Go to the end of the input and send the current input. -- cgit v1.2.3 From eaa0e652ee073cf13116e423ebf65e3396af7af0 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sat, 16 Dec 2017 16:45:52 +0200 Subject: Improve the name of the variable checking whether we're dealing with the first chunk of a result --- cider-repl.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index 1fa6fb82..452c2feb 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -767,10 +767,10 @@ the symbol." (defun cider-repl-handler (buffer) "Make an nREPL evaluation handler for the REPL BUFFER." (nrepl-make-response-handler buffer - (let (after-first-call) + (let (after-first-result-chunk) (lambda (buffer value) - (cider-repl-emit-result buffer value t (not after-first-call)) - (setq after-first-call t))) + (cider-repl-emit-result buffer value t (not after-first-result-chunk)) + (setq after-first-result-chunk t))) (lambda (buffer out) (cider-repl-emit-stdout buffer out)) (lambda (buffer err) @@ -778,10 +778,10 @@ the symbol." (lambda (buffer) (cider-repl-emit-prompt buffer)) nrepl-err-handler - (let (after-first-call) + (let (after-first-result-chunk) (lambda (buffer pprint-out) - (cider-repl-emit-result buffer pprint-out nil (not after-first-call)) - (setq after-first-call t))))) + (cider-repl-emit-result buffer pprint-out nil (not after-first-result-chunk)) + (setq after-first-result-chunk t))))) (defun cider-repl--send-input (&optional newline) "Go to the end of the input and send the current input. -- cgit v1.2.3 From 94bf5ca271c0c28bb08c5ef94b75ce17e89b03aa Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sat, 16 Dec 2017 17:02:24 +0200 Subject: Fix a docstring --- cider-repl.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index 452c2feb..2a76584f 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -700,7 +700,9 @@ If BOL is non-nil, emit at the beginning of the line." (defun cider-repl-emit-result (buffer string &optional bol show-prefix) "Emit into BUFFER the result STRING and mark it as an evaluation result. -If BOL is non-nil insert at the beginning of the line." +If BOL is non-nil insert at the beginning of the line. +If SHOW-PREFIX is non-nil insert `cider-repl-result-prefix' at the beginning +of the line." (with-current-buffer buffer (save-excursion (cider-save-marker cider-repl-output-start -- cgit v1.2.3 From c61037ef59f9ef33c4e7010bce158b502b827e3c Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sat, 16 Dec 2017 17:03:20 +0200 Subject: Fix indentation --- cider-repl.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index 2a76584f..17bb8871 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -711,7 +711,7 @@ of the line." (when (and bol (not (bolp))) (insert-before-markers "\n")) (when show-prefix - (insert-before-markers (propertize cider-repl-result-prefix 'font-lock-face 'font-lock-comment-face))) + (insert-before-markers (propertize cider-repl-result-prefix 'font-lock-face 'font-lock-comment-face))) (if cider-repl-use-clojure-font-lock (insert-before-markers (cider-font-lock-as-clojure string)) (cider-propertize-region -- cgit v1.2.3 From 95a168ff3b2936407edb612b96b3f7fdd3d13687 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Sat, 16 Dec 2017 17:07:34 +0200 Subject: Make show-prefix a required param for cider-repl-emit result It's used in all the existing function invocations, so there's no point to have it as an optional param. --- cider-repl.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index 17bb8871..815891a2 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -698,11 +698,10 @@ If BOL is non-nil, emit at the beginning of the line." (cider-repl--insert-prompt cider-buffer-ns)))) (cider-repl--show-maximum-output))) -(defun cider-repl-emit-result (buffer string &optional bol show-prefix) +(defun cider-repl-emit-result (buffer string show-prefix &optional bol) "Emit into BUFFER the result STRING and mark it as an evaluation result. -If BOL is non-nil insert at the beginning of the line. If SHOW-PREFIX is non-nil insert `cider-repl-result-prefix' at the beginning -of the line." +of the line. If BOL is non-nil insert at the beginning of the line." (with-current-buffer buffer (save-excursion (cider-save-marker cider-repl-output-start @@ -771,7 +770,7 @@ the symbol." (nrepl-make-response-handler buffer (let (after-first-result-chunk) (lambda (buffer value) - (cider-repl-emit-result buffer value t (not after-first-result-chunk)) + (cider-repl-emit-result buffer value (not after-first-result-chunk) t) (setq after-first-result-chunk t))) (lambda (buffer out) (cider-repl-emit-stdout buffer out)) @@ -782,7 +781,7 @@ the symbol." nrepl-err-handler (let (after-first-result-chunk) (lambda (buffer pprint-out) - (cider-repl-emit-result buffer pprint-out nil (not after-first-result-chunk)) + (cider-repl-emit-result buffer pprint-out (not after-first-result-chunk)) (setq after-first-result-chunk t))))) (defun cider-repl--send-input (&optional newline) -- cgit v1.2.3 From 7ab32081305aecc45b5786c1b35f3aeb2450a92c Mon Sep 17 00:00:00 2001 From: Tianxiang Xiong Date: Sun, 17 Dec 2017 17:58:25 -0800 Subject: Ignored unused parameter `win` in `cider-locref-help-echo` See: https://travis-ci.org/clojure-emacs/cider/jobs/317868987#L1071 --- cider-repl.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index 815891a2..ed8b033a 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -1101,7 +1101,7 @@ regexes from `cider-locref-regexp-alist' to infer locations at point." "Overlay used during hoovering on location references in REPL buffers. One for all REPLs.") -(defun cider-locref-help-echo (win buffer pos) +(defun cider-locref-help-echo (_win buffer pos) "Function for help-echo property in REPL buffers. WIN, BUFFER and POS are the window, buffer and point under mouse position." (with-current-buffer buffer -- cgit v1.2.3 From 677ec20a6c300e33686526175325dc7dafee7953 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Tue, 19 Dec 2017 20:27:19 +0200 Subject: [Fix #2112] Add a new interactive command cider-find-keyword It basically finds the first usage of the namespace-qualified keywords. For `::other.namespace/foo` this command would go to `other.namespace` and then find the first mention of `:foo` in it. --- cider-repl.el | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index ed8b033a..a2445ffe 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -1431,6 +1431,7 @@ constructs." (declare-function cider-find-resource "cider-interaction") (declare-function cider-restart "cider-interaction") (declare-function cider-find-ns "cider-interaction") +(declare-function cider-find-keyword "cider-interaction") (declare-function cider-switch-to-last-clojure-buffer "cider-mode") (defvar cider-repl-mode-map @@ -1440,6 +1441,7 @@ constructs." (define-key map (kbd "C-c C-t") 'cider-test-commands-map) (define-key map (kbd "M-.") #'cider-find-var) (define-key map (kbd "C-c C-.") #'cider-find-ns) + (define-key map (kbd "C-c C-:") #'cider-find-keyword) (define-key map (kbd "M-,") #'cider-pop-back) (define-key map (kbd "C-c M-.") #'cider-find-resource) (define-key map (kbd "RET") #'cider-repl-return) @@ -1486,6 +1488,7 @@ constructs." ("Find" ["Find definition" cider-find-var] ["Find resource" cider-find-resource] + ["Find keyword" cider-find-keyword] ["Go back" cider-pop-back]) "--" ["Switch to Clojure buffer" cider-switch-to-last-clojure-buffer] -- cgit v1.2.3 From 74889ac0af0d2f64ca0a748a005118d4ea300d82 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Tue, 19 Dec 2017 20:34:02 +0200 Subject: Mention cider-find-ns in the menus for cider-mode and cider-repl-mode --- cider-repl.el | 1 + 1 file changed, 1 insertion(+) (limited to 'cider-repl.el') diff --git a/cider-repl.el b/cider-repl.el index a2445ffe..1f4aa9d6 100644 --- a/cider-repl.el +++ b/cider-repl.el @@ -1487,6 +1487,7 @@ constructs." "--" ("Find" ["Find definition" cider-find-var] + ["Find namespace" cider-find-ns] ["Find resource" cider-find-resource] ["Find keyword" cider-find-keyword] ["Go back" cider-pop-back]) -- cgit v1.2.3