home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.emacs
- Path: sparky!uunet!boulder!colorado.edu!ejh
- From: ejh@khonshu.colorado.edu (Edward J. Hartnett)
- Subject: Re: setting mode hook to call two minor modes, how?
- In-Reply-To: ejh@khonshu.colorado.edu's message of 10 Nov 92 11:47:32
- Message-ID: <EJH.92Nov10132809@khonshu.colorado.edu>
- Sender: news@colorado.edu (The Daily Planet)
- Nntp-Posting-Host: khonshu.colorado.edu
- Organization: CIRES, University of Colorado
- References: <EJH.92Nov10114732@khonshu.colorado.edu>
- Date: 10 Nov 92 13:28:09
- Lines: 71
-
- In article <EJH.92Nov10114732@khonshu.colorado.edu> ejh@khonshu.colorado.edu (Edward J. Hartnett) writes:
-
- I'm using GNU EMACS 18.57 on a Sun running SunOS4.1.1
-
- I'm trying to do a little lisp work in emacs, but my lisp is quite
- rusty. One thing that I want to do is call two minor modes from the
- fortran mode hook. Here's what I have in my .emacs now:
-
- (setq fortran-mode-hook '(lambda () (abbrev-mode 1)))
-
- I know there's a way to add the auto-fill mode, but how? (I'm trying
- to get the auto-fill mode to automatically continue a line that runs
- beyond column 72).
-
- Any help or ideas would be appreciated.
-
- --
- Edward Hartnett ejh@khonshu.colorado.edu
-
-
- Well, I posted this a while ago and then went back and reread my elisp
- manual chapter 11, section 2, Lambda Expressions, and it made a lot
- more sense than the last time I read it, and I see that the answer to
- the above question is now obvious to me. I'll cancel the original
- article and, as a pennance, and with the thought that there might be a
- few other beginning elisp programs out there who are interested,
- here's the answer. But since I just figured this out, there's a good
- chance my explanation is wrong.
-
- (setq fortran-mode-hook '(lambda ()
- (abbrev-mode 1) (auto-fill-mode 1)))
-
- The reason is that a lambda expression consists of the following:
- (lambda (ARG-VARIABLES...)
- [DOCUMENTATION STRING]
- [INTERACTIVE-DECLARATION]
- BODY-FORMS...)
-
- This means that the whole thing is a list, with the special symbol
- lambda as the car of the list, the next element is another list, which
- will contain the arguments to the function, then there's two optional
- list items, the documentation string, which tells what the function
- does, and the interactive declaration, which allows the funtion to ask
- the user to input the arguments in a friendly way. The rest of the
- list are lists which are themselves function calls. So to add another
- function to the fortran hook, I add another element to the list, and
- the element I add is the list (auto-fill-mode 1) which turns on
- auto-fill mode.
-
- What I don't quite understand is why some functions (like the one
- called by fortran-mode-hook) are lambda expressions, and others, like
- auto-fill-mode don't. I guess either one or the other is not really a
- function? Any expert care to clarify?
-
- PS - while looking into the fortran.el for more clues I found that in
- this newest version abbrev-mode is supposed to be turned on by default
- anyway, so I shouldn't need it in my fortran-mode-hook anyway.
-
-
-
-
-
-
-
-
-
-
-
- --
- Edward Hartnett ejh@khonshu.colorado.edu
-
-