Doom-emacs: [HOWTO] Customize the doom-modeline

Created on 23 Sep 2019  路  4Comments  路  Source: hlissner/doom-emacs

What I want to achieve
Not sure if this is a doom, doom-modeline or general emacs question:

I want to set the following variables:

;; doom.d/config.el
(setq 
 doom-modeline-buffer-encoding nil
 size-indication-mode nil
 column-number-mode nil
 line-number-mode nil
)

This works fine, when I set the variables manually for the current buffer, but it gets overwritten, when I open another buffer.

Is there a hook I need to put this in?

:ui modeline question elisp

Most helpful comment

Try this:

(after! doom-modeline
  (remove-hook 'doom-modeline-mode-hook #'size-indication-mode) ; filesize in modeline
  (remove-hook 'doom-modeline-mode-hook #'column-number-mode)   ; cursor column in modeline
  (line-number-mode -1)
  (setq doom-modeline-buffer-encoding nil))

All 4 comments

At least for size-indication-mode I need to do this:

(add-hook! 'size-indication-mode-hook
  (setq size-indication-mode nil))

Not sure for the rest.

Maybe this works:

(add-hook! 'column-number-mode-hook
  (setq column-number-mode nil))

(add-hook! 'line-number-mode-hook
  (setq line-number-mode nil))

For doom-modeline-buffer-encoding, (setq doom-modeline-buffer-encoding nil) should work.

Try this:

(after! doom-modeline
  (remove-hook 'doom-modeline-mode-hook #'size-indication-mode) ; filesize in modeline
  (remove-hook 'doom-modeline-mode-hook #'column-number-mode)   ; cursor column in modeline
  (line-number-mode -1)
  (setq doom-modeline-buffer-encoding nil))

Thanks @thiagokokada and @hlissner . The latter approach worked.

Just so I can ask more informed questions in the future: What is your heuristic for such a problem? How do you work towards figuring out, that for some cases (doom-modeline-buffer-encoding) setting a variable works and for others you have to go look for a hook? And how do you go about finding the hook? :)

Was this page helpful?
0 / 5 - 0 ratings