* Setting fill-column and others for text-mode
@ 2008-10-24 14:13 Decebal
2008-10-24 15:52 ` Nikolaj Schumacher
[not found] ` <mailman.2012.1224863529.25473.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 7+ messages in thread
From: Decebal @ 2008-10-24 14:13 UTC (permalink / raw)
To: help-gnu-emacs
I would like to set fill-column, left-margin, tab-width and default-
justification for text-mode, but I do not manage to get this working.
How can this be done?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Setting fill-column and others for text-mode
2008-10-24 14:13 Setting fill-column and others for text-mode Decebal
@ 2008-10-24 15:52 ` Nikolaj Schumacher
[not found] ` <mailman.2012.1224863529.25473.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 7+ messages in thread
From: Nikolaj Schumacher @ 2008-10-24 15:52 UTC (permalink / raw)
To: Decebal; +Cc: help-gnu-emacs
Decebal <CLDWesterhof@gmail.com> wrote:
> I would like to set fill-column, left-margin, tab-width and default-
> justification for text-mode, but I do not manage to get this working.
> How can this be done?
You can set them inside a hook like this:
(setq fill-column 70)
You already know how to do hooks.
regards,
Nikolaj Schumacher
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Setting fill-column and others for text-mode
[not found] ` <mailman.2012.1224863529.25473.help-gnu-emacs@gnu.org>
@ 2008-10-24 16:54 ` Decebal
2008-10-24 18:06 ` Lennart Borgman
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Decebal @ 2008-10-24 16:54 UTC (permalink / raw)
To: help-gnu-emacs
On 24 okt, 17:52, Nikolaj Schumacher <m...@nschum.de> wrote:
\> > I would like to set fill-column, left-margin, tab-width and
default-
> > justification for text-mode, but I do not manage to get this working.
> > How can this be done?
>
> You can set them inside a hook like this:
> (setq fill-column 70)
It has to be:
(setq-default fill-column 72)
For fill-column and tab-width I thought it better to do it globally.
I also use:
(add-hook 'text-mode-hook (lambda () (refill-mode 1) (setq-default
default-justification 'full)))
(add-hook 'org-mode-hook (lambda () (refill-mode 0) (setq-default
default-justification 'left)))
But this only works partly. Refill-mode is t for text-mode and nill
for or-mode, but default-justification is for both full. What is going
wrong here?
I also tried:
(add-hook 'org-mode-hook (lambda () (refill-mode 0)))
(add-hook 'org-mode-hook (lambda () (setq-default default-
justification 'left)))
But with the same result.
And I would prefer something like:
(defun text-justification ()
(interactive)
(refill-mode 1)
(setq-default default-justification 'full)
)
(defun text-no-justification ()
(interactive)
(refill-mode 0)
(setq-default default-justification 'left)
)
(add-hook 'text-mode-hook 'text-justification)
(add-hook 'org-mode-hook 'text-no-justification)
Can something like this be done?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Setting fill-column and others for text-mode
2008-10-24 16:54 ` Decebal
@ 2008-10-24 18:06 ` Lennart Borgman
[not found] ` <mailman.2016.1224871573.25473.help-gnu-emacs@gnu.org>
2008-10-26 13:58 ` Kevin Rodgers
2 siblings, 0 replies; 7+ messages in thread
From: Lennart Borgman @ 2008-10-24 18:06 UTC (permalink / raw)
To: Decebal; +Cc: help-gnu-emacs
On Fri, Oct 24, 2008 at 6:54 PM, Decebal <CLDWesterhof@gmail.com> wrote:
> I also use:
> (add-hook 'text-mode-hook (lambda () (refill-mode 1) (setq-default
> default-justification 'full)))
> (add-hook 'org-mode-hook (lambda () (refill-mode 0) (setq-default
> default-justification 'left)))
>
> But this only works partly. Refill-mode is t for text-mode and nill
> for or-mode, but default-justification is for both full. What is going
> wrong here?
You hit a documentation barrier in space-time. The doc string for
org-mode simply does not tell you some essential things:
- org-mode is made by define-derived-mode from outline-mode
- outline-mode is similar made from text-mode
- the mode hooks from the ancestor modes are run before the mode hook
In this case it means that when you turn on org-mode then the
following hooks are run at the end by run-mode-hooks, in this order:
text-mode-hook, outline-mode-hook, org-mode-hook
This (together with how setq-default works) can probably explain what you see.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Setting fill-column and others for text-mode
[not found] ` <mailman.2016.1224871573.25473.help-gnu-emacs@gnu.org>
@ 2008-10-25 8:03 ` Decebal
2008-10-25 8:49 ` Lennart Borgman
0 siblings, 1 reply; 7+ messages in thread
From: Decebal @ 2008-10-25 8:03 UTC (permalink / raw)
To: help-gnu-emacs
On Oct 24, 8:06 pm, "Lennart Borgman" <lennart.borg...@gmail.com>
wrote:
> > I also use:
> > (add-hook 'text-mode-hook (lambda () (refill-mode 1) (setq-default
> > default-justification 'full)))
> > (add-hook 'org-mode-hook (lambda () (refill-mode 0) (setq-default
> > default-justification 'left)))
>
> > But this only works partly. Refill-mode is t for text-mode and nill
> > for or-mode, but default-justification is for both full. What is going
> > wrong here?
>
> You hit a documentation barrier in space-time. The doc string for
> org-mode simply does not tell you some essential things:
>
> - org-mode is made by define-derived-mode from outline-mode
> - outline-mode is similar made from text-mode
> - the mode hooks from the ancestor modes are run before the mode hook
>
> In this case it means that when you turn on org-mode then the
> following hooks are run at the end by run-mode-hooks, in this order:
>
> text-mode-hook, outline-mode-hook, org-mode-hook
>
> This (together with how setq-default works) can probably explain what you see.
I think I can best disable the hook and just execute text-
justification.
I have defined the folowing functions (and removed the add-hook) and
this seems to work:
(defun text-justification ()
(interactive)
(refill-mode 1)
(setq-default default-justification 'full)
)
(defun text-no-justification ()
(interactive)
(refill-mode 0)
(setq-default default-justification 'left)
)
Is there otherwise a possibility to execute text-justification only on
functions ending with (for example) .txt?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Setting fill-column and others for text-mode
2008-10-25 8:03 ` Decebal
@ 2008-10-25 8:49 ` Lennart Borgman
0 siblings, 0 replies; 7+ messages in thread
From: Lennart Borgman @ 2008-10-25 8:49 UTC (permalink / raw)
To: Decebal; +Cc: help-gnu-emacs
On Sat, Oct 25, 2008 at 10:03 AM, Decebal <CLDWesterhof@gmail.com> wrote:
> Is there otherwise a possibility to execute text-justification only on
> functions ending with (for example) .txt?
Look at the hooks in Emacs manual. There is an `after-change-major-mode-hook'.
BTW it would be nice if someone made a summary of all the hooks run
when opening a file.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Setting fill-column and others for text-mode
2008-10-24 16:54 ` Decebal
2008-10-24 18:06 ` Lennart Borgman
[not found] ` <mailman.2016.1224871573.25473.help-gnu-emacs@gnu.org>
@ 2008-10-26 13:58 ` Kevin Rodgers
2 siblings, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2008-10-26 13:58 UTC (permalink / raw)
To: help-gnu-emacs
Decebal wrote:
> On 24 okt, 17:52, Nikolaj Schumacher <m...@nschum.de> wrote:
> \> > I would like to set fill-column, left-margin, tab-width and
> default-
>>> justification for text-mode, but I do not manage to get this working.
>>> How can this be done?
>> You can set them inside a hook like this:
>> (setq fill-column 70)
>
> It has to be:
> (setq-default fill-column 72)
>
> For fill-column and tab-width I thought it better to do it globally.
>
> I also use:
> (add-hook 'text-mode-hook (lambda () (refill-mode 1) (setq-default
> default-justification 'full)))
> (add-hook 'org-mode-hook (lambda () (refill-mode 0) (setq-default
> default-justification 'left)))
>
> But this only works partly. Refill-mode is t for text-mode and nill
> for or-mode, but default-justification is for both full. What is going
> wrong here?
What is going on here is that you explicitly set the global value of
default-justification by using setq-default, which means it affects all
buffers in all modes. The value that you are seeing depends upon which
hook was run most recently.
> I also tried:
> (add-hook 'org-mode-hook (lambda () (refill-mode 0)))
> (add-hook 'org-mode-hook (lambda () (setq-default default-
> justification 'left)))
>
> But with the same result.
>
> And I would prefer something like:
> (defun text-justification ()
> (interactive)
> (refill-mode 1)
> (setq-default default-justification 'full)
> )
>
> (defun text-no-justification ()
> (interactive)
> (refill-mode 0)
> (setq-default default-justification 'left)
> )
>
> (add-hook 'text-mode-hook 'text-justification)
> (add-hook 'org-mode-hook 'text-no-justification)
>
> Can something like this be done?
Just use normal setq instead of setq-default.
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-10-26 13:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-24 14:13 Setting fill-column and others for text-mode Decebal
2008-10-24 15:52 ` Nikolaj Schumacher
[not found] ` <mailman.2012.1224863529.25473.help-gnu-emacs@gnu.org>
2008-10-24 16:54 ` Decebal
2008-10-24 18:06 ` Lennart Borgman
[not found] ` <mailman.2016.1224871573.25473.help-gnu-emacs@gnu.org>
2008-10-25 8:03 ` Decebal
2008-10-25 8:49 ` Lennart Borgman
2008-10-26 13:58 ` Kevin Rodgers
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.