Skip to content

Conversation

@danielmartin
Copy link
Contributor

With some standard mode lines, lsp-treemacs always shows "Treemacs" in the mode line, making panes difficult to distinguish.

This PR solves the problem by setting either of these two buffer local variables:

  • mode-name. For Doom/Spacemacs/Moody, Treemacs builds a custom mode-line-format that displays the mode name along with other info in a propertized way.
  • mode-line-format. In standard mode lines, Treemacs modifies the mode-line-format to show " Treemacs ", so from lsp-treemacs we'll do the same but show a descriptive pane title instead.

I think this PR supersedes #10, so I've removed the major modes that that PR created.

In standard mode lines, the custom references title was not shown,
only default " Treeemacs ".

* lsp-treemacs.el (lsp-treemacs--set-mode-line-format): New
function. Sets a Treemacs buffer mode-name or mode-line-format.
(lsp-treemacs--show-references): Call
`lsp-treemacs--set-mode-line-format`.
(lsp-treemacs--do-search): Call `lsp-treemacs--set-mode-line-format`.
(lsp-treemacs-references): Add a space to make the title more legible
in the default mode line format.
(lsp-treemacs-implementations): Add a space to make the title more
legible in the default mode line format.
A couple of major modes were derived from `treemacs-mode` just to have
a custom mode line, which seems unnecessary.

* lsp-treemacs.el (lsp-treemacs-errors-mode): Remove major mode.
(lsp-treemacs-java-deps-mode): Remove major mode.
(lsp-treemacs-errors-list): Call `lsp-treemacs--set-mode-line-format`.
(lsp-treemacs-java-deps-list): Call `lsp-treemacs--set-mode-line-format`.
@danielmartin
Copy link
Contributor Author

@yyoncho What we discussed in Gitter. I've tested with a standard mode line and a Doom mode line and this approach seems to work as expected. It wouldn't be a bad idea to test this with Spacemacs mode line as well.

@yyoncho yyoncho merged commit 205260a into emacs-lsp:master Dec 24, 2019
@yyoncho
Copy link
Member

yyoncho commented Dec 24, 2019

Looks good! We should do the same for dap-mode as well. I tested with spaceline and it works fine.

@danielmartin danielmartin deleted the mode-line-improvements branch December 24, 2019 09:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants