unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kevin Rodgers <ihs_4664@yahoo.com>
Subject: Re: buffer-read-only is always t at text-mode-hook time
Date: Wed, 11 Aug 2004 09:33:50 -0600	[thread overview]
Message-ID: <411A3C5E.1070101@yahoo.com> (raw)
In-Reply-To: mailman.715.1092171969.2011.bug-gnu-emacs@gnu.org

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

       reply	other threads:[~2004-08-11 15:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.715.1092171969.2011.bug-gnu-emacs@gnu.org>
2004-08-11 15:33 ` Kevin Rodgers [this message]
2004-08-10  3:40 buffer-read-only is always t at text-mode-hook time Dan Jacobson
     [not found] ` <E1Buzoi-00078M-CW@fencepost.gnu.org>
2004-08-13 20:05   ` Dan Jacobson
     [not found]     ` <E1Bw9P8-0000Tg-Br@fencepost.gnu.org>
2004-08-15  2:50       ` Dan Jacobson
     [not found]       ` <mailman.1298.1092602041.2011.bug-gnu-emacs@gnu.org>
2004-08-16 16:22         ` Kevin Rodgers
2004-08-18  1:34           ` Richard Stallman
     [not found]   ` <mailman.1089.1092431153.2011.bug-gnu-emacs@gnu.org>
2004-08-13 22:13     ` Kevin Rodgers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=411A3C5E.1070101@yahoo.com \
    --to=ihs_4664@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).