diff options
author | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-07-11 19:09:46 +0100 |
---|---|---|
committer | Artur Malabarba <bruce.connor.am@gmail.com> | 2015-07-13 12:35:09 +0100 |
commit | 8d79f8f0b28193d08d99a85e59a97dbc0b309282 (patch) | |
tree | 3a36df3f53ed4dd9d487ecf4ac9134a6ce9ca26e /cider-mode.el | |
parent | 36e6b0a4a85a5296903ed2a163534c016cfb4aaf (diff) |
Improve mode-line lighter
Diffstat (limited to 'cider-mode.el')
-rw-r--r-- | cider-mode.el | 22 |
1 files changed, 17 insertions, 5 deletions
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 |