Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!tank!cps3xx!cps3xx.egr.msu.edu!ben From: ben@nsf1.mth.msu.edu (Ben Lotto) Newsgroups: comp.emacs Subject: Re: Filling of paragraphs in GNU emacs. Message-ID: Date: 1 Dec 89 13:46:16 GMT References: <1989Nov28.222213.3721@hcr.uucp> <48910@bbn.COM> <5074@nigel.udel.EDU> Sender: usenet@cps3xx.UUCP Reply-To: ben@nsf1.mth.msu.edu Organization: Michigan State University Lines: 35 In-reply-to: gmiller@udel.edu's message of 30 Nov 89 21:49:21 GMT >>>>> On 30 Nov 89 21:49:21 GMT, gmiller@udel.edu (Gregory Miller) said: Gregory> In article <48910@bbn.COM> jr@BBN.COM (John Robinson) writes: >(definition of 'do-auto-justify to fill and justify lines after >executing (setq auto-fill-hook 'do-auto-justify)) Gregory> However, it works fine interactively as John says, but when I put it Gregory> in my .emacs file, it has no effect. Perhaps someone could point out Gregory> where I was stupid. What I did was put the above code into my .emacs Gregory> file and then invoke auto-fill-mode with M-x auto-fill-mode. Auto-fill Gregory> worked fine, but the text was not justified. After wrestling with it The problem is that M-x auto-fill-mode sets auto-fill-hook to either nil or do-auto-fill. Here is a new function, auto-justify-mode, that does the same thing as auto-fill-mode for your new do-auto-justify function. Modified from simple.el: (defun auto-justify-mode (arg) "Toggle auto-justify mode. With arg, turn auto-justify mode on iff arg is positive. In auto-justify mode, inserting a space at a column beyond fill-column automatically breaks the line at a previous space." (interactive "P") (prog1 (setq auto-fill-hook (if (if (null arg) (not auto-fill-hook) (> (prefix-numeric-value arg) 0)) 'do-auto-justify nil)) ;; update mode-line (set-buffer-modified-p (buffer-modified-p)))) -- -B. A. Lotto (ben@nsf1.mth.msu.edu) Department of Mathematics/Michigan State University/East Lansing, MI 48824 Brought to you by Super Global Mega Corp .com