On Wed, Jul 15, 2009 at 08:04:25PM -0600, lee wrote: > > by putting it in a hook that is run when post-mode is run. normally, a major > > mode will have such a hook, simply called <major-mode>-hook, i.e. in the > > case of > > post-mode it should be post-mode-hook. so: > > > > (add-hook 'post-mode-hook 'turn-on-flyspell) > > > > should *probably* do it. (but check the documentation for flyspell-mode to > > find > > out what the best way is to turn it on. i don't use it so i don't know...) > > It doesn't work.
At the risk of stating the obvious, you need to put that in your ~/.emacs (~/.xemacs? or wasn't it in some subdir with xemacs? I don't know...) and then restart xemacs to make sure it takes effect. > Unfortunately, I couldn't find documentation about > flyspell-mode yet. And I don't know what the "hooks" do. a hook is simply a list of functions that are run when a certain mode is started. > There is some > documentation, like about elisp, but what I haven't found is a > documentation that would explain things like that so that one could > learn how to program emacs. Emacs comes with an introduction to Elisp and the full documentation to Elisp. Just start info mode (C-h i) and search for 'Emacs Lisp Intro' and 'Elisp'. > Well, I just tried things to get it to work, it doesn't really matter > why they didn't. But one thing I tried was to append flyspell-mode to > auto-mode-alist just like post-mode: Which is not going to work, because only the first matching mode in auto-mode-alist is activated. That's why auto-mode-alist should only be used for major modes, not for minor modes. Minor modes (like flyspell-mode) should be turned on via mode hooks. > (setq auto-mode-alist > (append > '(("/tmp/mutt-cat-.*" . (post-mode flyspell-mode))) > auto-mode-alist)) > > That's logical and should work, but it doesn't. That's not going to work because of the way auto-mode-alist works. It requires exactly one mode function in each option, it does not handle more. (Essentially because auto-mode-alist is for setting the major mode of a buffer and a buffer can only have one major mode.) > I googled and found > some examples where flyspell-mode was turned on automatically and > tried some of them, to no avail. Some used (flyspell-mode 1), others > seemed to make up functions to turn it on, and there were some that > used hooks. The correct way for turning it on for specific modes only is through hooks. AFAICT, the line above should really work. I have no idea why it doesn't in your case... > You're right --- but I didn't want to subsribe to another mailing list > or forum to ask only one simple question, and since there are users > here using emacs as editor for mutt like I do, they might know how to > do it, and it might be of use to those who don't --- and thus not too > badly misplaced here. But maybe it turns out to be a very difficult > question? it shouldn't be difficult... (add-hook 'post-mode 'turn-on-flyspell) should do the trick... -- Joost Kremers Life has its moments