bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#940: Is there a way to quit loading of ~/.emacs please?


From: Yiyi Hu
Subject: bug#940: Is there a way to quit loading of ~/.emacs please?
Date: Wed, 10 Sep 2008 02:24:53 +0800

This is not a bug, Just a feature request for elisp language.
Ok, thanks for your replies, I'll explain this is *great* detail.

What I want to do is simple:
When emacs starts, It checks if ~/.emacs is newer than ~/.emacs.elc,
if it does, then it recompiles the ~/.emacs, and load ~/.emacs.elc on
the fly. But skip the rest of ~/.emacs, The reason why I want this
will be explained.
Here the story begins:

If I do something like:
 (if (byte-compile-file-if-newer "~/.emacs") (load-file "~/.emacs.elc"))
Here is a situation depends on wether ~/.emacs.elc exists.
If ~/.emacs.elc exists and ever being compiled with a line (defalias
'perl-mode 'cperl-mode), and we remove
(defalias 'perl-mode 'cperl-mode) in ~/.emacs, then, cperl-mode will
still be in effect for the first time we start emacs use the new
~/.emacs, we have to restart emacs again or manually byte-compile the
~/.emacs. The reason which causes this is, the side effect created in
old ~/.emacs.elc will still in effect.

Why not use 'unless' statement version?
 (unless (byte-compile-file-if-newer "~/.emacs")
remaining lisp code ...)
Because, This will confuse M-x customize-* series functions.
Eg, when you put (customize-set-variables ....) things within (unless
(byte-compile-file-if-newer "~/.emacs") )
When you do M-x customzie-variable <RET> again, It will crate another
list which is like (customize-set-variables ...) outside of the file
level (unless () ...) statement. If you think It's ok, Please check
the example above. (customize-set-variables ..) will take effect and
last a session.

Why not splitting ~/.emacs?
I did this, and It's not a happy journey. Eg, when change something, I
have to think wether I should put here or there, or within ~/.emacs.
At last, I choose using one ~/.emacs, Also, even if we split ~/.emacs,
we still need to recompiling ~/.emacs after we do customize-variable.
That's why I think the problem still exists.

I ever used (signal 'quit nil) to skiping loading the rest of
~/.emacs, It works fine except the time when we invoke emacs with file
name args. (signal 'quit nil) will cancel loading of files we
specified in args.

In fact, This is not a bug, Just a elisp language feature request.
Hope if we can have a function named (leave-load t) which we can
manually control when to stop loading the lisp source file.

How this function is used is as below:

 (if (byte-compile-file-if-newer "~/.emacs")
     (load-file "~/.emacs")
     (leave-load t))

Then, the ~/.emacs.elc will always be populated, and processed. To me,
this is almost the _perfect_ version for auto byte-compile and loading
for ~/.emacs. :-)

And this language feature IMO, is useful for people who want to
control the library loading process.
If you have any questions, don't hesitate, I've been thinking on how
to make ~/.emacs auto re-compiling procedure perfect for 3 days.

Thanks for reading.  ;-)






reply via email to

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