Instead of toggling the electric-indent-mode directly you can set the variable electric-indent-inhibit:
(lambda () (if (eq major-mode 'fundamental-mode)
(setq electric-indent-inhibit t))))
This variable is buffer local.
electric-indent-mode is a global mode, so if your function ever gets invoked, it will disable it everywhere.
You then also have the problem that if the global mode is enabled, new buffers which are never given a new major mode at all will have that behaviour, because the hook you're using never runs.
electric-indent-local-mode is the equivalent buffer-local ...
If you're using Emacs 27.1 or later, you can use:
Use add-hook with the LOCAL argument set a function for a specific buffer.
For more details see C-hig (elisp)Window Hooks
-(let ((buffer-name (format "*%s*" compile-buffer-name-no-asterisks)))
+(let ((compile-buffer-name (format "*%s*" compile-buffer-name-no-asterisks)))
Also, you should use add-hook with its LOCAL argument to add buffer-local hook functions (even with abnormal hooks like after-change-functions). Your current approach will cause multiple ...
I didn't get this to work via the elfeed-show-mode-hook. I don't really fully understand what is going on, but I think it is something to do with the margins set by olivetti mode not activating until after the buffer is displayed, but elfeed renders the buffer before that and so the HTML renderer doesn't get the updated text width.
However, I was able to ...
The documentation gives the answer.
Don't run this hook directly. It is meant to be run as part of
As a rule, -- in the name is an indication that it's a private unit not intended to be used by us mere mortals.
If you collect your packages to upgrade into a list, then a function like this should work.
(dolist (p my-...