unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: byte-compiling .emacs
@ 2005-04-12 18:48 Ryan Bowman
  2005-04-12 21:45 ` Kevin Rodgers
  0 siblings, 1 reply; 10+ messages in thread
From: Ryan Bowman @ 2005-04-12 18:48 UTC (permalink / raw)


> > 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
emacs-lisp-mode."
  (interactive)
  (if (string= major-mode "emacs-lisp-mode")
      (progn
        (message (concat "Byte Compiling file: "
buffer-file-name))
        (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. 
http://promotions.yahoo.com/new_mail

^ permalink raw reply	[flat|nested] 10+ messages in thread
[parent not found: <mailman.931.1113065284.2895.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2005-04-14 17:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-12 18:48 byte-compiling .emacs Ryan Bowman
2005-04-12 21:45 ` Kevin Rodgers
2005-04-12 22:24   ` Joe Corneli
     [not found] <mailman.931.1113065284.2895.help-gnu-emacs@gnu.org>
2005-04-09 18:34 ` how can I tell emacs to treat a text file as html? Stefan Monnier
     [not found]   ` <mailman.951.1113084713.2895.help-gnu-emacs@gnu.org>
2005-04-10  1:15     ` Pascal Bourguignon
     [not found]       ` <mailman.961.1113108735.2895.help-gnu-emacs@gnu.org>
2005-04-11 11:40         ` byte-compiling .emacs (was: how can I tell emacs to treat a text file as html?) Reiner Steib
2005-04-11 13:10           ` Joe Corneli
     [not found]             ` <mailman.1067.1113227351.2895.help-gnu-emacs@gnu.org>
2005-04-11 17:19               ` byte-compiling .emacs David Kastrup
2005-04-11 19:41                 ` Peter Dyballa
     [not found]           ` <mailman.1061.1113223276.2895.help-gnu-emacs@gnu.org>
2005-04-11 13:40             ` byte-compiling .emacs (was: how can I tell emacs to treat a text file as html?) Phillip Lord
2005-04-11 14:33               ` byte-compiling .emacs Jay Belanger
2005-04-12  0:58                 ` Barry Margolin
2005-04-14 12:48                 ` Stefan Monnier
2005-04-14 17:43                   ` Jay Belanger
2005-04-12  1:31               ` Quokka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).