From afa7fb40739992e22c7b4fd520ac6fac3d8e69c7 Mon Sep 17 00:00:00 2001 From: Jose Antonio Ortega Ruiz Date: Sat, 4 Sep 2010 21:17:12 +0200 Subject: REPL: (optionally) forget old errors on new expressions --- doc/geiser.texi | 16 ++++------------ doc/repl.texi | 27 +++++++++++++++++++++------ elisp/geiser-guile.el | 3 +++ elisp/geiser-repl.el | 13 +++++++++++++ 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/doc/geiser.texi b/doc/geiser.texi index afd71e9..61e99fb 100644 --- a/doc/geiser.texi +++ b/doc/geiser.texi @@ -46,6 +46,8 @@ The document was typeset with @node Top, Introduction, (dir), (dir) @top Geiser +@include top.texi + @menu * Introduction:: * Installation:: @@ -81,7 +83,8 @@ The REPL * Starting the REPL:: * First aids:: * Switching context:: -* Let Geiser spy:: +* Completion and error handling:: +* Autodoc and friends:: * Customization and tips:: Fun between the parens @@ -96,19 +99,8 @@ Fun between the parens @end detailmenu @end menu -@include top.texi - @insertcopying -@menu -* Introduction:: -* Installation:: -* The REPL:: -* Fun between the parens:: -* Index:: - -@end menu - @end ifnottex @include intro.texi diff --git a/doc/repl.texi b/doc/repl.texi index d8583df..b314172 100644 --- a/doc/repl.texi +++ b/doc/repl.texi @@ -9,7 +9,8 @@ ready, just come back here and proceed to the following sections. * Starting the REPL:: * First aids:: * Switching context:: -* Let Geiser spy:: +* Completion and error handling:: +* Autodoc and friends:: * Customization and tips:: @end menu @@ -85,7 +86,7 @@ as explained @ref{switching-repl-buff,,here}). The remaining commands are meatier, and deserve sections of their own. -@node Switching context, Let Geiser spy, First aids, The REPL +@node Switching context, Completion and error handling, First aids, The REPL @section Switching context @cindex current module, in REPL @@ -118,8 +119,8 @@ a prefix-aware list of available module names. Which brings me to the next group of @repl{} commands. -@node Let Geiser spy, Customization and tips, Switching context, The REPL -@section Let Geiser spy, write and jump for you +@node Completion and error handling, Autodoc and friends, Switching context, The REPL +@section Completion and error handling @cindex completion, module name We've already seen Geiser completion of module names in action at the @@ -132,7 +133,19 @@ starting with the prefix at point. Needless to say, this is not a static list, and it will grow as you define or import new bindings in the namespace at hand. -But, oftentimes, there's more you'll want to know about an identifier +REPL buffers use Emacs' compilation mode to highlight errors reported by +the Scheme interpreter, and you can use the @command{next-error} command +(@kbd{M-g n}) to jump to their location. By default, every time you +enter a new expression for evaluation old error messages are forgotten, +so that @kbd{M-g n} will always jump to errors related to the last +evaluation request, if any. If you prefer a not so forgetful REPL, set +the customization variable @code{geiser-repl-forget-old-errors-p} to +@code{nil}. + +@node Autodoc and friends, Customization and tips, Completion and error handling, The REPL +@section Autodoc and friends + +Oftentimes, there's more you'll want to know about an identifier besides its name: what module does it belong to? is it a procedure and, if so, what arguments does it take? Geiser tries to help you answering those questions too. @@ -187,7 +200,7 @@ sections (but just perusing it's associated key bindings, by any of the methods we've already used for the @repl{}, will give you enough information to use it effectively enough). -@node Customization and tips, , Let Geiser spy, The REPL +@node Customization and tips, , Autodoc and friends, The REPL @section Customization and tips @cindex REPL customization @@ -227,6 +240,8 @@ full path to the requisite binary. @cindex scheme load path @cindex scheme init file +@cindex GUILE_LOAD_PATH +@cindex PLTCOLLECTS You can also specify a couple more initialisation parameters. For Guile, @code{geiser-guile-load-path} is a list of paths to add to its load path when it's started, while @code{geiser-guile-init-file} is the path to an diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index 8d8c4f3..6086dd8 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -18,6 +18,8 @@ (require 'geiser-edit) (require 'geiser) +(require 'compile) + ;;; Customization: @@ -125,6 +127,7 @@ This function uses `geiser-guile-init-file' if it exists." (when (eq key 'geiser-debugger) (let ((bt-cmd (format ",%s\n" (if geiser-guile-debug-show-bt-p "bt" "fr")))) + (compilation-forget-errors) (goto-char (point-max)) (comint-send-string nil "((@ (geiser emacs) ge:newline))\n") (comint-send-string nil ",error-message\n") diff --git a/elisp/geiser-repl.el b/elisp/geiser-repl.el index dd85808..b8bb86d 100644 --- a/elisp/geiser-repl.el +++ b/elisp/geiser-repl.el @@ -79,6 +79,16 @@ implementation name gets appended to it." :type 'boolean :group 'geiser-repl) +(geiser-custom--defcustom geiser-repl-forget-old-errors-p t + "Whether to forget old errors upon entering a new expression. + +When on (the default), every time a new expression is entered in +the REPL old error messages are flushed, and using [[next-error]] +afterwards will jump only to error locations produced by the new +expression, if any." + :type 'boolean + :group 'geiser-repl) + ;;; Geiser REPL buffers and processes: @@ -402,6 +412,9 @@ module command as a string") (pmark (and proc (process-mark proc))) (intxt (and pmark (buffer-substring pmark (point))))) (when intxt + (when (and geiser-repl-forget-old-errors-p + (not (geiser-con--is-debugging))) + (compilation-forget-errors)) (comint-send-input) (when (string-match "^\\s-*$" intxt) (comint-send-string proc -- cgit v1.2.3