* Order of precedence for .el and .elc during load or require
@ 2007-05-31 21:48 Nordlöw
2007-06-01 0:18 ` Tim X
2007-06-01 13:23 ` Chris McMahan
0 siblings, 2 replies; 4+ messages in thread
From: Nordlöw @ 2007-05-31 21:48 UTC (permalink / raw)
To: help-gnu-emacs
High there again, Emacs power-users.
When I develop my Emacs I find it annoying that Emacs chooses the
compiled version (.elc) over the non-compiled version (.el) even if
the non-compiled version is newer than the compiled one.
Is there a way to change this behaviour, or are there any fundamental
drawback with my idea?
A good compromise would perhaps be to warn during load of, for
example, foo.elc when foo.el is newer (on the file-system).
/Nordlöw
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Order of precedence for .el and .elc during load or require
2007-05-31 21:48 Order of precedence for .el and .elc during load or require Nordlöw
@ 2007-06-01 0:18 ` Tim X
2007-06-01 13:23 ` Chris McMahan
1 sibling, 0 replies; 4+ messages in thread
From: Tim X @ 2007-06-01 0:18 UTC (permalink / raw)
To: help-gnu-emacs
Nordlöw <per.nordlow@gmail.com> writes:
> High there again, Emacs power-users.
>
> When I develop my Emacs I find it annoying that Emacs chooses the
> compiled version (.elc) over the non-compiled version (.el) even if
> the non-compiled version is newer than the compiled one.
>
> Is there a way to change this behaviour, or are there any fundamental
> drawback with my idea?
>
> A good compromise would perhaps be to warn during load of, for
> example, foo.elc when foo.el is newer (on the file-system).
>
Are you sure it doesn't already warn? I seem to remember seeing messages in the
*Messages* buffer warning that the source file was newer than the compiled
version.
Tim
--
tcross (at) rapttech dot com dot au
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Order of precedence for .el and .elc during load or require
2007-05-31 21:48 Order of precedence for .el and .elc during load or require Nordlöw
2007-06-01 0:18 ` Tim X
@ 2007-06-01 13:23 ` Chris McMahan
2007-06-05 14:40 ` Nordlöw
1 sibling, 1 reply; 4+ messages in thread
From: Chris McMahan @ 2007-06-01 13:23 UTC (permalink / raw)
To: help-gnu-emacs
One workaround I use is to have emacs offer to byte compile any .el
files on saving them.
;;;======================================================================
;;; byte compile the current buffer on saving it
;;;======================================================================
(defvar mode-specific-after-save-buffer-hooks nil
"Alist (MAJOR-MODE . HOOK) of after-save-buffer hooks
specific to major modes.")
(defun run-mode-specific-after-save-buffer-hooks ()
"Run hooks in `mode-specific-after-save-buffer-hooks' that match the
current buffer's major mode. To be put in `after-save-buffer-hooks'."
(let ((hooks mode-specific-after-save-buffer-hooks))
(while hooks
(let ((hook (car hooks)))
(if (eq (car hook) major-mode)
(funcall (cdr hook))))
(setq hooks (cdr hooks)))))
(defun ask-to-byte-compile ()
"Ask the user whether to byte-compile the current buffer
if its name ends in `.el' and the `.elc' file also exists."
(let ((name (buffer-file-name)))
(and name
(string-match "\\.el$" name)
(file-exists-p (concat name "c"))
(if (y-or-n-p (format "Byte-compile %s? " name))
(byte-compile-file name)
(message "")))))
(setq mode-specific-after-save-buffer-hooks
'((emacs-lisp-mode . ask-to-byte-compile)
(lisp-mode . ask-to-byte-compile)))
(setq after-save-hook '(run-mode-specific-after-save-buffer-hooks))
;;;======================================================================
Nordlöw <per.nordlow@gmail.com> writes:
> High there again, Emacs power-users.
>
> When I develop my Emacs I find it annoying that Emacs chooses the
> compiled version (.elc) over the non-compiled version (.el) even if
> the non-compiled version is newer than the compiled one.
>
> Is there a way to change this behaviour, or are there any fundamental
> drawback with my idea?
>
> A good compromise would perhaps be to warn during load of, for
> example, foo.elc when foo.el is newer (on the file-system).
>
> /Nordlöw
>
--
(. .)
=ooO=(_)=Ooo=====================================
Chris McMahan | first_initiallastname@one.dot.net
=================================================
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-06-05 14:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-31 21:48 Order of precedence for .el and .elc during load or require Nordlöw
2007-06-01 0:18 ` Tim X
2007-06-01 13:23 ` Chris McMahan
2007-06-05 14:40 ` Nordlöw
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.