Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!bbn!jr@bbn.com From: jr@bbn.com (John Robinson) Newsgroups: comp.emacs Subject: Re: Question regarding next-line Keywords: Possibly naive question Message-ID: <38147@bbn.COM> Date: 3 Apr 89 14:21:34 GMT References: <8363@csli.STANFORD.EDU> Sender: news@bbn.COM Reply-To: jr@bbn.com (John Robinson) Distribution: usa Organization: BBN Systems and Technologies Corporation, Cambridge MA Lines: 36 In-reply-to: rustcat@csli.STANFORD.EDU (Vallury Prabhakar) In article <8363@csli.STANFORD.EDU>, rustcat@csli (Vallury Prabhakar) writes: >1) Why is that the above function next-line inserts a newline character if >there is no line following it in the buffer? I had some trouble with it >but managed to work around the problem. Still I'm still curious to know >why next-line is different from say, forward-char (which doesn't insert a >space if necessary) in this respect? I would've thought that an "End of >buffer" warning would result in trying to move past (point-max). This could certainly be argued each way. A motion command which can modify the buffer as a side-effect seems like a bad idea. One advantage comes when you are inserting an emoty line at the end of the buffer - the next-line function in effect "gobbles" unseen newlines past the last printing text as you move downward to the point where the new paragraph begins. >2) How do I go about loading a function or a file of functions each time >the current buffer is changed? That is, I would like these functions to >be executed from scratch each time a new file is read into the buffer. Three answers: 1. If the functions to be loaded (do you mean run?) depend only on the file type, as implied by the file name or extension, put something onto auto-mode-alist. 2. If the functions are the same all the time, make them into a new major mode and make that your default-major-mode. If you are simply setting the major mode to one of the available ones, make that your default. I happen to set default-major-mode to 'text-mode, and then text-mode-hook to 'turn-on-auto-fill. 3. If it is more complicated than this, use find-file-hooks. -- /jr jr@bbn.com or bbn!jr C'mon big money!