Closed Munksgaard closed 3 years ago
Sat Dec 12 08:22:28 GMT 2020
HI @Munksgaard ,
From the elpher
source code, elpher
does not have any hooks.
This could be discovered by trying to search for the variable elpher-mode-hook
using describe-variable
: M-x describe-variable
.
As elpher-mode
is derived from special-mode
you could instead add the lambda
to special-mode-hook
.
Alternatively, (setq-local show-trailing-whitespace nil)
in :config
should work.
Hi @rprimus
That's odd, when I C-h v elpher-mode-hook
I get the following:
elpher-mode-hook is a variable defined in ‘elpher.el’.
Its value is nil
This variable may be risky if used as a file-local variable.
Documentation:
Hook run after entering elpher mode.
No problems result if this variable is not bound.
‘add-hook’ automatically binds it. (This is true for all hook variables.)
Where does that hook come from, then? I'm confused...
Alternatively,
(setq-local show-trailing-whitespace nil)
in:config
should work.
This also doesn't seem to work for some reason. Could there be something else wrong with my setup?
Sat Dec 12 10:29:01 GMT 2020
Where does that hook come from, then?
My bad. elpher-mode-hook
gets created when elpher-mode
is defined (by call to macro define-derived-mode
).
After setting up elpher
in a vanilla emacs session (emacs -Q
), I am seeing show-trailing-whitespace
as a buffer local
variable.
Please try the following:
elpher-mode
, M-x describe-mode
.
whitespace-mode
show as an active mode?whitespace-mode
- do the red areas disappear?lambda
to:
(lambda ()
(whitespace-mode -1))
elpher-mode
and:
(a) See if the 'red' is still showingThis also doesn't seem to work for some reason. Could there be something else wrong with my setup?
(b) If it is, there may be another mode that is re-enabling `whitespace-mode` and/or resetting
the value of `show-trailing-whitespace`.
This was all my silly mistake. See if you can spot the typo in my configuration code.
Thanks @rprimus for helping out!
Elpher is my favorite way of browsing gemini- and gopherspace. It feels natural and intuitive to use. However, it shows lots of trailing whitespace, for some reason. In my .emacs I have globally enabled show-trailing-whitespace. That makes many gopher and gemini pages render with ugly red boxes all over. I therefore wanted to disable show-trailing-whitespace in elpher buffers, and put the following in my .emacs:
But it doesn't seem to work? When I inspect elpher-mode-hook afterwards, it's still nil, as if the hook never ran. What gives?