🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #189105

Trouble with find-file-hooks

#189105
From: David S. Browning
Date: Sun, 28 Apr 1991 07:18
41 lines
2498 bytes
What am I doing wrong here?  I'm a novice elisp programmer, I've
studied the manual, and I'm stuck.

I don't like how generate-new-buffer adds <1>, <2>, etc. to buffers
with duplicate filenames.  The number doesn't tell me what file I'm
editing!  It's overkill to use

(setq-default mode-line-buffer-identification '("Emacs: %17f"))

which puts the buffer-file-name (i.e. the full path name) in the mode
line, because it takes a lot of room in the mode line and isn't
necessary for most buffers.  So I tried to get fancy and put this in
my .emacs file:

(setq find-file-hooks '(lambda ()
         (if (string-match "<[0-9]*>" (buffer-name))
             (setq mode-line-buffer-identification
                   '("Emacs: %17f"))
             (setq mode-line-buffer-identification
                   '("Emacs: %17b")))))

This (I thought) would change the mode line to have the full path if
the buffer name had the <2> in its name.  Unfortunately, when I try to
run find-file it beeps with the following error message in the
minibuffer:

Symbol's function definition is void: lambda

Anyone have any ideas?  Grep couldn't find the defun for
generate-new-buffer in the lisp/*.el files, so I suspect it's in the
C-code.  Otherwise I would try to change that.  Thanks for any advice.

David
--
|============================================================================|
| Internet:  browning@nas.nasa.gov                  Phone:  (415) 604-4321   |
| UUCP:  {hplabs, mailrus, ucbvax, etc.}!ames!amelia!browning                |
|----------------------------------------------------------------------------|
|"the nice thing about true hopelessness is that you don't have to try again"|
| -- jules shear                                                             |
|============================================================================|
Technical Details
Message-ID: <BROWNING.91Apr27231818@ew10.nas.nasa.gov>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!stanford.edu!eos!data.nas.nasa.gov!nameserver.nas.nasa.gov!browning

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,b30da067b3069980,start
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1991-05-02 19:23:59 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!uunet!bu.edu!stanford.edu!eos!data.nas.nasa.gov!nameserver.nas.nasa.gov!browning
From: browning@nas.nasa.gov (David S. Browning)
Newsgroups: gnu.emacs.help
Subject: Trouble with find-file-hooks
Message-ID: <BROWNING.91Apr27231818@ew10.nas.nasa.gov>
Date: 28 Apr 91 07:18:18 GMT
Sender: news@nas.nasa.gov
Distribution: gnu
Organization: NAS Program, NASA Ames Research Center, Moffett Field, CA
Lines: 41