From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.bugs Subject: Re: buffer-read-only is always t at text-mode-hook time Date: Mon, 16 Aug 2004 10:22:31 -0600 Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <4120DF47.5000708@yahoo.com> References: <87d61u7qj5.fsf@jidanni.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1092673382 4797 80.91.224.253 (16 Aug 2004 16:23:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 16 Aug 2004 16:23:02 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Aug 16 18:22:50 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BwkG2-0004z7-00 for ; Mon, 16 Aug 2004 18:22:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BwkK8-0002Tu-G4 for geb-bug-gnu-emacs@m.gmane.org; Mon, 16 Aug 2004 12:27:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BwkK6-0002Tp-VM for bug-gnu-emacs@gnu.org; Mon, 16 Aug 2004 12:27:03 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BwkK5-0002TK-BG for bug-gnu-emacs@gnu.org; Mon, 16 Aug 2004 12:27:02 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BwkK5-0002TH-7r for bug-gnu-emacs@gnu.org; Mon, 16 Aug 2004 12:27:01 -0400 Original-Received: from [130.59.10.2] (helo=chx400.switch.ch) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1BwkFn-0002oQ-VW for bug-gnu-emacs@gnu.org; Mon, 16 Aug 2004 12:22:36 -0400 Original-Received: from mail.fu-berlin.de ([130.133.1.2]) by chx400.switch.ch with esmtp (Exim 3.20 #1) id 1BwkFk-00061r-00 for gnu-emacs-bug@moderators.isc.org; Mon, 16 Aug 2004 18:22:32 +0200 Original-Received: by Mail.FU-Berlin.DE (Exim 4.41) from curry.zedat.fu-berlin.de ([160.45.10.36]) for gnu-emacs-bug@moderators.isc.org with esmtp id <1BwkFk-000Etn-4W>; Mon, 16 Aug 2004 18:22:32 +0200 Original-Received: by Curry.ZEDAT.FU-Berlin.DE (Smail3.2.0.98) from news.uni-berlin.de with bsmtp id ; Mon, 16 Aug 2004 18:22:31 +0200 (MEST) Original-To: gnu-emacs-bug@moderators.isc.org Original-Path: not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 30 X-Orig-X-Trace: news.uni-berlin.de D5nZ8gOgZYY1wAN758IgZwZDwSh/bWw6l7mzeABFq8AFTEBGs= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:8727 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:8727 Dan Jacobson wrote: > Some might want to know of spelling problems they can't fix---but > never mind that---larger problem: > > $ cat .emacs > (setq default-major-mode 'text-mode);adding this line makes the below useless! > (add-hook > 'text-mode-hook > (lambda () > (or buffer-read-only (turn-on-auto-fill)) > (and (not buffer-read-only)(> 88888 (buffer-size))(flyspell-mode 1)))) > $ emacs -nw --no-site-file /usr/share/emacs/21.3/etc/DOC-21.3.1 > And what do you know, despite my best efforts, there I am staring at > "(Text Fly Fill)" in the modeline. That is a problem. It arises because default-major-mode is called 1 of 2 ways: either by set-buffer-major-mode (before the file's contents have been inserted) or by normal-mode (but only if called with a nil FIND-FILE argument, which usually doesn't happen since after-find-file specifies it as t). I don't know how that could be fixed without moving the call to set-buffer-major-mode into or after find-file-no-select-1 (which inserts the file contents into the buffer). If that's not feasible, should the interaction between default-major-mode and the mode's hook functions be documented? -- Kevin Rodgers