summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-07-11 19:09:46 +0100
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-07-13 12:35:09 +0100
commit8d79f8f0b28193d08d99a85e59a97dbc0b309282 (patch)
tree3a36df3f53ed4dd9d487ecf4ac9134a6ce9ca26e
parent36e6b0a4a85a5296903ed2a163534c016cfb4aaf (diff)
Improve mode-line lighter
-rw-r--r--cider-interaction.el5
-rw-r--r--cider-mode.el22
-rw-r--r--nrepl-client.el8
3 files changed, 27 insertions, 8 deletions
diff --git a/cider-interaction.el b/cider-interaction.el
index 59752ee8..2b935f30 100644
--- a/cider-interaction.el
+++ b/cider-interaction.el
@@ -312,7 +312,10 @@ Signal an error if it is not supported."
Info contains project name, current REPL namespace, host:port
endpoint and Clojure version."
(with-current-buffer (get-buffer connection-buffer)
- (format "Active nREPL connection: %s@%s:%s (Java %s, Clojure %s, nREPL %s)"
+ (format "Active nREPL connection: %s%s@%s:%s (Java %s, Clojure %s, nREPL %s)"
+ (if nrepl-sibling-buffer-alist
+ (upcase (concat cider-repl-type " "))
+ "")
(or (nrepl--project-name nrepl-project-dir) "<no project>")
(car nrepl-endpoint)
(cadr nrepl-endpoint)
diff --git a/cider-mode.el b/cider-mode.el
index 388d5418..0a0e3b79 100644
--- a/cider-mode.el
+++ b/cider-mode.el
@@ -33,17 +33,29 @@
(require 'cider-interaction)
(require 'cider-eldoc)
+(defcustom cider-mode-line-show-connection t
+ "If the mode-line lighter should detail the connection."
+ :group 'cider
+ :type 'boolean
+ :package-version '(cider "0.10.0"))
+
(defun cider--modeline-info ()
"Return info for the `cider-mode' modeline.
Info contains project name and host:port endpoint."
- (let ((current-connection (nrepl-current-connection-buffer t)))
+ (let ((current-connection (cider-current-repl-buffer)))
(if current-connection
(with-current-buffer current-connection
- (format "%s@%s:%s"
- (or (nrepl--project-name nrepl-project-dir) "<no project>")
- (car nrepl-endpoint)
- (cadr nrepl-endpoint)))
+ (concat
+ (when nrepl-sibling-buffer-alist
+ (concat cider-repl-type ":"))
+ (when cider-mode-line-show-connection
+ (format "%s@%s:%s"
+ (or (nrepl--project-name nrepl-project-dir) "<no project>")
+ (pcase (car nrepl-endpoint)
+ ("localhost" "")
+ (x x))
+ (cadr nrepl-endpoint)))))
"not connected")))
;;;###autoload
diff --git a/nrepl-client.el b/nrepl-client.el
index c1430dc5..b7731eaa 100644
--- a/nrepl-client.el
+++ b/nrepl-client.el
@@ -1421,13 +1421,17 @@ The connections buffer is determined by
(buffer (get-buffer connection))
(endpoint (buffer-local-value 'nrepl-endpoint buffer)))
(insert
- (format "%s %-16s %5s %s"
+ (format "%s %-16s %5s %s%s"
(if (equal connection (car nrepl-connection-list)) "*" " ")
(car endpoint)
(prin1-to-string (cadr endpoint))
(or (nrepl--project-name
(buffer-local-value 'nrepl-project-dir buffer))
- "")))))
+ "")
+ (with-current-buffer buffer
+ (if nrepl-sibling-buffer-alist
+ (concat " " cider-repl-type)
+ ""))))))
(defun nrepl--project-name (stack)
"Extracts a project name from STACK, possibly nil.