unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: byte-compiling .emacs
  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               ` Jay Belanger
  2005-04-12  0:58                 ` Barry Margolin
  2005-04-14 12:48                 ` Stefan Monnier
  2005-04-12  1:31               ` Quokka
  1 sibling, 2 replies; 10+ messages in thread
From: Jay Belanger @ 2005-04-11 14:33 UTC (permalink / raw)



Phillip Lord <p.lord@cs.man.ac.uk> writes:

>>>>>> "Joe" == Joe Corneli <jcorneli@math.utexas.edu> writes:
>
>   Joe>    On Sun, Apr 10 2005, Joe Corneli <jcorneli@math.utexas.edu>
>   Joe>    wrote:
>
>   >> But, note, what you should really do is byte compile the .emacs,
>
>   Joe>    Why?  Typically this isn't worth the trouble ("Changes is my
>   Joe>    .emacs are ignored!!!1 What's wrong???ß").
>
>
>   Joe> OK, I guess I was wrong.  I personally always byte compile mine
>   Joe> b/c otherwise emacs complains that the source file is newer.
>   Joe> Other people might not have that problem :).  But perhaps I'm
>   Joe> the one who should change...
>
> If you don't byte-compile it at all, then it won't. 

And of course remove the .elc file.

> 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. 

It does make a difference for me (but only a few seconds difference),
but I probably have too much junk in it.  At any rate, I moved most of
the junk to subsidiary files, which I do compile (and have to remember
to recompile whenever I change them), and have my (uncompiled) .emacs
do little more than load them.

At any rate, even when I didn't compile, the overhead was a one-time
(per boot) overhead of a few seconds, so not compiling was never
really a problem.

Jay

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: byte-compiling .emacs
       [not found]             ` <mailman.1067.1113227351.2895.help-gnu-emacs@gnu.org>
@ 2005-04-11 17:19               ` David Kastrup
  2005-04-11 19:41                 ` Peter Dyballa
  0 siblings, 1 reply; 10+ messages in thread
From: David Kastrup @ 2005-04-11 17:19 UTC (permalink / raw)


Peter Dyballa <Peter_Dyballa@Web.DE> writes:

> Am 11.04.2005 um 15:10 schrieb Joe Corneli:
>
>> I personally always byte compile mine b/c otherwise emacs complains
>> that the source file is newer
>
> If GNU Emacs complains in that way, I just delete its reason to
> complain about! Isn't that radical?!

Yes, it is.  Personally I would not want to delete the source file of
anything just to be spared an odd complaint.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: byte-compiling .emacs
  2005-04-11 17:19               ` byte-compiling .emacs David Kastrup
@ 2005-04-11 19:41                 ` Peter Dyballa
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Dyballa @ 2005-04-11 19:41 UTC (permalink / raw)
  Cc: help-gnu-emacs


Am 11.04.2005 um 19:19 schrieb David Kastrup:

> Peter Dyballa <Peter_Dyballa@Web.DE> writes:
>
>> Am 11.04.2005 um 15:10 schrieb Joe Corneli:
>>
>>> I personally always byte compile mine b/c otherwise emacs complains
>>> that the source file is newer
>>
>> If GNU Emacs complains in that way, I just delete its reason to
>> complain about! Isn't that radical?!
>
> Yes, it is.  Personally I would not want to delete the source file of
> anything just to be spared an odd complaint.

Why would you like to do such weird mistakes?! The .elc file is the 
anachronistic one: the elder folks get deleted and the younger ones 
have to go to work -- or unemployment office.

--
Mit friedvollen Grüßen

   Pete

Either this man is dead or my watch has stopped. - Groucho Marx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: byte-compiling .emacs
  2005-04-11 14:33               ` byte-compiling .emacs Jay Belanger
@ 2005-04-12  0:58                 ` Barry Margolin
  2005-04-14 12:48                 ` Stefan Monnier
  1 sibling, 0 replies; 10+ messages in thread
From: Barry Margolin @ 2005-04-12  0:58 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]

In article <8764yto02m.fsf@vh213602.truman.edu>,
 Jay Belanger <belanger@truman.edu> wrote:

> Phillip Lord <p.lord@cs.man.ac.uk> writes:
> 
> >>>>>> "Joe" == Joe Corneli <jcorneli@math.utexas.edu> writes:
> >
> >   Joe>    On Sun, Apr 10 2005, Joe Corneli <jcorneli@math.utexas.edu>
> >   Joe>    wrote:
> >
> >   >> But, note, what you should really do is byte compile the .emacs,
> >
> >   Joe>    Why?  Typically this isn't worth the trouble ("Changes is my
> >   Joe>    .emacs are ignored!!!1 What's wrong???ß").
> >
> >
> >   Joe> OK, I guess I was wrong.  I personally always byte compile mine
> >   Joe> b/c otherwise emacs complains that the source file is newer.
> >   Joe> Other people might not have that problem :).  But perhaps I'm
> >   Joe> the one who should change...
> >
> > If you don't byte-compile it at all, then it won't. 
> 
> And of course remove the .elc file.

But if you don't byte-compile it at all, where would that file have come 
from?

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: byte-compiling .emacs
  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  1:31               ` Quokka
  1 sibling, 0 replies; 10+ messages in thread
From: Quokka @ 2005-04-12  1:31 UTC (permalink / raw)


Phillip Lord wrote:
>>>>>>"Joe" == Joe Corneli <jcorneli@math.utexas.edu> writes:
> 
> 
>   Joe>    On Sun, Apr 10 2005, Joe Corneli <jcorneli@math.utexas.edu>
>   Joe>    wrote:
> 
>   >> But, note, what you should really do is byte compile the .emacs,
> 
>   Joe>    Why?  Typically this isn't worth the trouble ("Changes is my
>   Joe>    .emacs are ignored!!!1 What's wrong???ß").
> 
> 
>   Joe> OK, I guess I was wrong.  I personally always byte compile mine
>   Joe> b/c otherwise emacs complains that the source file is newer.
>   Joe> Other people might not have that problem :).  But perhaps I'm
>   Joe> the one who should change...
> 
> If you don't byte-compile it at all, then it won't. 
> 
> 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)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* 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

* Re: byte-compiling .emacs
  2005-04-12 18:48 byte-compiling .emacs Ryan Bowman
@ 2005-04-12 21:45 ` Kevin Rodgers
  2005-04-12 22:24   ` Joe Corneli
  0 siblings, 1 reply; 10+ messages in thread
From: Kevin Rodgers @ 2005-04-12 21:45 UTC (permalink / raw)


Ryan Bowman wrote:
 > Please suggest improvements.

Only add your auto-compile function to after-save-hook locally in
emacs-lisp-mode buffers, and only those buffers that are actually
visiting files.  Don't bother with message, since Emacs already
generates "Compiling /path/to/file.el...done" and "Wrote
/path/to/file.elc" messages.

(defun byte-compile-visited-file ()
   (let ((byte-compile-verbose t))
     (byte-compile-file buffer-file-name)))

(add-hook 'emacs-lisp-mode-hook
           (lambda ()
             (when buffer-file-name
               (add-hook (make-local-hook 'after-save-hook)
                         'byte-compile-visited-file
                         nil t))))

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: byte-compiling .emacs
  2005-04-12 21:45 ` Kevin Rodgers
@ 2005-04-12 22:24   ` Joe Corneli
  0 siblings, 0 replies; 10+ messages in thread
From: Joe Corneli @ 2005-04-12 22:24 UTC (permalink / raw)


I'm pretty sure I would prefer not to have it done after save but only
when the buffer is killed, so, my (minor) suggestion is to try adding
to `kill-buffer-hook' instead.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: byte-compiling .emacs
  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
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2005-04-14 12:48 UTC (permalink / raw)


> It does make a difference for me (but only a few seconds difference),
> but I probably have too much junk in it.  At any rate, I moved most of

I'd be interested to see this.  Have you actually measured it?
The only reason I can think of to see such a difference is if your .emacs
uses autoloaded macros, where the .elc file ends up not loading the
macro's definition.


        Stefan

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: byte-compiling .emacs
  2005-04-14 12:48                 ` Stefan Monnier
@ 2005-04-14 17:43                   ` Jay Belanger
  0 siblings, 0 replies; 10+ messages in thread
From: Jay Belanger @ 2005-04-14 17:43 UTC (permalink / raw)



Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> It does make a difference for me (but only a few seconds difference),
>> but I probably have too much junk in it.  At any rate, I moved most of
>
> I'd be interested to see this.  Have you actually measured it?

I had not measured it very accurately, but I thought I had counted to
myself as it was loading and noticed the difference.
However, I just tried it out (on a freshly booted system each time)
and let Emacs measure the times.  There was no real difference in the
times. 
So ... oops or something.

Jay

^ permalink raw reply	[flat|nested] 10+ messages in thread

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).