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: Kevin Rodgers
Subject: Re: Setting fill-column and others for text-mode
Date: Sun, 26 Oct 2008 07:58:19 -0600
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)

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





reply via email to

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