unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: Setting fill-column and others for text-mode
Date: Sun, 26 Oct 2008 07:58:19 -0600	[thread overview]
Message-ID: <ge1t1o$5al$1@ger.gmane.org> (raw)
In-Reply-To: <5ddf8b9b-1144-454e-ae60-1be36de9ab03@u75g2000hsf.googlegroups.com>

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





      parent reply	other threads:[~2008-10-26 13:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ge1t1o$5al$1@ger.gmane.org' \
    --to=kevin.d.rodgers@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).