[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: byte-compiling .emacs

From: Ryan Bowman
Subject: Re: byte-compiling .emacs
Date: Tue, 12 Apr 2005 11:48:00 -0700 (PDT)

> > I think that there is an auto recompile package
> out there somewhere. 
> > I never compiled my .emacs or subsidiary files
> myself. I doubt that it
> > makes that much difference. 
> Don't know that I would describe it as a "package"..
> I picked this up somewhere along the way.
> (Can't give credit to who or where as I forgot).
> ;; Make .emacs autocompile on exit
> (defun autocompile nil
>    "compile itself if ~/.emacs.el"
>    (interactive)
>    (if (string= (buffer-file-name) (concat
> default-directory ".emacs.el"))
>        (byte-compile-file (buffer-file-name))))
> (add-hook 'after-save-hook 'autocompile)

Using the above I extended it to byte compile any file
that's major mode is emacs lisp.

Please suggest improvements.

(defun autocompile nil
  "Automatically byte compile a file if it is in
  (if (string= major-mode "emacs-lisp-mode")
        (message (concat "Byte Compiling file: "
        (byte-compile-file (buffer-file-name)))))

(add-hook 'after-save-hook 'autocompile)

Ryan Bowman

While any text editor can save your files, only Emacs can save your soul. -- 
Per Abrahamsen

Emacs is not built by hate of vi. vi is irrelevant - it is no more than a 
strange punishment that the unbelievers submit themselves to. -- Matan Ninio

Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]