unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Joost Kremers <joostkremers@yahoo.com>
To: help-gnu-emacs@gnu.org
Subject: Re: auto-mode-alist, adding two modes
Date: 8 Oct 2007 18:20:15 GMT	[thread overview]
Message-ID: <slrnfgkt5j.2ps.joostkremers@j.kremers4.news.arnhem.chello.nl> (raw)
In-Reply-To: 87ejg57apj.fsf@hillenius.net

Gijs Hillenius wrote:
> I do *not* want to add both of these minor modes to text-mode, for
> this messes up other applications, such as my dear gnus.
>
> So, I settled on 
>
> (add-to-list 'auto-mode-alist '("\\.txt\\'" . longlines-mode ))

however, this is just plain wrong. auto-mode-alist is for *major* modes,
and longlines-mode is not a major mode. while it may work right now,
chances are it'll come back to bite you at some point in the future, and
may then be all the harder to debug, because you're doing something that's
not intended.

> (add-hook 'longlines-mode-hook 'flyspell-mode)
>
> The latter of which, if I understand it correctly, adds a fly-spell
> wherever I have longlines-mode. Which is something I can live with,
> for now.

yes, that is what it does.

if you don't want to add longlines-mode and flyspell-mode to
text-mode-hook, there is always the possibility to create a derived major
mode, which is easier than you might think:

(define-derived-mode my-text-mode
  text-mode "Text"
  "Modified text-mode, includes longlines-mode and flyspell-mode"
  (longlines-mode 1)
  (flyspell-mode 1))

then:

(add-to-list 'auto-mode-alist '("\\.txt\'" . my-text-mode))

this should do what you want without messing up gnus.

HTH

-- 
Joost Kremers                                      joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)

  reply	other threads:[~2007-10-08 18:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08 15:33 auto-mode-alist, adding two modes Gijs Hillenius
2007-10-08 15:37 ` weber
2007-10-08 16:01 ` Joost Kremers
2007-10-08 17:55   ` Gijs Hillenius
2007-10-08 18:20     ` Joost Kremers [this message]
2007-10-09  2:22   ` Barry Margolin
2007-10-09 11:01     ` Joost Kremers
2007-10-09 21:34 ` Edward O'Connor
     [not found] ` <mailman.1891.1191965685.18990.help-gnu-emacs@gnu.org>
2007-10-10 23:47   ` Johan Bockgård
2007-10-12  5:37     ` Gijs Hillenius

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=slrnfgkt5j.2ps.joostkremers@j.kremers4.news.arnhem.chello.nl \
    --to=joostkremers@yahoo.com \
    --cc=help-gnu-emacs@gnu.org \
    /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.
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).