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

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

Re: Initialization customization not being saved : solved !


From: Juanma Barranquero
Subject: Re: Initialization customization not being saved : solved !
Date: Wed, 2 Apr 2008 15:50:59 +0200

On Wed, Apr 2, 2008 at 10:44 AM, martin rudalics <address@hidden> wrote:

>  I'd opt for (3) although I generally hate programs asking me questions
>  during startup.

I use the following in my site-start.el:

;;;;; site-start.el ;;;;;
(catch 'init-file
  (unless init-file-user (throw 'init-file nil))
  (dolist (source-file '("~/.emacs.el" "~/.emacs"
                         "~/_emacs.el" "~/_emacs"
                         "~/.emacs.d/init.el"))
    (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 ((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 source file? " source-file)
                      10 nil)
                     (setq init-file-user nil))
              (fit-window-to-buffer window)))))
      (throw 'init-file t))))
;;;;;;;;;; end of site-start.el ;;;;;;;;;;

 Juanma




reply via email to

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