diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-08-06 19:15:35 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-08-06 19:15:35 +0200 |
commit | 94f40872f82fa08d780630ec492d5a4ef4875134 (patch) | |
tree | 96292100211a634b78ba256ea40d60ed52639052 | |
parent | 3572a10cc7e9328f491ca20d95e05ae0e377e218 (diff) | |
download | geiser-guile-94f40872f82fa08d780630ec492d5a4ef4875134.tar.gz geiser-guile-94f40872f82fa08d780630ec492d5a4ef4875134.tar.bz2 |
Keybinding changes documented.
-rw-r--r-- | doc/fun.texi | 52 | ||||
-rw-r--r-- | doc/img/repl-menu.png | bin | 28491 -> 29590 bytes | |||
-rw-r--r-- | doc/repl.texi | 27 | ||||
-rw-r--r-- | elisp/geiser-mode.el | 1 | ||||
-rw-r--r-- | elisp/geiser-repl.el | 19 |
5 files changed, 50 insertions, 49 deletions
diff --git a/doc/fun.texi b/doc/fun.texi index 3f17688..6a8f745 100644 --- a/doc/fun.texi +++ b/doc/fun.texi @@ -81,7 +81,7 @@ you to first call @code{run-geiser} (or one of its variants, see them described @ref{choosing-impl,,here}), and then open Scheme files; but there's nothing wrong in first opening a couple Scheme buffers and then starting the REPL (you can even find it more convenient, since -pressing @kbd{C-c z} in a Scheme buffer will start the REPL for you). +pressing @kbd{C-c C-z} in a Scheme buffer will start the REPL for you). Since Geiser supports more than one Scheme implementation, though, there's the problem of knowing which of them is to be associated with each Scheme source file. Serviceable as it is, @i{geiser-mode} will try @@ -91,7 +91,7 @@ Scheme implementation, feel free to skip to the @ref{switching-repl-buff,,next subsection}. @subsubheading How Geiser associates a REPL to your Scheme buffer -To determine what Scheme implementation is to be used for a given source +To determine what Scheme implementation corresponds to a given source file, Geiser uses the following algorithm: @enumerate @item @@ -157,25 +157,23 @@ first served, this new rule will take precedence over the default ones. @subsubheading Switching between source files and the REPL @anchor{switching-repl-buff} Once you have a working @i{geiser-mode}, -you can switch from Scheme source buffers to the REPL using @kbd{C-c z} -or @kbd{C-c C-z} (as you might have noticed, in Geiser, whenever a key -chord ends with a single letter, there's an equivalent one with that -letter modified by @key{Ctrl}). Those shortcuts map to the interactive -command @code{switch-to-geiser}. +you can switch from Scheme source buffers to the REPL or @kbd{C-c C-z}. +Those shortcuts map to the interactive command @code{switch-to-geiser}. -If you use a numeric prefix, as in @kbd{C-u C-c z}, besides being +If you use a numeric prefix, as in @kbd{C-u C-c C-z}, besides being teleported to the REPL, the latter will switch to the namespace of the -Scheme source file (as if you had used @kbd{C-c m} in the REPL, with the -source file's module as argument; cf. @ref{Switching context}). +Scheme source file (as if you had used @kbd{C-c C-m} in the REPL, with +the source file's module as argument; cf. @ref{Switching context}). This +command is also bound to @kbd{C-c C-Z}, with a capital zed. -Once you're in the REPL, the same @kbd{C-c z} shortcut will bring you +Once you're in the REPL, the same @kbd{C-c C-z} shortcut will bring you back to the buffer you jumped from, provided you don't kill the Scheme process in between. This is why the command is called @i{switch-to-geiser} instead of @i{switch-to-repl}, and what makes it really handy, if you ask me. If for some reason you're not happy with the Scheme implementation that -Geiser has assigned to your file, you can change it with @kbd{C-c s}, +Geiser has assigned to your file, you can change it with @kbd{C-c C-s}, and probably take a look at @ref{switching-repl-buff,,the previous subsection} to make sure that Geiser doesn't get confused again. @@ -198,13 +196,14 @@ The first thing you will notice by moving around Scheme source is that, every now and then, the echo area lightens up with the same autodoc messages we know and love from our REPL forays. This happens every time the Scheme process is able to recognise an identifier in the buffer, and -provide information on its arity and the name of its formal arguments, -if any. That information will only be available if the module the -identifier belongs to has been loaded in the running Scheme image. So it -can be the case that, at first, no autodoc is shown for identifiers -defined in the file you're editing. But as soon as you evaluate them -(either individually or collectively using, for instance, @kbd{C-c k}) -their signatures will start appearing in the echo area. +provide information either on its value (for variables) or on its arity +and the name of its formal arguments (for procedures and macros). That +information will only be available if the module the identifier belongs +to has been loaded in the running Scheme image. So it can be the case +that, at first, no autodoc is shown for identifiers defined in the file +you're editing. But as soon as you evaluate them (either individually or +collectively using any of the devices described in @ref{Evaluating +Scheme code}) their signatures will start appearing in the echo area. Autodoc activation is controlled by a minor mode, @code{geiser-autodoc}, which you can toggle with @kbd{M-x geiser-autodoc}, or its associated @@ -213,12 +212,15 @@ mode-line is telling you that autodoc is active. If you prefer, for some obscure reason, that it be inactive by default, just set @var{geiser-mode-autodoc-p} to @code{nil} in your customization files. -@img{autodoc-req, right} The way autodoc displays arity information -deserves some explanation. It will first show the name of the module -where the identifier at hand is defined, followed by a colon and the -identifier itself. If the latter corresponds to a procedure or macro, it -will be followed by a list of argument names, starting with the ones -that are required. +@img{autodoc-req, right} The way autodoc displays information deserves +some explanation. It will first show the name of the module where the +identifier at hand is defined, followed by a colon and the identifier +itself. If the latter corresponds to a procedure or macro, it will be +followed by a list of argument names, starting with the ones that are +required. Then there comes a square-bracketed list of optional argument +names, if any. When an optional argument has a default value (or a form +defining its default value), instead of a plain name, autodoc will +display a list with the name followed by its initialisation form @node Evaluating Scheme code, Jumping around, Autodoc redux, Fun between the parens @section Evaluating Scheme code diff --git a/doc/img/repl-menu.png b/doc/img/repl-menu.png Binary files differindex 306552d..4f460c3 100644 --- a/doc/img/repl-menu.png +++ b/doc/img/repl-menu.png diff --git a/doc/repl.texi b/doc/repl.texi index 272a052..12231c7 100644 --- a/doc/repl.texi +++ b/doc/repl.texi @@ -79,7 +79,7 @@ the input received from then underlying Scheme (specially if you have multiple threads writing to the standard ports), and become irresponsive; you can try this command to try to revive it without killing the process. Finally, if worse comes to worst and the process is -dead, @kbd{C-c z} will restart it (but the same shortcut, issued when +dead, @kbd{C-c C-z} will restart it (but the same shortcut, issued when the REPL is alive, will bring you back to the buffer you came from, as explained @ref{switching-repl-buff,,here}). @@ -93,7 +93,7 @@ In tune with Geiser's @ref{current-module,,modus operandi}, evaluations in the REPL take place if the namespace of the current module. As noted above, the REPL's prompt tells you the name of the current module. To switch to a different one, you can use the command -@command{switch-to-geiser-module}, bound to @kbd{C-c m}. You'll notice +@command{switch-to-geiser-module}, bound to @kbd{C-c C-m}. You'll notice that Geiser simply uses the underlying Scheme's native namespace switching facilities (@command{,m} in Guile and @command{enter!} in Racket), and that it doesn't even try to hide that fact. That means that you can @@ -104,7 +104,7 @@ Once you enter a new module, only those bindings visible in its namespace will be available to your evaluations. All schemes supported by Geiser provide a way to import new modules in the current namespace. Again, there's a Geiser command, @command{geiser-repl-import-module}, to -invoke such functionality, bound this time to @kbd{C-c i}. And, again, +invoke such functionality, bound this time to @kbd{C-c C-i}. And, again, you'll see Geiser just introducing the native incantation for you, and you're free to use such incantations by hand whenever you want. @@ -140,18 +140,19 @@ now and then. That was Geiser trying to be helpful (while, hopefully, not being clippy), or, more concretely, what i call, for want of a better name, its @dfn{autodoc} mode. Whenever it's active (did you notice that @i{A} in the mode-line?), Geiser's gerbils will be scanning -what you type and showing (unless you silent them with @kbd{C-c a}) -arity information about the procedure nearest to point. +what you type and showing (unless you silent them with @kbd{C-c C-a}) +information about the identifier nearest to point. @image{img/repl-autodoc} -That information includes the procedure's name, prefixed with the name -of the module it belongs to, followed by the name of its arguments (or -an underscore if Geiser cannot determine the name used in the -definition). Optional arguments are surrounded by square brackets, and, -when the optional argument has a default value, it's represented by a -list made up of its name and that value. When the argument is a keyword -argument, its name is preceded by a colon. +If that identifier corresponds to a variable visible in the current +namespace, you'll see the module it belongs to and its value. For +procedures and macros, autodoc will display, instead of their value, the +argument names (or an underscore if Geiser cannot determine the name +used in the definition). Optional arguments are surrounded by square +brackets, and, when the optional argument has a default value, it's +represented by a list made up of its name and that value. When the +argument is a keyword argument, its name is preceded by a colon. If that's not enough documentation for you, @kbd{C-c C-d d} will open a separate documentation buffer with help on the symbol at point. For some @@ -233,7 +234,7 @@ If you happen to love peace and quiet and prefer to keep your REPL's echo area free from autodoc's noise, @var{geiser-repl-autodoc-p} is the customization variable for you: set it to @code{nil} and autodoc will be disabled by default in new REPLs. You can always bring the fairies back, -on a per REPL basis, using @kbd{C-c a}. +on a per REPL basis, using @kbd{C-c C-a}. @c Local Variables: @c mode: texinfo diff --git a/elisp/geiser-mode.el b/elisp/geiser-mode.el index ff50a10..7004004 100644 --- a/elisp/geiser-mode.el +++ b/elisp/geiser-mode.el @@ -235,7 +235,6 @@ interacting with the Geiser REPL is at your disposal. ("Switch to REPL and enter module" "\C-c\C-Z" geiser-mode-switch-to-repl-and-enter) ("Set Scheme..." "\C-c\C-s" geiser-set-scheme) - ;; ("Load buffer" "\C-l" geiser-compile-current-buffer) -- ("Edit symbol at point" "\M-." geiser-edit-symbol-at-point :enable (symbol-at-point)) diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index 37572d0..9e36fa4 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -88,12 +88,13 @@ implementation name gets appended to it." (make-variable-buffer-local (defvar geiser-repl--repl nil)) -(defsubst geiser-repl--this-buffer-repl () - geiser-repl--repl) - (defsubst geiser-repl--set-this-buffer-repl (r) (setq geiser-repl--repl r)) +(defun geiser-repl--live-p () + (and geiser-repl--repl + (get-buffer-process geiser-repl--repl))) + (defun geiser-repl--repl/impl (impl &optional repls) (catch 'repl (dolist (repl (or repls geiser-repl--repls)) @@ -232,8 +233,7 @@ If no REPL is running, execute `run-geiser' to start a fresh one." (interactive "P") (let* ((impl (or impl geiser-impl--implementation)) (repl (cond ((and (not ask) (not impl) - (or (geiser-repl--this-buffer-repl) - (car geiser-repl--repls)))) + (or geiser-repl--repl (car geiser-repl--repls)))) ((and (not ask) impl (geiser-repl--repl/impl impl))))) (pop-up-windows geiser-repl-window-allow-split)) (cond ((and (eq (current-buffer) repl) @@ -315,7 +315,7 @@ module command as a string") (when (buffer-live-p buffer) (with-current-buffer buffer (when (and (eq geiser-impl--implementation impl) - (equal cb (geiser-repl--this-buffer-repl))) + (equal cb geiser-repl--repl)) (geiser-repl--get-repl geiser-impl--implementation))))))) (defun geiser-repl--sentinel (proc event) @@ -460,12 +460,11 @@ module command as a string") "Documentation for module at point" :enable (symbol-at-point)) -- ("Kill Scheme interpreter" "\C-c\C-q" comint-kill-subjob - :enable (geiser-repl--this-buffer-repl)) - ("Restart" "\C-c\C-z" switch-to-geiser - :enable (not (geiser-repl--this-buffer-repl))) + :enable (geiser-repl--live-p)) + ("Restart" "\C-c\C-z" switch-to-geiser :enable (not (geiser-repl--live-p))) ("Revive REPL" "\C-c\C-k" geiser-repl-nuke "Use this command if the REPL becomes irresponsive" - :enable (geiser-repl--this-buffer-repl)) + :enable (geiser-repl--live-p)) -- (custom "REPL options" geiser-repl)) |