[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: buffer-read-only is always t at text-mode-hook time
From: |
Kevin Rodgers |
Subject: |
Re: buffer-read-only is always t at text-mode-hook time |
Date: |
Mon, 16 Aug 2004 10:22:31 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 |
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
Message not available