summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrotzeit <brotzeitmacher@gmail.com>2020-03-07 12:45:08 +0100
committerbrotzeit <brotzeitmacher@gmail.com>2020-03-07 12:45:08 +0100
commit21bd2583d040d42f71a86c40ea02904a6bc5e3cc (patch)
treef12f9e71c4b40a49b0127c883aa525063e373b97
parentcc10c2ee90190515f5acbe3803a9a0d8685485ad (diff)
use default mode-line in imenu mode
close #243
-rw-r--r--lsp-ui-imenu.el18
-rw-r--r--test/lsp-ui-flycheck-test.el4
2 files changed, 8 insertions, 14 deletions
diff --git a/lsp-ui-imenu.el b/lsp-ui-imenu.el
index 180092a..c7b4935 100644
--- a/lsp-ui-imenu.el
+++ b/lsp-ui-imenu.el
@@ -65,6 +65,10 @@
:type 'number
:group 'lsp-ui-menu)
+(defcustom lsp-ui-imenu--custom-mode-line-format nil
+ "Custom mode line format to be used in `lsp-ui-menu-mode'."
+ :group 'lsp-ui-menu)
+
(defconst lsp-ui-imenu--max-bars 8)
(declare-function imenu--make-index-alist 'imenu)
@@ -238,9 +242,6 @@ Return the updated COLOR-INDEX."
(defun lsp-ui-imenu--clear-bit (bits offset)
(logand bits (lognot (lsh 1 offset))))
-(defvar lsp-ui-imenu--custom-mode-line-format nil
- "Custom mode line format to be used in `lsp-ui-menu-mode'.")
-
(defvar lsp-ui-imenu-buffer-name "*lsp-ui-imenu*"
"Buffer name for imenu buffers.")
@@ -266,9 +267,8 @@ Return the updated COLOR-INDEX."
(lsp-ui-imenu--insert-items "" group padding bars 1 color-index)
(setq color-index (1+ color-index))))
(lsp-ui-imenu-mode)
- (setq mode-line-format
- (or lsp-ui-imenu--custom-mode-line-format
- '(:eval (lsp-ui-imenu--win-separator))))
+ (when lsp-ui-imenu--custom-mode-line-format
+ (setq mode-line-format lsp-ui-imenu--custom-mode-line-format))
(goto-char (point-min))
(add-hook 'post-command-hook 'lsp-ui-imenu--post-command nil t)))
(let ((win (display-buffer-in-side-window imenu-buffer '((side . right)))))
@@ -285,12 +285,6 @@ Return the updated COLOR-INDEX."
(let ((x (- lsp-ui-imenu-window-width (window-width))))
(window-resize (selected-window) x t))))))
-(defun lsp-ui-imenu--win-separator ()
- (when (and (window-combined-p)
- (window-next-sibling)
- (= (window-bottom-divider-width) 0))
- (propertize (make-string (window-total-width) ?\─) 'face 'window-divider)))
-
(defun lsp-ui-imenu--kill nil
(interactive)
(kill-buffer-and-window))
diff --git a/test/lsp-ui-flycheck-test.el b/test/lsp-ui-flycheck-test.el
index d4429ad..deef4bf 100644
--- a/test/lsp-ui-flycheck-test.el
+++ b/test/lsp-ui-flycheck-test.el
@@ -8,8 +8,8 @@
(buf (get-buffer-create "test-buffer"))
(dir (lsp-ui-test-create-project-buffer buf string))
(file (concat dir "src/main.rs"))
- (diagnostics "2: rustc: value assigned to `bar` is never read
-2: rustc: cannot assign twice to immutable variable `bar`
+ (diagnostics "3: rustc: value assigned to `bar` is never read
+3: rustc: cannot assign twice to immutable variable `bar`
"))
(sit-for 3)
(with-current-buffer buf