all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Yiyi Hu" <yiyihu@gmail.com>
To: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
Cc: 940@emacsbugs.donarmstrong.com
Subject: bug#940: Is there a way to quit loading of ~/.emacs please?
Date: Wed, 10 Sep 2008 02:24:53 +0800	[thread overview]
Message-ID: <f469f8de0809091124s2d671379l684bfbf620a6f186@mail.gmail.com> (raw)
In-Reply-To: <48C685F3.60001@gmail.com>

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	other threads:[~2008-09-09 18:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-09  6:50 bug#940: Is there a way to quit loading of ~/.emacs please? Yiyi Hu
2008-09-09 13:52 ` Juanma Barranquero
2008-09-09 14:19 ` Lennart Borgman (gmail)
2008-09-09 18:24   ` Yiyi Hu [this message]
2008-09-09 22:10     ` Lennart Borgman (gmail)
2008-09-09 23:45       ` Yiyi Hu
     [not found]     ` <18631.27735.100063.263157@kahikatea.snap.net.nz>
2008-09-10  7:53       ` Yiyi Hu
2008-09-09 14:52 ` Stefan Monnier
2011-10-04 19:31 ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f469f8de0809091124s2d671379l684bfbf620a6f186@mail.gmail.com \
    --to=yiyihu@gmail.com \
    --cc=940@emacsbugs.donarmstrong.com \
    --cc=lennart.borgman@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.