I want to have "read-only-mode" enabled in all programming buffers, including the starting buffer "scratch".
If I add the line
(add-hook 'prog-mode-hook 'read-only-mode)
Running emacs as daemon with "emacs --daemon" will halt at
Due to a limitation in GTK 3, Emacs built with PGTK will simply exit when a
display connection is closed. The problem is especially difficult to fix,
such that Emacs on Wayland with multiple displays is unlikely ever to be able
to survive disconnects.
Starting Emacs daemon.
And the process is kept "halting" where the prompt is not returned.
Here are other situations:
- Running as non-daemon works fine.
- Specifying another function to "prog-mode-hook" works fine.
- I've tried "(add-hook 'after-init-hook (lambda () (add-hook 'prog-mode-hook 'read-only-mode)))", but it still halts.
- I've tried "(add-hook 'emacs-startup-hook (lambda () (add-hook 'prog-mode-hook 'read-only-mode)))", this tiime it finishes daemonizing, but the "scratch buffer of an emacs client is not locked with "read-only-mode", only later for other source files when opened.
Running version "GNU Emacs 29.1" with pgtk under wayland.
What's happening?
I know it's almost achievable to the goal, by adding function that checks for every buffer if it's "scratch", but this is extremely ugly and consumes unnecessary resouces. Is there a better solution?