* Changing value for fill-column
@ 2022-08-28 12:17 wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-28 14:11 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-28 12:17 UTC (permalink / raw
To: Help Gnu Emacs
How can I change fill-column. Have changed it in my init file using (setq fill-column 65)
but it not taking effect in major modes.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Changing value for fill-column
2022-08-28 12:17 Changing value for fill-column wilnerthomas--- via Users list for the GNU Emacs text editor
@ 2022-08-28 14:11 ` Eli Zaretskii
2022-08-28 14:20 ` wilnerthomas--- via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-08-28 14:11 UTC (permalink / raw
To: help-gnu-emacs
> Date: Sun, 28 Aug 2022 14:17:08 +0200 (CEST)
> From: wilnerthomas--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
>
>
> How can I change fill-column. Have changed it in my init file using (setq fill-column 65)
> but it not taking effect in major modes.
The doc string says:
Automatically becomes buffer-local when set.
So you either need to set it in a mode-hook of each mode where you
want to change the default value, or you should use setq-default to
change the default value in all buffers.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Changing value for fill-column
2022-08-28 14:11 ` Eli Zaretskii
@ 2022-08-28 14:20 ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-28 14:33 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-28 14:20 UTC (permalink / raw
To: Eli Zaretskii; +Cc: help-gnu-emacs
Aug 28, 2022, 14:11 by eliz@gnu.org:
>> Date: Sun, 28 Aug 2022 14:17:08 +0200 (CEST)
>> From: wilnerthomas--- via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
>>
>>
>> How can I change fill-column. Have changed it in my init file using (setq fill-column 65)
>> but it not taking effect in major modes.
>>
>
> The doc string says:
>
> Automatically becomes buffer-local when set.
>
> So you either need to set it in a mode-hook of each mode where you
> want to change the default value, or you should use setq-default to
> change the default value in all buffers.
>
I know how to add hook to major mode with a function but not using a variable.
(add-hook 'prog-mode-hook #'display-fill-column-indicator-mode)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Changing value for fill-column
2022-08-28 14:20 ` wilnerthomas--- via Users list for the GNU Emacs text editor
@ 2022-08-28 14:33 ` Eli Zaretskii
2022-08-28 14:51 ` wilnerthomas--- via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-08-28 14:33 UTC (permalink / raw
To: help-gnu-emacs
> Date: Sun, 28 Aug 2022 16:20:14 +0200 (CEST)
> From: wilnerthomas@tutanota.com
> Cc: help-gnu-emacs@gnu.org
>
> > The doc string says:
> >
> > Automatically becomes buffer-local when set.
> >
> > So you either need to set it in a mode-hook of each mode where you
> > want to change the default value, or you should use setq-default to
> > change the default value in all buffers.
> >
> I know how to add hook to major mode with a function but not using a variable.
>
> (add-hook 'prog-mode-hook #'display-fill-column-indicator-mode)
You need to write a function that will both set fill-column and turn
on display-fill-column-indicator-mode.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Changing value for fill-column
2022-08-28 14:33 ` Eli Zaretskii
@ 2022-08-28 14:51 ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-28 15:07 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-28 14:51 UTC (permalink / raw
To: Eli Zaretskii; +Cc: help-gnu-emacs
Aug 28, 2022, 14:33 by eliz@gnu.org:
>> Date: Sun, 28 Aug 2022 16:20:14 +0200 (CEST)
>> From: wilnerthomas@tutanota.com
>> Cc: help-gnu-emacs@gnu.org
>>
>> > The doc string says:
>> >
>> > Automatically becomes buffer-local when set.
>> >
>> > So you either need to set it in a mode-hook of each mode where you
>> > want to change the default value, or you should use setq-default to
>> > change the default value in all buffers.
>> >
>> I know how to add hook to major mode with a function but not using a variable.
>>
>> (add-hook 'prog-mode-hook #'display-fill-column-indicator-mode)
>>
>
> You need to write a function that will both set fill-column and turn
> on display-fill-column-indicator-mode.
>
I also want the new fill-column value to be taken by ruler-mode
Have done the following
(defun column-property ()
(setq fill-column 72))
(add-hook 'prog-mode-hook #'column-property)
(add-hook 'org-mode-hook #'column-property)
(add-hook 'text-mode-hook #'column-property)
(add-hook 'lisp-interaction-mode-hook #'column-property)
The command "C-h f setq-default" states
The default value of a variable is seen in buffers
that do not have their own values for the variable.
But I want to change the value even if buffer has its own value for fill-column
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Changing value for fill-column
2022-08-28 14:51 ` wilnerthomas--- via Users list for the GNU Emacs text editor
@ 2022-08-28 15:07 ` Eli Zaretskii
2022-08-28 15:14 ` wilnerthomas--- via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-08-28 15:07 UTC (permalink / raw
To: help-gnu-emacs
> Date: Sun, 28 Aug 2022 16:51:58 +0200 (CEST)
> From: wilnerthomas@tutanota.com
> Cc: help-gnu-emacs@gnu.org
>
> The command "C-h f setq-default" states
>
> The default value of a variable is seen in buffers
> that do not have their own values for the variable.
>
> But I want to change the value even if buffer has its own value for fill-column
If you do that in your init file, no buffer will have a local value
yet.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Changing value for fill-column
2022-08-28 15:07 ` Eli Zaretskii
@ 2022-08-28 15:14 ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-28 15:32 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-28 15:14 UTC (permalink / raw
To: Eli Zaretskii; +Cc: help-gnu-emacs
Aug 28, 2022, 15:07 by eliz@gnu.org:
>> Date: Sun, 28 Aug 2022 16:51:58 +0200 (CEST)
>> From: wilnerthomas@tutanota.com
>> Cc: help-gnu-emacs@gnu.org
>>
>> The command "C-h f setq-default" states
>>
>> The default value of a variable is seen in buffers
>> that do not have their own values for the variable.
>>
>> But I want to change the value even if buffer has its own value for fill-column
>>
>
> If you do that in your init file, no buffer will have a local value
> yet.
>
How do these local values get set when users do not perform setq-default in their init file?
Some modes set them up if there is no mode-hook for it already?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Changing value for fill-column
2022-08-28 15:14 ` wilnerthomas--- via Users list for the GNU Emacs text editor
@ 2022-08-28 15:32 ` Eli Zaretskii
2022-08-29 8:39 ` wilnerthomas--- via Users list for the GNU Emacs text editor
0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2022-08-28 15:32 UTC (permalink / raw
To: help-gnu-emacs
> Date: Sun, 28 Aug 2022 17:14:25 +0200 (CEST)
> From: wilnerthomas@tutanota.com
> Cc: help-gnu-emacs@gnu.org
>
>
> Aug 28, 2022, 15:07 by eliz@gnu.org:
>
> >> But I want to change the value even if buffer has its own value for fill-column
> >>
> > If you do that in your init file, no buffer will have a local value
> > yet.
> >
> How do these local values get set when users do not perform setq-default in their init file?
> Some modes set them up if there is no mode-hook for it already?
Modes don't set these variables; users do.
setq-default sets the default value, and that default value will be in
effect in every new buffer, unless someone -- you -- changes the value
in that buffer. Since you want the same different value in all
buffers, you will probably not set the value in individual buffers,
and thus the default which you changed with setq-default will stay in
effect.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Changing value for fill-column
2022-08-28 15:32 ` Eli Zaretskii
@ 2022-08-29 8:39 ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-29 11:32 ` Eli Zaretskii
0 siblings, 1 reply; 10+ messages in thread
From: wilnerthomas--- via Users list for the GNU Emacs text editor @ 2022-08-29 8:39 UTC (permalink / raw
To: Eli Zaretskii; +Cc: help-gnu-emacs
Aug 28, 2022, 15:32 by eliz@gnu.org:
>> Date: Sun, 28 Aug 2022 17:14:25 +0200 (CEST)
>> From: wilnerthomas@tutanota.com
>> Cc: help-gnu-emacs@gnu.org
>>
>>
>> Aug 28, 2022, 15:07 by eliz@gnu.org:
>>
>> >> But I want to change the value even if buffer has its own value for fill-column
>> >>
>> > If you do that in your init file, no buffer will have a local value
>> > yet.
>> >
>> How do these local values get set when users do not perform setq-default in their init file?
>> Some modes set them up if there is no mode-hook for it already?
>>
>
> Modes don't set these variables; users do.
>
> setq-default sets the default value, and that default value will be in
> effect in every new buffer, unless someone -- you -- changes the value
> in that buffer. Since you want the same different value in all
> buffers, you will probably not set the value in individual buffers,
> and thus the default which you changed with setq-default will stay in
> effect.
>
And once a user uses setq-default for a variable that variable cannot be changed again.
If users do not change fill-column, how does ruler-mode set the value?
For the hook you mentioned, I have done as follows
(defun column-property () (setq fill-column 72))
(add-hook 'prog-mode-hook #'column-property)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Changing value for fill-column
2022-08-29 8:39 ` wilnerthomas--- via Users list for the GNU Emacs text editor
@ 2022-08-29 11:32 ` Eli Zaretskii
0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2022-08-29 11:32 UTC (permalink / raw
To: help-gnu-emacs
> Date: Mon, 29 Aug 2022 10:39:50 +0200 (CEST)
> From: wilnerthomas@tutanota.com
> Cc: help-gnu-emacs@gnu.org
>
> Aug 28, 2022, 15:32 by eliz@gnu.org:
>
> >> How do these local values get set when users do not perform setq-default in their init file?
> >> Some modes set them up if there is no mode-hook for it already?
> >>
> >
> > Modes don't set these variables; users do.
> >
> > setq-default sets the default value, and that default value will be in
> > effect in every new buffer, unless someone -- you -- changes the value
> > in that buffer. Since you want the same different value in all
> > buffers, you will probably not set the value in individual buffers,
> > and thus the default which you changed with setq-default will stay in
> > effect.
> >
> And once a user uses setq-default for a variable that variable cannot be changed again.
Of course, they can: by another setq-default or by setq (the latter
possibly locally for the buffer that is the current one when the
command is invoked).
> If users do not change fill-column, how does ruler-mode set the value?
It doesn't. It _uses_ the value set for the buffer.
> For the hook you mentioned, I have done as follows
>
> (defun column-property () (setq fill-column 72))
>
> (add-hook 'prog-mode-hook #'column-property)
OK. Is there any problem with this?
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-08-29 11:32 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-28 12:17 Changing value for fill-column wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-28 14:11 ` Eli Zaretskii
2022-08-28 14:20 ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-28 14:33 ` Eli Zaretskii
2022-08-28 14:51 ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-28 15:07 ` Eli Zaretskii
2022-08-28 15:14 ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-28 15:32 ` Eli Zaretskii
2022-08-29 8:39 ` wilnerthomas--- via Users list for the GNU Emacs text editor
2022-08-29 11:32 ` Eli Zaretskii
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.