|
From: | Joel Reicher |
Subject: | Re: fill-column setq-default and add-hook |
Date: | Wed, 04 Dec 2024 23:00:12 +1100 |
User-agent: | Gnus/5.13 (Gnus v5.13) |
I want to understand the setting of fill-column. It is a buffer local variable.But then there the following possibilities (setq-default fill-column 72) and (add-hook 'prog-mode-hook (lambda () (setq fill-column 72))) The first sets fill-column globally.
It sets a default value, which is a different instance than any of the buffer local instances. ("Instance" is not strictly the correct term, but I'm trying it on.)
What does that mean? I interpret that the value is set globally but only to those buffers for which there is no local binding.
It doesn't set anything for a buffer. It sets the default instance. Any buffer that lacks a local instance will use that default instance. Any local instance created after that will default to the value of that default instance.
This setting the value (setq-default fill-column 72) does not always work for the current buffer.
It's not really doing anything to any buffer. It's doing something to the default instance. The question of which buffers (if any) use that instance is separate.
How can one solve this problem?
If you want to set the current buffer's value, use setq.
What does the mode hook do exactly?
When you enter a mode derived from prog-mode, it will set fill-column to 72, which for that variable creates a buffer local instance of it (and sets that instance).
Regards, - Joel
[Prev in Thread] | Current Thread | [Next in Thread] |