Path: utzoo!attcan!uunet!tank!eecae!mailrus!cornell!batcomputer!rpi!rpi.edu!tale From: tale@pawl.rpi.edu (David C Lawrence) Newsgroups: comp.emacs Subject: Re: GNUemacs server/client mode Message-ID: Date: 10 Mar 89 22:11:48 GMT References: Sender: usenet@rpi.edu Reply-To: tale@pawl.rpi.edu Distribution: comp Organization: The Octagon Room Lines: 51 In e-mail, Peter Baer Galvin asked the following: > This is probably a dumb question (which is why I'm mailing it to you > rather than posting it to the new group :-). I'd like to set a couple > of things automatically in each buffer created by a emacsclient > program. I'd like auto-fill mode set and a special fill-prefix too. > I tried > (setq fundamental-mode-hook 'turn-on-auto-fill) > (setq fill-prefix " ") > but the fundamental mode buffer started by emacsclient isn't in text > mode and has no fill prefix. If I get this working I'll be very > happy. Of course I'd be happied if emacsclient could talk to a remote > host (since it uses sockets anyway) so I could have one emacs on one > system and have all other editor-invocations from other systems talk > to it. Maybe in the next release, hey :-). Well, since the answer is non-obvious as near as I can tell (and not dumb at all), I'll accept the responsibility for bothering the group with it. What Peter has encountered here are two problems: a) the server provides no hook of it's own for server buffers and b) fundamental mode calls no hook (that I can find) in and of itself. Additionally, if the server visited a file in something other than findamental mode, your hook wouldn't run anyway (kind of moot, though). One way around this is to note that server-visit-files is called by the server process filter to find the buffers for client files. find-file-hooks is going to be run in it by find-file-noselect so configuring your find-file-hooks to deal with the server should do what you want. The variable client-record is bound in the let statement which makes up the body of server-visit-files, so the following should work: (setq find-file-hooks '(lambda () (if (boundp 'client-record) (progn (turn-on-auto-fill) (set-fill-prefix " "))) ;; here you should put whatever else is a ;; part of your find-file-hooks )) Through non-rigorous testing on a couple of files here that seems to do the trick. Hope it at least points you in the right direction. Dave -- tale@rpitsmts.bitnet, tale%mts@rpitsgw.rpi.edu, tale@pawl.rpi.edu