Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Attempted fix for fireplace not resizing easily #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Mallchad
Copy link

@Mallchad Mallchad commented Jul 20, 2021

I noticed that my fireplace wasn't resizing dynamically very easily,
and whislt this wasn't really a big deal, I got curious and had a look.
I want my fireplace to be cozy! <3

The actual offending line is rather
Line 244:
'(add-hook 'window-size-change-functions 'fireplace--update-locals-vars nil t)'
As per the documentation the
'Functions called during redisplay when window sizes have changed.
The value should be a list of functions that take one argument.'

So that's all the problem is, the function is being called with an argument it
isn't expecting, the documentation states it passes the window as an argument.
But here we don't care about that, so I just added a 'stub-window' to 'eat' the
argument.

Although, it occurs to me this might be a bit lazy, and I could quite easily use the passed
argument to update the fileplace vars, instead of searching for the (hardcoded) buffer every time.
But hey, it works.

Also here I used &optional because of that one other time when the
update-vars function is called, but again, this could easily be adaopted
to supply the window context properly.

EDIT:
I should note that I've been using this fix for a solid year or something, by straight overriding the
function with a nearly identical copy of 7296ced in my 'init.el'.
It should work just fine.

Mallchad and others added 3 commits July 20, 2021 14:58
I noticed that my fireplace wasn't resizing dynamically very easily,
and whislt this wasn't really a big deal, I got curious and had a look.

The actual offending line is rather
Line 244:
 '(add-hook 'window-size-change-functions 'fireplace--update-locals-vars nil t)'
As per the documentation the
'Functions called during redisplay when window sizes have changed.
The value should be a list of functions that take one argument.'

So that's all the prboelm is, the function is being called with an argument it
isn't expecting, the documentation states it passes the window as an argument.
But here we don't care about that, so I just added a 'stub-window' to 'eat' the
argument.

Although, it occurs to me this might be a bit lazy, and I could quite easily use the passed
argument to update the fileplace vars, instead of searching for the (hardcoded) buffer every time.
But hey, it works.

Also here I used &optional because of that one other time when the
update-vars function is called, but again, this could easily be adaopted
to supply the window context properly.
There was a problem that was driving me up the wall after I tinkered with
my fireplace config, and I didn't realize it for ages,
but when you call 'fireplace' it also calls 'fireplace--disable-minor-modes',
which, I think it rather innocently tries to disable some functions to help
improve the visual experience, including 'transient-mark-mode'.
Actually it *enables* it.

The mode system in emacs is quirky and when using a variable, nil is off and
non-nil is on.
But for mode functions, generally negative arguments is off, and non-nil
or omitted arguments is on.
So, paradoxically, the omitted 'nil', enables it, which also happens to be a
global mode.

The replacement tries to fix it by using setq-local instead to prevent global
settings from being overridden.
I have no idea if it will cause issues with not affecting the modes on the
fireplace start, as that often happens with settings variables and modes with
variables, especially locally.
But its much better than modifying the global environment and hoping it does not
affect the user.
I saw an opportunity to disable some more modes to clean up the fireplace,
so I did.
One mode of which is a little more niche and not a standard emacs package, but
it SHOULD NOT break anything.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant