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: Wed, 11 Aug 2004 09:33:50 -0600 Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <411A3C5E.1070101@yahoo.com> References: 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 1092238514 5402 80.91.224.253 (11 Aug 2004 15:35:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 11 Aug 2004 15:35:14 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Aug 11 17:34:53 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 1Buv7s-0004Fh-00 for ; Wed, 11 Aug 2004 17:34:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BuvBj-0001I3-TP for geb-bug-gnu-emacs@m.gmane.org; Wed, 11 Aug 2004 11:38:52 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BuvBP-000152-7Q for bug-gnu-emacs@gnu.org; Wed, 11 Aug 2004 11:38:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BuvBN-00014C-55 for bug-gnu-emacs@gnu.org; Wed, 11 Aug 2004 11:38:30 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BuvBN-00013b-0C for bug-gnu-emacs@gnu.org; Wed, 11 Aug 2004 11:38:29 -0400 Original-Received: from [132.239.1.59] (helo=mailbox7.ucsd.edu) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1Buv6t-0000xl-Od for bug-gnu-emacs@gnu.org; Wed, 11 Aug 2004 11:33:52 -0400 Original-Received: from Mail.FU-Berlin.DE (mail.fu-berlin.de [130.133.1.2]) by mailbox7.ucsd.edu (8.13.1/8.13.0.Alpha0) with ESMTP id i7BFXj9e032160 for ; Wed, 11 Aug 2004 08:33:46 -0700 (PDT) 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 <1Buv6m-000EgN-IZ>; Wed, 11 Aug 2004 17:33:44 +0200 Original-Received: by Curry.ZEDAT.FU-Berlin.DE (Smail3.2.0.98) from news.uni-berlin.de with bsmtp id ; Wed, 11 Aug 2004 17:33:44 +0200 (MEST) Original-To: gnu-emacs-bug@moderators.isc.org Original-Path: not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 54 X-Orig-X-Trace: news.uni-berlin.de PQZMWMLdGvnMIqgEcR93KQfxrivOqooktwzWzd32686L/jpbQ= 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-Spamscanner: mailbox7.ucsd.edu (v1.4 May 20 2004 13:55:33, 2.2/5.0 2.63) X-MailScanner: PASSED (v1.2.8 19915 i7BFXj9e032160 mailbox7.ucsd.edu) 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:8683 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:8683 Dan Jacobson wrote: > Perhaps this would work: > (add-hook 'text-mode-hook (lambda () > (or buffer-read-only (and(turn-on-auto-fill)(flyspell-mode 1))))) > But buffer-read-only is always true when text-mode-hook is evaluated > apparently. I can't replicate that on GNU Emacs 21.3.1 (i386-pc-solaris2.7, X toolkit). I started emacs with the -q --no-site-file switches and evaluated this in the *scratch* buffer: (add-hook 'text-mode-hook (lambda () (message "buffer-read-only is %s" buffer-read-only))) Then I invoked text mode several different ways (via M-x, via default-major-mode, and via auto-mode-alist on both new and existing files), and each time the echo area said "buffer-read-only is nil". > While a fix is being made, any workarounds? > > You see I don't want to turn on flyspell-mode for files I have no hope > of editing. Your code above ought to work, except that you depend on the result of turn-on-auto-fill, whose return value is not documented. Use progn instead of `and'. > flyspell.el might add an example of how not to turn on flyspell-mode > for files one has no hope of editing. But you figured it out easily enough, no? > P.S. the Info, the first hooks example > (add-hook 'text-mode-hook 'turn-on-auto-fill) > should also show how to not turn it on for files one has no hope of editing. Why? auto-fill is only invoked if they make a change (insert a space at the end of a line), and if that's what the user wants it should work if they M-x toggle-read-only. > While there, tell folks how also to set a hook just in case they need > to override. Don't only mention just add-hook. Bad idea. > BTW, I also don't want to turn on flyspell-mode for files that are > real big. C-h f buffer-size -- Kevin Rodgers