From 5ad2dac3dcba6a760eac16b7c23dde2f19a0056c Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Tue, 8 Mar 2011 20:51:28 +0100 Subject: Guile: new option for loading ~/.guile (see issue #32681) The new custom variable, geiser-guile-load-init-file-p, will be gone once Guile adquires the ability to specify the path to its init file. --- doc/repl.texi | 9 +++++++++ elisp/geiser-guile.el | 20 ++++++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/doc/repl.texi b/doc/repl.texi index b01295d..14a9397 100644 --- a/doc/repl.texi +++ b/doc/repl.texi @@ -320,6 +320,15 @@ initialisation file to be loaded on start-up. The equivalent variables for Racket are @code{geiser-racket-collects} and @code{geiser-racket-init-file}. +Note, however, that specifying @code{geiser-guile-init-file} is @i{not} +equivalent to changing Guile's init file (@file{~/.guile}), because the +former is loaded using the @code{-l} flag, together with @code{-q} to +disable loading the second. But there are subtle differences in the way +Guile loads the init file vs. how it loads a file specifed via the +@code{-l} flag. If what you want is just loading @file{~/.guile}, leave +@code{geiser-guile-init-file} alone and set +@code{geiser-guile-load-init-file-p} to @code{t} instead. + @subsubheading History By default, Geiser won't record duplicates in your input history. If you diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 4d7727c..169ac30 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -45,10 +45,20 @@ started." :group 'geiser-guile) (geiser-custom--defcustom geiser-guile-init-file "~/.guile-geiser" - "Initialization file with user code for the Guile REPL." + "Initialization file with user code for the Guile REPL. +If all you want is to load ~/.guile, set +`geiser-guile-load-init-file-p' instead." :type 'string :group 'geiser-guile) +(geiser-custom--defcustom geiser-guile-load-init-file-p nil + "Whether to load ~/.guile when starting Guile. +Note that, due to peculiarities in the way Guile loads its init +file, using `geiser-guile-init-file' is not equivalent to setting +this variable to t." + :type 'boolean + :group 'geiser-guile) + (geiser-custom--defcustom geiser-guile-debug-show-bt-p nil "Whether to autmatically show a full backtrace when entering the debugger. If `nil', only the last frame is shown." @@ -111,10 +121,12 @@ effect on new REPLs. For existing ones, use the command "Return a list with all parameters needed to start Guile. This function uses `geiser-guile-init-file' if it exists." (let ((init-file (and (stringp geiser-guile-init-file) - (expand-file-name geiser-guile-init-file)))) + (expand-file-name geiser-guile-init-file))) + (q-flags (or geiser-guile-load-init-file-p '("-q")))) `(,@(and (listp geiser-guile-binary) (cdr geiser-guile-binary)) - "-q" "-L" ,(expand-file-name "guile/" geiser-scheme-dir) - ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) geiser-guile-load-path)) + ,@q-flags "-L" ,(expand-file-name "guile/" geiser-scheme-dir) + ,@(apply 'append (mapcar (lambda (p) (list "-L" p)) + geiser-guile-load-path)) ,@(and init-file (file-readable-p init-file) (list "-l" init-file))))) ;;(defconst geiser-guile--prompt-regexp "^[^() \n]+@([^)]*?)> ") -- cgit v1.2.3