help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting fill-column and others for text-mode


From: Decebal
Subject: Re: Setting fill-column and others for text-mode
Date: Sat, 25 Oct 2008 01:03:24 -0700 (PDT)
User-agent: G2/1.0

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?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]