Christophe Weblog Wiki Code Publications Music
swankr.git
12 years agolog and fix bug #20: infinite errors on disconnect.
Christophe Rhodes [Thu, 15 Dec 2011 21:13:57 +0000 (21:13 +0000)]
log and fix bug #20: infinite errors on disconnect.

Check for a zero-element character vector return from readChar.  (This
is not documented as the EOF return value, no, but it makes sense).

Also commit bug reports #18 and #19, and some README rearrangement.

12 years agogive us a chance with utf-8
Christophe Rhodes [Fri, 9 Dec 2011 18:20:04 +0000 (18:20 +0000)]
give us a chance with utf-8

Calculate the length of the output to emacs using nchar(type="bytes")

This makes help files sort-of work again

12 years agolog the external-format / encoding bug
Christophe Rhodes [Fri, 9 Dec 2011 10:49:13 +0000 (10:49 +0000)]
log the external-format / encoding bug

12 years agopass an :encoding stanza in the connection information
Christophe Rhodes [Fri, 9 Dec 2011 10:44:36 +0000 (10:44 +0000)]
pass an :encoding stanza in the connection information

Allows slime-repl to start again.  I've said "utf-8-unix" but that is
almost certainly a lie; I have no real idea how R handles encodings of
text.  Simply passing in "ë" to the R slime repl breaks things without
too much effort.

12 years agodon't print out "locals" from the global environment
Christophe Rhodes [Sun, 23 Oct 2011 09:54:19 +0000 (10:54 +0100)]
don't print out "locals" from the global environment

This is important because e.g. the repl evaluation happens in the
global environment, so errors on code called from the repl will pull
up a backtrace with that evaluation frame, which can be inspected for
locals.  But printing out all the locals is a hugely expensive and not
helpful thing to do.

12 years agofix for visible values from region and interactive eval
Christophe Rhodes [Sun, 23 Oct 2011 09:51:33 +0000 (10:51 +0100)]
fix for visible values from region and interactive eval

editing thinko: need tmp$value (not just value)

12 years agofix swank-media repl-result-maker for complex
Christophe Rhodes [Sun, 23 Oct 2011 09:50:16 +0000 (10:50 +0100)]
fix swank-media repl-result-maker for complex

There ought to be some way of catching this mistake, which is passing
a non-length-1 vector to the swank functions, which then vectorise and
confuse the event stream.

12 years agolog a couple more bugs
Christophe Rhodes [Sun, 23 Oct 2011 09:48:55 +0000 (10:48 +0100)]
log a couple more bugs

12 years agocatch errors during printing of frame locals
Christophe Rhodes [Mon, 19 Sep 2011 13:06:23 +0000 (14:06 +0100)]
catch errors during printing of frame locals

tryCatch is R's handler-case.  (Spent some time wondering why
withCallingHandlers wasn't working, but that's handler-bind.)

12 years agolog some more bugs
Christophe Rhodes [Mon, 19 Sep 2011 13:05:43 +0000 (14:05 +0100)]
log some more bugs

12 years agoescape names when searching for completions
Christophe Rhodes [Tue, 13 Sep 2011 21:26:12 +0000 (22:26 +0100)]
escape names when searching for completions

otherwise extended regexp metacharacters, particularly ".", get
interpreted as those metacharacters rather than literals.  (bug #12)

12 years agosupport ?help buffers
Christophe Rhodes [Tue, 13 Sep 2011 11:40:20 +0000 (12:40 +0100)]
support ?help buffers

use new fancy :popup-buffer event in slime-media.

12 years agolog some more bugs
Christophe Rhodes [Tue, 13 Sep 2011 11:39:05 +0000 (12:39 +0100)]
log some more bugs

12 years agodeal with 0 or multiple expressions at the repl
Christophe Rhodes [Sat, 10 Sep 2011 22:58:36 +0000 (23:58 +0100)]
deal with 0 or multiple expressions at the repl

It's easy really; just iterate over expressions.  Resolves bug #10.

12 years agoupdate BUGS file
Christophe Rhodes [Sat, 10 Sep 2011 22:46:59 +0000 (23:46 +0100)]
update BUGS file

We've resolved and :FIXED: several.  Log a bug related to repl handling
of multiple expressions.

12 years agouse withVisible() in appropriate places
Christophe Rhodes [Sat, 10 Sep 2011 08:23:25 +0000 (09:23 +0100)]
use withVisible() in appropriate places

Makes C-c C-r substantially less painful, and also produces slightly
fewer surprises at the REPL.  (resolves #5)

12 years agouse a similar repl result method in swank-media.R for ggplot objects
Christophe Rhodes [Fri, 9 Sep 2011 20:46:01 +0000 (21:46 +0100)]
use a similar repl result method in swank-media.R for ggplot objects

Should refactor (and provide width/height options)

12 years agolog wishlist bug #9 (wanting help() and ? to work)
Christophe Rhodes [Fri, 9 Sep 2011 20:44:53 +0000 (21:44 +0100)]
log wishlist bug #9 (wanting help() and ? to work)

12 years agoprevious commit sorted out #8 (filesystem-location-independence)
Christophe Rhodes [Fri, 9 Sep 2011 20:44:34 +0000 (21:44 +0100)]
previous commit sorted out #8 (filesystem-location-independence)

12 years agomake contribs load when the working directory isn't swankr's
Christophe Rhodes [Sat, 20 Aug 2011 08:57:50 +0000 (09:57 +0100)]
make contribs load when the working directory isn't swankr's

depends on swank.R itself being source()d with chdir=TRUE, but doesn't
break any previously-working use case.

13 years agoupdate BUGS and TODO
Christophe Rhodes [Wed, 6 Apr 2011 08:14:46 +0000 (09:14 +0100)]
update BUGS and TODO

13 years agoenough support for emacs/slim to start swank for itself
Christophe Rhodes [Wed, 6 Apr 2011 08:13:30 +0000 (09:13 +0100)]
enough support for emacs/slim to start swank for itself

There's a race condition, I think, in between writing the socket port
and running the socket server; it might be as simple as reordering the
writing and the socket opening, but strange things happened once when
I did that.

13 years agoimplement swank:interactive-eval-region
Christophe Rhodes [Wed, 6 Apr 2011 08:11:08 +0000 (09:11 +0100)]
implement swank:interactive-eval-region

Because of our vaguely dodgy heuristic for finding the "defun" to
evaluate, C-c C-c is not terribly useful.  This allows at least C-c
C-r to be used without thinking.

13 years agofix swank:compile-file-for-emacs when loadp is true
Christophe Rhodes [Wed, 6 Apr 2011 07:59:05 +0000 (08:59 +0100)]
fix swank:compile-file-for-emacs when loadp is true

also retain source information in swank:load-file for maximum emacs
goodness.

13 years agosupport translation of t and nil
Christophe Rhodes [Wed, 6 Apr 2011 07:57:45 +0000 (08:57 +0100)]
support translation of t and nil

Parse them into TRUE and FALSE in the lisp->R translator

13 years agoimplement swank:quit-lisp
Christophe Rhodes [Wed, 6 Apr 2011 07:55:46 +0000 (08:55 +0100)]
implement swank:quit-lisp

13 years agoabsolutify some more source file finding
Christophe Rhodes [Wed, 6 Apr 2011 07:49:34 +0000 (08:49 +0100)]
absolutify some more source file finding

13 years agoexperiment with different printing methods (using swank-media)
Christophe Rhodes [Wed, 6 Apr 2011 07:48:33 +0000 (08:48 +0100)]
experiment with different printing methods (using swank-media)

13 years agoremove debugging code from swank-presentations
Christophe Rhodes [Wed, 6 Apr 2011 07:47:23 +0000 (08:47 +0100)]
remove debugging code from swank-presentations

13 years agoadd .htaccess for utf-8 html encoding
Christophe Rhodes [Fri, 8 Oct 2010 11:12:02 +0000 (12:12 +0100)]
add .htaccess for utf-8 html encoding

13 years agocapture output from evaluating swank requests
Christophe Rhodes [Fri, 8 Oct 2010 11:05:49 +0000 (12:05 +0100)]
capture output from evaluating swank requests

This fixes bug #1.  It is somewhat on the risky side given that there
are current known protocol problems in the presence of non-ASCII
encodings, but it does make working in the slime repl much more
pleasant.

13 years agolog another wishlist bug
Christophe Rhodes [Fri, 8 Oct 2010 11:03:05 +0000 (12:03 +0100)]
log another wishlist bug

This time about visibility of evaluation results.

13 years agoimprove html export of org files
Christophe Rhodes [Fri, 8 Oct 2010 11:01:30 +0000 (12:01 +0100)]
improve html export of org files

Allow ="foo"= to be exported as code.

13 years agowebup Makefile target
Christophe Rhodes [Fri, 8 Oct 2010 09:14:15 +0000 (10:14 +0100)]
webup Makefile target

for no better reason than my convenience

13 years agosrcrefs in swank:compile-string-for-emacs
Christophe Rhodes [Fri, 8 Oct 2010 09:12:38 +0000 (10:12 +0100)]
srcrefs in swank:compile-string-for-emacs

Wow, this was hard.  parse() constructs a vector with mode
"expression", consisting of multiple, possibly nested calls.
Scattered throughout this structure are srcrefs with absolute
locations.  This means that we need to walk the parsed data structure
and adjust every srcref that we can find, giving it an offset based on
the location information passed to compile-string-for-emacs (which
requires bleeding-edge 2010-10-08 slime, because earlier versions
don't pass line/column information in the position argument).

But we can't simply adjust the "srcref" attribute on our parsed data
structure, because R tries very hard to be pure.  Instead we need to
return a copy with the right modifications (but preserving everything
else of importance).  It's straightforward once you know how, but
there were many painful missteps to get to this point.  Still, now
M-. works on function names assigned with C-c C-c in source buffers.

13 years agoadd tags to bugs
Christophe Rhodes [Thu, 7 Oct 2010 22:16:01 +0000 (23:16 +0100)]
add tags to bugs

13 years agolog a bug in multibyte character handling
Christophe Rhodes [Thu, 7 Oct 2010 22:12:08 +0000 (23:12 +0100)]
log a bug in multibyte character handling

1:£ crashes the swank connection (and is fairly easy to mistype when
demoing)

13 years agobetter swank:find-definitions-for-emacs
Christophe Rhodes [Thu, 7 Oct 2010 22:11:16 +0000 (23:11 +0100)]
better swank:find-definitions-for-emacs

In particular, include enough of a kludge to be able to handle both
relative and absolute paths.

13 years agoless debugging output cruft in `swank:frame-locals-and-catch-tags`
Christophe Rhodes [Thu, 7 Oct 2010 22:09:59 +0000 (23:09 +0100)]
less debugging output cruft in `swank:frame-locals-and-catch-tags`

13 years agomore working `swank:compile-file-for-emacs`
Christophe Rhodes [Thu, 7 Oct 2010 22:09:09 +0000 (23:09 +0100)]
more working `swank:compile-file-for-emacs`

Firstly, only parse, don't source, as that seems to be the
protocol (the emacs side is responsible for requesting a load if
desired).  Secondly, the protocol is also to return a
compilation-result structure rather than just TRUE, so do that too.

13 years agolog issue with srcref in swank:compile-string-for-emacs
Christophe Rhodes [Fri, 1 Oct 2010 19:21:20 +0000 (20:21 +0100)]
log issue with srcref in swank:compile-string-for-emacs

13 years agoimplement swank:load-file and swank:compile-file-for-emacs
Christophe Rhodes [Fri, 1 Oct 2010 18:58:33 +0000 (19:58 +0100)]
implement swank:load-file and swank:compile-file-for-emacs

Easy, peasy.  The only trick here is to use parse() in the case that
compile-file-for-emacs is not being asked to load the `compiled' file.

13 years agoimplement swank:default-directory and swank:set-default-directory
Christophe Rhodes [Fri, 1 Oct 2010 18:56:26 +0000 (19:56 +0100)]
implement swank:default-directory and swank:set-default-directory

It was surprisingly hard to intuit getwd() and setwd(), what with
apropos("dir") and apropos("cwd") failing.  Nevertheless, they exist
and function, so use them for the interface (but not slimefun)
functions.

13 years agoconvenience Makefile for generating html from org files
Christophe Rhodes [Fri, 1 Oct 2010 18:20:07 +0000 (19:20 +0100)]
convenience Makefile for generating html from org files

13 years agocreate BUGS and TODO files
Christophe Rhodes [Fri, 1 Oct 2010 16:54:36 +0000 (17:54 +0100)]
create BUGS and TODO files

Link to them from README for webby goodness.  (Actually for webby
goodness I have to call them BUGS.org and TODO.org, *sigh*).

13 years agoupdate README for swank-media information
Christophe Rhodes [Fri, 1 Oct 2010 16:34:05 +0000 (17:34 +0100)]
update README for swank-media information

13 years agosort out printing functions
Christophe Rhodes [Fri, 1 Oct 2010 15:18:24 +0000 (16:18 +0100)]
sort out printing functions

R has capture.output as equivalent to with-output-to-string, so use it.

printToString, used by the slime-repl, now reverts back to calling
print.  New function prin1ToString, used by swank:interactive-eval and
swank:eval-and-grab-output, uses deparse.

13 years agoR implementation of the swank side of the (brand-new) slime-media contrib
Christophe Rhodes [Thu, 16 Sep 2010 20:01:25 +0000 (21:01 +0100)]
R implementation of the swank side of the (brand-new) slime-media contrib

Define a generic function to be used with the new
makeReplResultFunction hook, with an implementation using png files
for trellis objects.

13 years agonew makeReplResultFunction hook
Christophe Rhodes [Thu, 16 Sep 2010 19:59:46 +0000 (20:59 +0100)]
new makeReplResultFunction hook

default makeReplResult function doing the standard
(:write-string value :repl-result) thing for the REPL.

13 years agoimplement swank:eval-string-in-frame
Christophe Rhodes [Sun, 12 Sep 2010 17:06:26 +0000 (18:06 +0100)]
implement swank:eval-string-in-frame

Reified environments make quite a lot of this fairly easy...

13 years agoimplement swank:inspect-current-condition and swank:inspect-frame-var
Christophe Rhodes [Sun, 12 Sep 2010 16:40:48 +0000 (17:40 +0100)]
implement swank:inspect-current-condition and swank:inspect-frame-var

13 years agoimplement a default method for emacsInspect
Christophe Rhodes [Sun, 12 Sep 2010 16:40:25 +0000 (17:40 +0100)]
implement a default method for emacsInspect

Stands a chance of making the inspector not utterly annoying

13 years agoimplement swank:inspector-eval
Christophe Rhodes [Sat, 11 Sep 2010 09:58:10 +0000 (10:58 +0100)]
implement swank:inspector-eval

It took me quite some time to remember that parse returns a list of
expressions rather than just a single expression...

13 years agoimplement swank:inspector-pop and swank:inspector-next
Christophe Rhodes [Fri, 10 Sep 2010 21:53:44 +0000 (22:53 +0100)]
implement swank:inspector-pop and swank:inspector-next

Wow, nearly working.  There's some way of causing R to get into the
proper debugger; not sure how to reproduce it yet.

13 years agofix one multiple-string bug in the inspector
Christophe Rhodes [Thu, 9 Sep 2010 23:12:52 +0000 (00:12 +0100)]
fix one multiple-string bug in the inspector

13 years agoslightly more working inspector
Christophe Rhodes [Thu, 9 Sep 2010 22:28:11 +0000 (23:28 +0100)]
slightly more working inspector

Use an environment for istate rather than a list

implement swank:inspector-nth-part and swank:inspect-nth-part

13 years agoimplement `swank:quit-inspector`
Christophe Rhodes [Thu, 9 Sep 2010 15:31:17 +0000 (16:31 +0100)]
implement `swank:quit-inspector`

13 years agothe beginnings of an inspector
Christophe Rhodes [Thu, 9 Sep 2010 09:38:53 +0000 (10:38 +0100)]
the beginnings of an inspector

Implement enough that C-c I begins to work, at least for values like
list(1,2,3).  The resulting inspector on the emacs side apparently has
no features, and an error message results on quitting the inspector
because I've only implemented `swank:init-inspector`, and not
`swank:quit-inspector`.  Still, good enough to checkpoint.

13 years agoimplement withRetryRestart
Christophe Rhodes [Tue, 7 Sep 2010 07:38:19 +0000 (08:38 +0100)]
implement withRetryRestart

Use it in swank:interactive-eval and swank:eval-and-grab-output

13 years agoimplement withOutputToString
Christophe Rhodes [Tue, 7 Sep 2010 07:27:59 +0000 (08:27 +0100)]
implement withOutputToString

Possibly, anyway.  I think the semantics are right.  Use it in
printToString and in swank:eval-and-grab-output.

13 years agoswank:value-for-editing and swank:commit-edited-value
Christophe Rhodes [Fri, 3 Sep 2010 16:03:08 +0000 (17:03 +0100)]
swank:value-for-editing and swank:commit-edited-value

These are (in principle, at least) really, really easy.

13 years agoalternative printing for the REPL
Christophe Rhodes [Fri, 3 Sep 2010 07:10:09 +0000 (08:10 +0100)]
alternative printing for the REPL

instead of using print(), use str().  Also, be even more cautious
about cleaning up in printToString; previously, errors in printing
would lead to a sink to a closed fifo...

Printing is still not really right, and I forsee that we will end up
writing our own printer to get something more lispy.  But at least
this approach tends not to dump huge tables into the REPL.

13 years agointegrate into R's event loop, possibly
Christophe Rhodes [Fri, 3 Sep 2010 07:07:43 +0000 (08:07 +0100)]
integrate into R's event loop, possibly

in readPacket, call socketSelect() before actually trying to read on
the connection.  This seems to allow R to update graphics windows and
other such niceties.

It would be nice to be able to preserve the (inferior) R REPL as well,
but I haven't yet discovered whether that's possible.

13 years agoimplement swank:find-definitions-for-emacs
Christophe Rhodes [Wed, 1 Sep 2010 10:11:52 +0000 (11:11 +0100)]
implement swank:find-definitions-for-emacs

A simple implementation, only looking for a single function
definition (no methods, whether S3 or S4, or indeed anything else).
Enough to support M-., though.

13 years agouse srcfile$wd when going to source for an sldb frame
Christophe Rhodes [Wed, 1 Sep 2010 10:11:06 +0000 (11:11 +0100)]
use srcfile$wd when going to source for an sldb frame

it worked before while emacs and R were started with the same working
directory; this is not always going to be the case.

13 years agosupport swank:clear-repl-results in swank-presentations
Christophe Rhodes [Tue, 31 Aug 2010 08:02:14 +0000 (09:02 +0100)]
support swank:clear-repl-results in swank-presentations

This makes my worry about lacking weak hash tables a bit less
pressing.

13 years agoinitial implementation of support for REPL presentations
Christophe Rhodes [Tue, 31 Aug 2010 07:54:54 +0000 (08:54 +0100)]
initial implementation of support for REPL presentations

There's a lot here that's ugly, unfinished or just downright horrible.
Most notably, presentation support depends on swank-side read-time
evaluation (indicated with Common Lisp syntax, which hilariously is a
comment in R).  We can't support that in general, but we can
special-case the presentation-specific operator.

But then the next difficulty comes along; actually performing that
read-time evaluation needs to happen in a different environment than
the evaluation of the REPL form.  In order to achieve this, we abuse
bquote() the equivalent of Lisp's backquote facility, by calling what
in CL terms would be its macro-function on the parsed, preprocessed
expression; only after doing that (and hence resolving the `read-time'
evaluations) do we evaluate the call itself.

The implementation of presentation protocol messages is also slightly
ugly; having to implement cl:nth-value is particulraly horrible, but
the lack of weak references / weak tables in R (at least as far as I
can tell at the moment) is a cause of niggling concern.

13 years agoA proper implementation of swank:swank-require
Christophe Rhodes [Mon, 30 Aug 2010 20:45:48 +0000 (21:45 +0100)]
A proper implementation of swank:swank-require

We can do this nicely now that we have an evaluator of :emacs-rex
forms that can cope with quote.

13 years agoimplement a mini code-walker to support nested function calls in :emacs-rex
Christophe Rhodes [Mon, 30 Aug 2010 20:42:59 +0000 (21:42 +0100)]
implement a mini code-walker to support nested function calls in :emacs-rex

This is all a bit horrible, but probably limited in maintenance headaches.

13 years agomake swank:listener-eval be a bit more like the CL version
Christophe Rhodes [Mon, 30 Aug 2010 18:55:59 +0000 (19:55 +0100)]
make swank:listener-eval be a bit more like the CL version

don't return (:ok (:values "string")); instead, send a separate
(:write-string "string" :repl-result) and return (:ok ())

13 years agouse an environment holding the Slime I/O connection
Christophe Rhodes [Mon, 30 Aug 2010 09:03:42 +0000 (10:03 +0100)]
use an environment holding the Slime I/O connection

Rather than having a bare io argument everywhere, encapsulate it in an
environment.  (An environment is just about the only thing I can find
in R that isn't copy-on-write; this isn't helpful for the i/o
connection, but will be once we start implementing inspectors and
presentations...)

13 years agoslightly clarified the relationship to ESS
Christophe Rhodes [Sat, 28 Aug 2010 19:18:14 +0000 (20:18 +0100)]
slightly clarified the relationship to ESS

In particular, be careful not to overclaim.  Motivated by preparing to
announce to the ESS mailing list.

13 years agoadd README
Christophe Rhodes [Thu, 26 Aug 2010 10:39:18 +0000 (11:39 +0100)]
add README

13 years agoAdd licence information to swank.R
Christophe Rhodes [Thu, 26 Aug 2010 10:36:30 +0000 (11:36 +0100)]
Add licence information to swank.R

Same terms as R itself: GNU GPLv2 or later version

13 years agoimplement swank:frame-source-location
Christophe Rhodes [Wed, 25 Aug 2010 17:14:38 +0000 (18:14 +0100)]
implement swank:frame-source-location

Now v in the debugger mostly works.

13 years agofactor out backtraceForEmacs() into `swank:backtrace`
Christophe Rhodes [Wed, 25 Aug 2010 17:14:19 +0000 (18:14 +0100)]
factor out backtraceForEmacs() into `swank:backtrace`

write `swank:debugger-info-for-emacs` out, and hence delete
debuggerInfoForEmacs().

Now wandering past the --more-- prompt in sldb gives an infinite
sequence of NULLs, but at least it's not a cascade of errors any more.

13 years agoimplement swank:interactive-eval and swank:eval-and-grab-output
Christophe Rhodes [Wed, 25 Aug 2010 14:57:56 +0000 (15:57 +0100)]
implement swank:interactive-eval and swank:eval-and-grab-output

This allows C-c : and C-u C-c : to work, modulo the printing of an
unnecessary [1].  The evaluation semantics of R are not what a Lisper might
expect; printToString(eval(parse(...))) does not necessarily perform the
evaluation before altering the output stream with sink() -- so capturing
all sorts of incidental output if something goes wrong.

This commit brought to you using C-c C-c.

13 years agoensure that the fifo is closed in printToString()
Christophe Rhodes [Wed, 25 Aug 2010 14:55:41 +0000 (15:55 +0100)]
ensure that the fifo is closed in printToString()

Whoops.  Good to know that I can make the same basic stream mistakes
in any language.

13 years agoimplement swank:compile-string-for-emacs
Christophe Rhodes [Tue, 24 Aug 2010 17:06:48 +0000 (18:06 +0100)]
implement swank:compile-string-for-emacs

As long as my defun-prompt-regexp is set up right, I can now use C-c
C-c to develop swankr.  Go me.

13 years agoimplement swank:simple-completions
Christophe Rhodes [Fri, 20 Aug 2010 19:17:02 +0000 (20:17 +0100)]
implement swank:simple-completions

Probably fails as soon as slime and R disagree about what are token
constituents, or if an R token contains regexp metacharacters.

13 years agostub for swank:operator-arglist
Christophe Rhodes [Fri, 20 Aug 2010 19:16:00 +0000 (20:16 +0100)]
stub for swank:operator-arglist

13 years agoreturn properly from sldbLoop()
Christophe Rhodes [Thu, 19 Aug 2010 07:59:42 +0000 (08:59 +0100)]
return properly from sldbLoop()

Always emit a :debug-return message.  The extra :sldb-return stuff in
swank.lisp is (I think) only needed for multiple threads.

13 years agoput abort restarts around the main and sldb loops
Christophe Rhodes [Sun, 15 Aug 2010 15:46:13 +0000 (16:46 +0100)]
put abort restarts around the main and sldb loops

Also hide the abort restart imposed on us by the R interpreter itself,
which has the side-effect of aborting swank completely.

13 years agoThe beginnings of a vaguely-useful sldb
Christophe Rhodes [Sat, 14 Aug 2010 20:55:14 +0000 (21:55 +0100)]
The beginnings of a vaguely-useful sldb

Implement swank:frame-locals-and-catch-tags.  There are problems:

1. it seems that some names can be present in an environment but not have
   a value, causing eval to blow up;
2. the default printing routines aren't really adapted to the constraints
   of rendering in sldb;
3. trying to display locals of some of the swank frames (perhaps anything
   with a tryCatch or similar block?) causes R to complain about a promise
   already in the process of evaluation;
4. (probably) other things I haven't yet found

13 years agostore calls and frames on entry to sldb itself
Christophe Rhodes [Sat, 14 Aug 2010 20:12:20 +0000 (21:12 +0100)]
store calls and frames on entry to sldb itself

Rather than do complicated stuff to keep track of where we are in the
stack, simply store the interesting frames and calls in the sldb state
structure.

13 years agoimplement swank:buffer-first-change
Christophe Rhodes [Fri, 13 Aug 2010 16:24:02 +0000 (17:24 +0100)]
implement swank:buffer-first-change

Simply stub it in, to stop things whining at me when I type into the
wrong window and edit a Lisp file (which happens to be in slime
mode...)

13 years agoreturn stack frames in slime's order (most recent first)
Christophe Rhodes [Fri, 13 Aug 2010 16:10:16 +0000 (17:10 +0100)]
return stack frames in slime's order (most recent first)

13 years agoget definitions (use of <-) to work in the REPL
Christophe Rhodes [Fri, 13 Aug 2010 16:00:22 +0000 (17:00 +0100)]
get definitions (use of <-) to work in the REPL

the REPL now evaluates with envir=globalenv(), rather than in the
environment of `swank:listener-eval`...

13 years agosupport invoking restarts from sldb
Christophe Rhodes [Fri, 13 Aug 2010 15:03:51 +0000 (16:03 +0100)]
support invoking restarts from sldb

13 years agouse a restart description for restart printing, if available
Christophe Rhodes [Fri, 13 Aug 2010 14:22:58 +0000 (15:22 +0100)]
use a restart description for restart printing, if available

13 years agorework to support sldb
Christophe Rhodes [Fri, 13 Aug 2010 10:49:48 +0000 (11:49 +0100)]
rework to support sldb

R doesn't have much in the way of dynamic binding; you can fake it by
messing with environments, but that's not fun.

So instead, pass around the connection (`io') and an object
representing the SLDB state (`sldbState') to all functions.
Poor-man's explicit continuation-passing-style...

We need to call some of the mainLoop internal functions from elsewhere
now, so make them not-internal any more.

Fix ridiculous thinko in the logical branch of writeSexpToString

use simpleCondition rather than simpleError in swank:throw-to-toplevel

implement swank:debugger-info-for-emacs

Now `q' in sldb (sldb-quit) works.  Things that don't work:
1. the backtrace is the wrong way up.
2. calling any restarts
3. frame locals
4. returning from frames (dunno if R actually supports this)
5. zoom to source
6. probably other things

13 years agoimplement swank:throw-to-toplevel
Christophe Rhodes [Wed, 11 Aug 2010 14:58:47 +0000 (15:58 +0100)]
implement swank:throw-to-toplevel

13 years agoinclude swank.R hacks from today
Christophe Rhodes [Wed, 11 Aug 2010 14:02:47 +0000 (15:02 +0100)]
include swank.R hacks from today

We get far enough to start up a swank server in R and connect to it from
emacs; we get a REPL which formats the R-style results from parsing and
evaluating the input it receives.  Debugging, stepping, documentation,
arglist and so on is basically entirely missing.