How can I enable flyspell-mode for documents that don't have an
extension?
eg. I've auto enabled it through .emacs for text, python, etc. Like
this:
emacs /tmp/stuff.txt
Loads flyspell-mode, but emacs /tmp/stuff wouldn't.
Anyone know how to enable flyspell mode for files with no extension?
Thanks
--
Cheers,
Dan
Using a file local variable for the files with no extension would be one
option. ie, adding:
-*- mode: flyspell; -*-
to the top of your file would turn flyspell mode on. This is only
useful for files you visit often though.
Alternatively, you can add an element to magic-mode-alist which makes
emacs match a given regular expression or match function against the
file being opened and setting the given mode. This method is only
useful if you can predict in someway what might be in the extension-less
files.
Unfortunately, Fundamental mode doesn't run any hooks so that method
won't work.
So a couple of suboptimal ideas is all I can come up with. Would love
to hear of a more robust approach perhaps using 'file' and setting the
mode based off that some how.
--
Do they only stand
By ignorance, is that their happy state,
The proof of their obedience and their faith?
possibly by using local variables e.g. something like this within a file
# -*- eval: (flyspell-mode) -*-
see (info "(emacs) Choosing Modes")
Yes, thanks I might have a play with this at some stage, but it is
probably easier if I just use the txt extention:)
Also, speaking of this can you show me the sintax of how I would
automatically set message-mode for a filename containing the words
"mutt-localhost"?
The OP might be able to add a defadvice to 'fundamental-mode.
The advice function could check the extension of the current buffer's
file, and run (flyspell-mode 't) if there isn't one.
HTH,
Colin S. Miller
--
Replace the obvious in my email address with the first three letters of the hostname to reply.
> Hi,
>
> How can I enable flyspell-mode for documents that don't have an
> extension?
> eg. I've auto enabled it through .emacs for text, python, etc. Like
> this:
> emacs /tmp/stuff.txt
> Loads flyspell-mode, but emacs /tmp/stuff wouldn't.
>
> Anyone know how to enable flyspell mode for files with no extension?
If you want to have flyspell mode enabled for all files, you may
want to try the find-file-hook.
(add-hook 'find-file-hook 'turn-on-flyspell)
Or:
(add-hook 'fundamental-mode 'turn-on-flyspell)
--
Kevin Rodgers
Denver, Colorado, USA
That will not work.
It does. It runs after-change-major-mode-hook.
Of course, some buffers are put in fundamental-mode by default without
ever actually calling fundamental-mode.
Stefan