On 2006-11-01 03:38:54 +0000, Tyler wrote: > I don't understand it, but it works. I'm only just starting to learn > lisp, so I will have to do some reading before I understand everything > your code does, but in the meantime I have word-wrapping (and probably a > few other things as well).
I don't know very much about Emacs either (this is more a problem related to Emacs than LISP), but a default mode is set by Emacs when a file is opened. So, it's useless to try to choose a mode at start up (i.e. before the file is opened), unless you give a generic rule depending on the filename (auto-mode-alist) or on the contents of the file (magic-mode-alist). For instance, I have the following for XML files in my .emacs file: (when (boundp 'magic-mode-alist) (push '("\\`<\\?xml" . nxml-mode) magic-mode-alist) ) (setq auto-mode-alist (cons '("\\.xml\\'" . nxml-mode) auto-mode-alist)) (setq auto-mode-alist (cons '("\\.xsl\\'" . nxml-mode) auto-mode-alist)) That's why, if the above features (which aren't sufficient in my case as I want to do other things than setting the mode) are not used, a find-file hook is necessary. If I understand correctly, Emacs opens the file with the find-file function: this does various things such as setting the mode according to generic rules, then calls the hooks, allowing you to override some settings and do other things -- that's the goal of hooks. -- Vincent Lefèvre <[EMAIL PROTECTED]> - Web: <http://www.vinc17.org/> 100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/> Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon) -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]