Lefantom55 · 2022-07-31 12:13
Hello reddit !
I am trying to swap the modeline with the headerline completely.
For now I use this snippet of code to have my modeline in my headerline and vice-versa :
```
(defvar og-modeline mode-line-format)
(setq-default mode-line-format header-line-format)
(setq-default header-line-format og-modeline)
```
This works well except that I'd like to see the empty modeline (as a separator) but it doesn't show because header-line-format is empty. Is it possible to have an empty string and keep the header-line-format ?
My other problem is that lsp-headerline still shows in the real header-line which I don't want to. Do you know how I could move it down there ?
Maybe there is a better way to swap the modeline and the headerline ?
Thank you for your help
TheFrenchPoulp · 2022-07-31 13:18
> Is it possible to have an empty string and keep the header-line-format
Have you tried a space in there rather than empty string?
> My other problem is that lsp-headerline still shows in the real header-line which don't want to
I would study the code from your LSP client that is responsible for the header-line and see how difficult it is to customize `mode-line-format` instead of `header-line-format`
Lefantom55 · 2022-07-31 14:45
>Have you tried a space in there rather than empty string?
I did and it works, there is now an empty mode-line.
>I would study the code from your LSP client that is responsible for the mode-line
Good suggestion, I went check the code that generates the headline and in fact, it does append to the current header-line-format their things. I guess changing this to \`mode-line-format\` instead would fix it.
​
What would be the best way to override a package-defined function ?
EDIT : maybe swapping the references would do the job in a cleaner manner ?
I mean redirect every action applied on header-line-format affect mode-line-format instead and vice-versa
TheFrenchPoulp · 2022-07-31 15:59
You can *advise* an existing function in many different ways https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html
Lefantom55 · 2022-07-31 17:10
I didn't know this was a feature, I'll have a look thanks !