* Can we add a function which is used to returned immediately within an source file for lib?
@ 2008-09-10 9:31 Yiyi Hu
2008-09-11 5:04 ` Kevin Rodgers
2008-09-12 1:27 ` Thien-Thi Nguyen
0 siblings, 2 replies; 10+ messages in thread
From: Yiyi Hu @ 2008-09-10 9:31 UTC (permalink / raw
To: help-gnu-emacs
Can we add a function or extend (return t) to skip loading the rest of
source please?
Eg, my ~/.emacs
(defun byte-compile-file-if-newer (src)
(let ((result (concat src ".elc")))
(when (file-newer-than-file-p src result)
(byte-compile-file src)
(load-file result))))
(byte-compile-file-if-newer "~/.emacs")
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(auto-compression-mode t)
'(column-number-mode t)
'(cperl-indent-level 4)
'(delete-selection-mode t)
'(display-battery-mode t)
'(display-time-24hr-format t)
'(display-time-day-and-date t)
'(display-time-mode t)
'(encoded-kbd-mode t)
'(gnus-nntp-server "news.readfreenews.net")
'(indent-tabs-mode nil)
'(inferior-lisp-program "sbcl")
'(inhibit-eol-conversion t)
'(inhibit-startup-screen t)
'(initial-scratch-message nil)
'(menu-bar-mode nil)
'(mouse-avoidance-mode (quote exile) nil (avoid)))
For now, there is now way to support skip the rest of ~/.emacs after
(byte-compile-file-if-newer "~/.emacs").
^ permalink raw reply [flat|nested] 10+ messages in thread
* Can we add a function which is used to returned immediately within an source file for lib?
@ 2008-09-10 12:15 Yiyi Hu
2008-09-10 21:06 ` mail
0 siblings, 1 reply; 10+ messages in thread
From: Yiyi Hu @ 2008-09-10 12:15 UTC (permalink / raw
To: emacs-devel
Can we add a function or extend (return t) to skip loading the rest of
source please?
Eg, my ~/.emacs
(defun byte-compile-file-if-newer (src)
(let ((result (concat src ".elc")))
(when (file-newer-than-file-p src result)
(byte-compile-file src)
(load-file result))))
(byte-compile-file-if-newer "~/.emacs")
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(auto-compression-mode t)
'(column-number-mode t)
'(cperl-indent-level 4)
'(delete-selection-mode t)
'(display-battery-mode t)
'(display-time-24hr-format t)
'(display-time-day-and-date t)
'(display-time-mode t)
'(encoded-kbd-mode t)
'(gnus-nntp-server "news.readfreenews.net")
'(indent-tabs-mode nil)
'(inferior-lisp-program "sbcl")
'(inhibit-eol-conversion t)
'(inhibit-startup-screen t)
'(initial-scratch-message nil)
'(menu-bar-mode nil)
'(mouse-avoidance-mode (quote exile) nil (avoid)))
For now, there is now way to support skip the rest of ~/.emacs after
(byte-compile-file-if-newer "~/.emacs").
As It's already discussed.
So, I make long history short
Can we have a function or exend (return t) function for skip loading
of reset of ~/.emacs after we load the compiled version of ~/.emacs?
(if (byte-compile-file-if-newer src-file)
(exit-loading-of-remaining-source))
If you really want to see the reason, It's ok, I'll explain them again.
Thanks.
PS:
I don't mean to flood across several lists, At last, according to
asking within #emacs and my understanding, I think emacs-devel should
be the right place for a feature request on elisp language itself.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can we add a function which is used to returned immediately within an source file for lib?
2008-09-10 12:15 Can we add a function which is used to returned immediately within an source file for lib? Yiyi Hu
@ 2008-09-10 21:06 ` mail
2008-09-12 2:37 ` Yiyi Hu
0 siblings, 1 reply; 10+ messages in thread
From: mail @ 2008-09-10 21:06 UTC (permalink / raw
To: emacs-devel
"Yiyi Hu" <yiyihu@gmail.com> writes:
> Can we add a function or extend (return t) to skip loading the rest of
> source please?
What's wrong with `if'?
--
BOFH excuse #77:
Typo in the code
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can we add a function which is used to returned immediately within an source file for lib?
2008-09-10 9:31 Yiyi Hu
@ 2008-09-11 5:04 ` Kevin Rodgers
2008-09-12 2:24 ` Yiyi Hu
2008-09-12 1:27 ` Thien-Thi Nguyen
1 sibling, 1 reply; 10+ messages in thread
From: Kevin Rodgers @ 2008-09-11 5:04 UTC (permalink / raw
To: help-gnu-emacs
Yiyi Hu wrote:
> Can we add a function or extend (return t) to skip loading the rest of
> source please?
>
> Eg, my ~/.emacs
>
> (defun byte-compile-file-if-newer (src)
> (let ((result (concat src ".elc")))
> (when (file-newer-than-file-p src result)
> (byte-compile-file src)
> (load-file result))))
>
> (byte-compile-file-if-newer "~/.emacs")
>
> (custom-set-variables
> ;; custom-set-variables was added by Custom.
> ;; If you edit it by hand, you could mess it up, so be careful.
> ;; Your init file should contain only one such instance.
> ;; If there is more than one, they won't work right.
> '(auto-compression-mode t)
> '(column-number-mode t)
> '(cperl-indent-level 4)
> '(delete-selection-mode t)
> '(display-battery-mode t)
> '(display-time-24hr-format t)
> '(display-time-day-and-date t)
> '(display-time-mode t)
> '(encoded-kbd-mode t)
> '(gnus-nntp-server "news.readfreenews.net")
> '(indent-tabs-mode nil)
> '(inferior-lisp-program "sbcl")
> '(inhibit-eol-conversion t)
> '(inhibit-startup-screen t)
> '(initial-scratch-message nil)
> '(menu-bar-mode nil)
> '(mouse-avoidance-mode (quote exile) nil (avoid)))
>
> For now, there is now way to support skip the rest of ~/.emacs after
> (byte-compile-file-if-newer "~/.emacs").
Yes, it might be convenient if the load function established a tag that
you could throw to, or if some higher level interface to load did so
e.g. the inner lambda form in command-line (startup.el).
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can we add a function which is used to returned immediately within an source file for lib?
2008-09-10 9:31 Yiyi Hu
2008-09-11 5:04 ` Kevin Rodgers
@ 2008-09-12 1:27 ` Thien-Thi Nguyen
2008-09-12 2:23 ` Yiyi Hu
1 sibling, 1 reply; 10+ messages in thread
From: Thien-Thi Nguyen @ 2008-09-12 1:27 UTC (permalink / raw
To: Yiyi Hu; +Cc: help-gnu-emacs
() "Yiyi Hu" <yiyihu@gmail.com>
() Wed, 10 Sep 2008 17:31:07 +0800
to skip loading the rest of source
You can try:
(defun skip-loading ()
(with-current-buffer " *load*"
(goto-char (point-max))))
thi
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can we add a function which is used to returned immediately within an source file for lib?
2008-09-12 1:27 ` Thien-Thi Nguyen
@ 2008-09-12 2:23 ` Yiyi Hu
0 siblings, 0 replies; 10+ messages in thread
From: Yiyi Hu @ 2008-09-12 2:23 UTC (permalink / raw
To: Thien-Thi Nguyen; +Cc: help-gnu-emacs
It doesn't work when ~/.emacs.elc and ~/.emacs exists, And ~/.emacs is
newer than ~/.emacs.elc,
I'll got error which is a bit like.
An error has occurred while loading `/home/hyy/.emacs.elc':
error: No buffer named *load*
On Fri, Sep 12, 2008 at 1:27 AM, Thien-Thi Nguyen <ttn@gnuvola.org> wrote:
> () "Yiyi Hu" <yiyihu@gmail.com>
> () Wed, 10 Sep 2008 17:31:07 +0800
>
> to skip loading the rest of source
>
> You can try:
>
> (defun skip-loading ()
> (with-current-buffer " *load*"
> (goto-char (point-max))))
>
> thi
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can we add a function which is used to returned immediately within an source file for lib?
2008-09-11 5:04 ` Kevin Rodgers
@ 2008-09-12 2:24 ` Yiyi Hu
0 siblings, 0 replies; 10+ messages in thread
From: Yiyi Hu @ 2008-09-12 2:24 UTC (permalink / raw
To: Kevin Rodgers; +Cc: help-gnu-emacs
IMHO,
It won't be easily done without touching the c source for the load
function to quit directly.
On Thu, Sep 11, 2008 at 5:04 AM, Kevin Rodgers
<kevin.d.rodgers@gmail.com> wrote:
> Yiyi Hu wrote:
>>
>> Can we add a function or extend (return t) to skip loading the rest of
>> source please?
>>
>> Eg, my ~/.emacs
>>
>> (defun byte-compile-file-if-newer (src)
>> (let ((result (concat src ".elc")))
>> (when (file-newer-than-file-p src result)
>> (byte-compile-file src)
>> (load-file result))))
>>
>> (byte-compile-file-if-newer "~/.emacs")
>>
>> (custom-set-variables
>> ;; custom-set-variables was added by Custom.
>> ;; If you edit it by hand, you could mess it up, so be careful.
>> ;; Your init file should contain only one such instance.
>> ;; If there is more than one, they won't work right.
>> '(auto-compression-mode t)
>> '(column-number-mode t)
>> '(cperl-indent-level 4)
>> '(delete-selection-mode t)
>> '(display-battery-mode t)
>> '(display-time-24hr-format t)
>> '(display-time-day-and-date t)
>> '(display-time-mode t)
>> '(encoded-kbd-mode t)
>> '(gnus-nntp-server "news.readfreenews.net")
>> '(indent-tabs-mode nil)
>> '(inferior-lisp-program "sbcl")
>> '(inhibit-eol-conversion t)
>> '(inhibit-startup-screen t)
>> '(initial-scratch-message nil)
>> '(menu-bar-mode nil)
>> '(mouse-avoidance-mode (quote exile) nil (avoid)))
>>
>> For now, there is now way to support skip the rest of ~/.emacs after
>> (byte-compile-file-if-newer "~/.emacs").
>
> Yes, it might be convenient if the load function established a tag that
> you could throw to, or if some higher level interface to load did so
> e.g. the inner lambda form in command-line (startup.el).
>
> --
> Kevin Rodgers
> Denver, Colorado, USA
>
>
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can we add a function which is used to returned immediately within an source file for lib?
2008-09-10 21:06 ` mail
@ 2008-09-12 2:37 ` Yiyi Hu
2008-09-12 2:47 ` David Hansen
2008-09-12 2:51 ` Yiyi Hu
0 siblings, 2 replies; 10+ messages in thread
From: Yiyi Hu @ 2008-09-12 2:37 UTC (permalink / raw
To: mail; +Cc: emacs-devel
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.
The unless version has this problem.
(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.
returning while loading source is a good feature to have.
On Wed, Sep 10, 2008 at 9:06 PM, <mail@justinbogner.com> wrote:
> "Yiyi Hu" <yiyihu@gmail.com> writes:
>
>> Can we add a function or extend (return t) to skip loading the rest of
>> source please?
>
> What's wrong with `if'?
>
> --
> BOFH excuse #77:
>
> Typo in the code
>
>
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can we add a function which is used to returned immediately within an source file for lib?
2008-09-12 2:37 ` Yiyi Hu
@ 2008-09-12 2:47 ` David Hansen
2008-09-12 2:51 ` Yiyi Hu
1 sibling, 0 replies; 10+ messages in thread
From: David Hansen @ 2008-09-12 2:47 UTC (permalink / raw
To: emacs-devel
On Fri, 12 Sep 2008 02:37:47 +0000 Yiyi Hu wrote:
> 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.
Do the time stamp check and recompile from .emacs but use another file
for the actual code.
> The unless version has this problem.
> (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") )
Use another `custom-file' (setq custom-file "~/.emacs.d/emacs-custom")
or w/ above suggestion the problem doesn't occur:
(when (have-to-recompile-my-init-file-p)
(byte-compile-file my-init-file))
(load my-init-file)
;; Custom stuff follows...
> returning while loading source is a good feature to have.
Well, you can always use `condition-case' and `error' but you need one
wrapper for it.
David
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Can we add a function which is used to returned immediately within an source file for lib?
2008-09-12 2:37 ` Yiyi Hu
2008-09-12 2:47 ` David Hansen
@ 2008-09-12 2:51 ` Yiyi Hu
1 sibling, 0 replies; 10+ messages in thread
From: Yiyi Hu @ 2008-09-12 2:51 UTC (permalink / raw
To: mail; +Cc: emacs-devel
The example is,
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.
On Fri, Sep 12, 2008 at 2:37 AM, Yiyi Hu <yiyihu@gmail.com> wrote:
> 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.
>
> The unless version has this problem.
> (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.
>
> returning while loading source is a good feature to have.
>
> On Wed, Sep 10, 2008 at 9:06 PM, <mail@justinbogner.com> wrote:
>> "Yiyi Hu" <yiyihu@gmail.com> writes:
>>
>>> Can we add a function or extend (return t) to skip loading the rest of
>>> source please?
>>
>> What's wrong with `if'?
>>
>> --
>> BOFH excuse #77:
>>
>> Typo in the code
>>
>>
>>
>>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2008-09-12 2:51 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-10 12:15 Can we add a function which is used to returned immediately within an source file for lib? Yiyi Hu
2008-09-10 21:06 ` mail
2008-09-12 2:37 ` Yiyi Hu
2008-09-12 2:47 ` David Hansen
2008-09-12 2:51 ` Yiyi Hu
-- strict thread matches above, loose matches on Subject: below --
2008-09-10 9:31 Yiyi Hu
2008-09-11 5:04 ` Kevin Rodgers
2008-09-12 2:24 ` Yiyi Hu
2008-09-12 1:27 ` Thien-Thi Nguyen
2008-09-12 2:23 ` Yiyi Hu
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.