GNU bug report logs -
#940
Is there a way to quit loading of ~/.emacs please?
Previous Next
Reported by: "Yiyi Hu" <yiyihu <at> gmail.com>
Date: Tue, 9 Sep 2008 07:00:03 UTC
Severity: wishlist
Tags: notabug, wontfix
Done: Glenn Morris <rgm <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On Tue, Sep 9, 2008 at 08:50, Yiyi Hu <yiyihu <at> gmail.com> wrote:
> Is there a way to quit the loading after we compile the ~/.emacs and
> load the ~/.emacs.elc file?
If you can modify site-start.el, you can use something similar to this
code, which compiles the init source file only when the .elc exists
and is stale, or compiled with a newer Emacs (which could easily cause
trouble).
;; site-start.el
;;
(catch 'init-file
(dolist (source-file '("~/.emacs.el" "~/.emacs" ;; ~/.emacs.elc
"~/_emacs.el" "~/_emacs" ;; ~/_emacs.elc (if
on Windows)
"~/.emacs.d/init.el")) ;; ~/.emacs.d/init.elc
(when (file-exists-p source-file)
(require 'bytecomp)
(let ((byte-file (byte-compile-dest-file source-file)))
(unless (file-exists-p byte-file) (throw 'init-file nil))
(when (or (time-less-p (nth 5 (file-attributes byte-file))
(nth 5 (file-attributes source-file)))
(with-temp-buffer
(insert-file-contents-literally byte-file nil 0 5)
(and (looking-at ";ELC")
(> (char-after 5) emacs-major-version))))
(let* ((split-width-threshold nil) ;; 23.1+
(window (display-buffer (get-buffer-create "*Compile-Log*"))))
(fit-window-to-buffer window)
(set-window-dedicated-p window t)
(unwind-protect
(or (byte-compile-file source-file)
(y-or-n-p-with-timeout
(format "Error bytecompiling %s; do you want to
load it? " source-file)
10 nil)
(setq init-file-user nil))
(fit-window-to-buffer window)))))
Juanma
This bug report was last modified 13 years and 254 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.