[PLUG] Emacs modes.
Galen Seitz
galens at seitzassoc.com
Mon May 20 15:42:43 UTC 2002
>
> On Mon, 20 May 2002 briand at aracnet.com wrote:
> > Generally you can enter a mode by doing:
> > M-x name-of-the-mode-mode
> > So for this lilypond thing, you should be able to say:
> > M-x lilypond-mode
> > and the buffer should be in lilypond-mode.
>
> Right. You must have missed my original message.
>
> I tried that and got [No match].
>
> So what am I doing wrong?
>
Emacs doesn't automatically scan or load the files in
/usr/share/emacs/site-lisp, so it doesn't know where to find the function
called lilypond-mode. Try adding this line to your .emacs.
(autoload 'lilypond-mode "lilypond-mode" "LilyPond major mode." t)
This will cause emacs to load lilypond-mode.el or .elc when the
lilypond-mode function is executed. Once the file is loaded, all of the
emacs lilypond functions will be available.
Alternatively, you add this to /usr/share/emacs/site-lisp/site-start.el.
This eliminates the need to modify the individual ~/.emacs files.
You will probably still want to add a line like this:
(setq auto-mode-alist (cons '("\\.ly$" . lilypond-mode) auto-mode-alist))
jeme at brelin.net said:
> As I read this, I understood it to mean this autoloads the lilypond
> mode when I edit a file ending in .ly. That's all well and good, but
> I want to enter lilypond mode from an empty buffer.
If you add the autoload line from above, you will be able to enter
lilypond-mode from an empty buffer by typing M-x lilypond-mode. However,
I would suggest a slightly different approach. I rarely if ever start
editing in an empty buffer. I usually do a C-x C-f to start editing a
new file. By doing it this way the buffer is automatically put into
the mode indicated by the filename extension. For instance, if I do
C-x C-f new.c, I get a new buffer named new.c that is in C-mode. If
you changed your mind about the file name, you can just write the buffer
out to a different name with C-x C-w.
galen
More information about the PLUG
mailing list