From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Setting fill-column and others for text-mode Date: Sun, 26 Oct 2008 07:58:19 -0600 Message-ID: References: <5ddf8b9b-1144-454e-ae60-1be36de9ab03@u75g2000hsf.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1225029547 5580 80.91.229.12 (26 Oct 2008 13:59:07 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 26 Oct 2008 13:59:07 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Oct 26 15:00:09 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Ku6A2-00068Z-Ed for geh-help-gnu-emacs@m.gmane.org; Sun, 26 Oct 2008 15:00:06 +0100 Original-Received: from localhost ([127.0.0.1]:41346 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ku68w-0007KC-I9 for geh-help-gnu-emacs@m.gmane.org; Sun, 26 Oct 2008 09:58:58 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ku68d-0007K3-JQ for help-gnu-emacs@gnu.org; Sun, 26 Oct 2008 09:58:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ku68b-0007II-1K for help-gnu-emacs@gnu.org; Sun, 26 Oct 2008 09:58:38 -0400 Original-Received: from [199.232.76.173] (port=52065 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ku68a-0007IB-Uj for help-gnu-emacs@gnu.org; Sun, 26 Oct 2008 09:58:36 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:42583 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ku68a-00018t-8A for help-gnu-emacs@gnu.org; Sun, 26 Oct 2008 09:58:36 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Ku68U-0004kb-SU for help-gnu-emacs@gnu.org; Sun, 26 Oct 2008 13:58:30 +0000 Original-Received: from c-67-161-145-183.hsd1.co.comcast.net ([67.161.145.183]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Oct 2008 13:58:30 +0000 Original-Received: from kevin.d.rodgers by c-67-161-145-183.hsd1.co.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 26 Oct 2008 13:58:30 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 59 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-67-161-145-183.hsd1.co.comcast.net User-Agent: Thunderbird 2.0.0.17 (Macintosh/20080914) In-Reply-To: <5ddf8b9b-1144-454e-ae60-1be36de9ab03@u75g2000hsf.googlegroups.com> X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:59170 Archived-At: Decebal wrote: > On 24 okt, 17:52, Nikolaj Schumacher 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