From: Anton V. <avo...@ya...> - 2011-10-31 21:43:35
|
Hello. Is it possible to have some init file for CLISP which is executed always (in contrast to .clisprc which is executed only when CLISP is started with REPL, but not when started from SLIME). The motivation is to have quicklisp always available for lisp code executed by CLISP. Best regards, - Anton |
From: Pascal J. B. <pj...@in...> - 2011-10-31 22:14:13
|
Anton Vodonosov <avo...@ya...> writes: > Is it possible to have some init file for CLISP which is executed always > (in contrast to .clisprc which is executed only when CLISP is started with > REPL, but not when started from SLIME). > > The motivation is to have quicklisp always available for lisp code executed > by CLISP. clisp -q -norc -ansi (load "quicklisp/setup.lisp") (ext:save-init-mem "~/bin/ql-clisp" :executable t) (ext:quit) and now on use ~/bin/ql-clisp instead of clisp. Not tested, it may not work. Notably, quicklisp/setup.lisp probably hard-wires pathnames, so it probably won't work if launched from another account. -- __Pascal Bourguignon__ http://www.informatimago.com/ A bad day in () is better than a good day in {}. |
From: Fernando L. C. <co...@lu...> - 2011-11-01 00:35:08
|
On Mon, 31 Oct 2011 22:56:44 +0100, "Pascal J. Bourguignon" <pj...@in...> wrote: > Anton Vodonosov <avo...@ya...> writes: > > > Is it possible to have some init file for CLISP which is executed > > clisp -q -norc -ansi > (load "quicklisp/setup.lisp") > (ext:save-init-mem "~/bin/ql-clisp" :executable t) > (ext:quit) > > and now on use ~/bin/ql-clisp instead of clisp. > > Not tested, it may not work. Notably, quicklisp/setup.lisp probably > hard-wires pathnames, so it probably won't work if launched from > another account. I tried it verbatim and it didn't worked, it seems in my installation ext:save-init-mem is mapped to saveinitmem, in fact I have no package EXT. But I made it work like this: $ clisp -q -norc -ansi ;; this is suggested configuration for rc file by quicklisp docs (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))) (saveinitmem "~/bin/ql-clisp" :executable t) (quit) -- Fernando Canizo (a.k.a. conan) - http://conan.muriandre.com/ GCS d? s:+ a C++ P--- L++++ E--- W+++ w--- M-- PE-- !tv b+++ h---- y+++ |
From: Pascal J. B. <pj...@in...> - 2011-11-01 02:59:36
|
"Fernando L. Canizo" <co...@lu...> writes: > On Mon, 31 Oct 2011 22:56:44 +0100, "Pascal J. Bourguignon" > <pj...@in...> wrote: > >> Anton Vodonosov <avo...@ya...> writes: >> >> > Is it possible to have some init file for CLISP which is executed >> >> clisp -q -norc -ansi >> (load "quicklisp/setup.lisp") >> (ext:save-init-mem "~/bin/ql-clisp" :executable t) >> (ext:quit) >> >> and now on use ~/bin/ql-clisp instead of clisp. >> >> Not tested, it may not work. Notably, quicklisp/setup.lisp probably >> hard-wires pathnames, so it probably won't work if launched from >> another account. > > I tried it verbatim and it didn't worked, it seems in my installation > ext:save-init-mem is mapped to saveinitmem, in fact I have no package > EXT. No, it's me, I didn't try and didn't remember that saveinitmem is a word in clisp ;-) Sorry about that. > But I made it work like this: > > $ clisp -q -norc -ansi > ;; this is suggested configuration for rc file by quicklisp docs > (let ((quicklisp-init (merge-pathnames > "quicklisp/setup.lisp" (user-homedir-pathname)))) > (when (probe-file quicklisp-init) > (load quicklisp-init))) > (saveinitmem "~/bin/ql-clisp" :executable t) > (quit) Now that I think about it, if quicklisp hardwires pathnames, then you could instead load it when you load the image by setting a init function: clisp -q -norc -ansi ;; No change to the original image, but: (ext:saveinitmem "~/bin/ql-clisp" :executable t :init-function (lambda () (let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))) (when (probe-file quicklisp-init) (load quicklisp-init))))) Also, for global scripts, you could install quicklisp in a global location and use it instead of a user specific quicklisp installation. -- __Pascal Bourguignon__ http://www.informatimago.com/ A bad day in () is better than a good day in {}. |
From: Raymond T. <toy...@gm...> - 2011-11-01 02:32:26
|
On 10/31/11 2:43 PM, Anton Vodonosov wrote: > Hello. > > Is it possible to have some init file for CLISP which is executed always > (in contrast to .clisprc which is executed only when CLISP is started with > REPL, but not when started from SLIME). Do you mean slime starts clisp without loading .clisprc? Because clisp does load .clisprc when I start clisp with slime. Ray |
From: Anton V. <avo...@ya...> - 2011-11-01 10:06:52
|
Hello. 01.11.2011, 06:32, "Raymond Toy" <toy...@gm...>: > On 10/31/11 2:43 PM, Anton Vodonosov wrote: > >> Is it possible to have some init file for CLISP which is executed always >> (in contrast to .clisprc which is executed only when CLISP is started with >> REPL, but not when started from SLIME). > > Do you mean slime starts clisp without loading .clisprc? Because clisp > does load .clisprc when I start clisp with slime. Yes, for me .clisprc is not loaded. I am on Windows 7, CLISP 2.49, Emacs 23.2.1, slime-20110730-cvs. In .emacs I have (setq inferior-lisp-program "clisp.exe") 01.11.2011, 06:58, "Pascal J. Bourguignon" <pj...@in...>: > Now that I think about it, if quicklisp hardwires pathnames, then you > could instead load it when you load the image by setting a init > function: > > clisp -q -norc -ansi > ;; No change to the original image, but: > (ext:saveinitmem "~/bin/ql-clisp" > :executable t > :init-function (lambda () > (let ((quicklisp-init (merge-pathnames > "quicklisp/setup.lisp" (user-homedir-pathname)))) > (when (probe-file quicklisp-init) > (load quicklisp-init))))) > > Also, for global scripts, you could install quicklisp in a global > location and use it instead of a user specific quicklisp installation. And another possibility would be to install quicklisp loader (or init file loader) is CUSTOM:*INIT-HOOKS* (http://www.clisp.org/impnotes/custom-init-fini.html#init-hooks). E.e. (push (lambda () (load (merge-pathnames "my-clisp-init.lisp" (user-homedir-pathname))))) before saving the image [the code is not tested]. Best regards, - Anton |
From: Anton V. <avo...@ya...> - 2011-11-01 10:08:45
|
01.11.2011, 14:06, "Anton Vodonosov" <avo...@ya...>: > And another possibility would be to install quicklisp loader (or init file loader) > is CUSTOM:*INIT-HOOKS* (http://www.clisp.org/impnotes/custom-init-fini.html#init-hooks). > > E.e. > (push (lambda () (load (merge-pathnames "my-clisp-init.lisp" (user-homedir-pathname))))) > before saving the image [the code is not tested]. > I mean (push (lambda () (load (merge-pathnames "my-clisp-init.lisp" (user-homedir-pathname)))) CUSTOM:*INIT-HOOKS*) |
From: Raymond T. <toy...@gm...> - 2011-11-02 05:12:00
|
On 11/1/11 3:06 AM, Anton Vodonosov wrote: > Hello. > > 01.11.2011, 06:32, "Raymond Toy" <toy...@gm...>: >> On 10/31/11 2:43 PM, Anton Vodonosov wrote: >> >>> Is it possible to have some init file for CLISP which is executed always >>> (in contrast to .clisprc which is executed only when CLISP is started with >>> REPL, but not when started from SLIME). >> Do you mean slime starts clisp without loading .clisprc? Because clisp >> does load .clisprc when I start clisp with slime. > Yes, for me .clisprc is not loaded. > > I am on Windows 7, CLISP 2.49, Emacs 23.2.1, slime-20110730-cvs. Oh. Perhaps that's a problem on windows or with your version of slime. I ran my test on Mac OS X with slime 2011-08-18 and xemacs 21.5beta. Ray |
From: Anton V. <avo...@ya...> - 2011-11-30 19:10:07
|
02.11.2011, 09:11, "Raymond Toy" <toy...@gm...>: > On 11/1/11 3:06 AM, Anton Vodonosov wrote: >> I am on Windows 7, CLISP 2.49, Emacs 23.2.1, slime-20110730-cvs. > Oh. Perhaps that's a problem on windows or with your version of slime. > I ran my test on Mac OS X with slime 2011-08-18 and xemacs 21.5beta. For the record, I found the reason. It's Emacs. It wants to use environment variable HOME to determine the location where to store the .emacs file. On Windows HOME is usually absent, and Emacs then uses APPDATA variable instead. So far OK. But then Emacs sets the HOME variable to the value of APPDATA. The processes it starts (e.g. lisp implementation for slime) inherit the HOME variable. On Windows my home directory is C:\Users\anton\. APPDATA points to C:\Users\anton\AppData\Roaming\. CLISP (and other lisps) determine C:\Users\anton as the value of (user-homedir-pathname), even it the HOME environment variable is absent. And that's where .clisprc.lisp is stored. But when they inherit HOME from Emacs, they use it's value (which is set by Emacs to C:\Users\anton\AppData\Roaming\), and .clisprc is not found. Best regards, - Anton |