[ESS] ess-eval-region ignore stata comments?

Vitalie Spinu spinuvit at gmail.com
Sun Aug 5 13:05:55 CEST 2012


Hi, 

This is solved in the development versions (both svn and git).

C-c C-c now skips the comments before evaluation, as it should be. C-c
C-r (ess-eval-region) now removes oneline comments (both "//" and "/*")
before sending code to process.

Please try and let me know if it works for you.

Best, 
Vitalie.

  >> Paul Burkander <paul at burkander.com>
  >> on Fri, 3 Aug 2012 16:13:25 -0400 wrote:

  > Stata supports multi-line comments, as in your first example, but I
  > habitually don't use them; my code follows your second example.  For
  > me and my lack of lisp it's not so simple to pass a line over.  Can
  > you suggest a quick fix?

  > I didn't know about C-c C-c - by the function name it looks useful,
  > but I get the following error:
  > ess-beginning-of-function: Wrong type argument: stringp, nil [2 times]

  > On Fri, Aug 3, 2012 at 3:59 PM, Vitalie Spinu <spinuvit at gmail.com> wrote:
  >> 
  >> >> Paul Burkander <paul at burkander.com>
  >> >> on Fri, 3 Aug 2012 12:20:04 -0400 wrote:
  >> 
  >> > Is there a way to make ess-eval-region ignore stata comments?
  >> > If I have the following code as my region:
  >> 
  >> > /* foo */
  >> > di "bar"
  >> 
  >> > I get
  >> > . /* foo */
  >> > unrecognized command:  / invalid command name
  >> > r(199);
  >> 
  >> > .
  >> > . di "bar"
  >> > bar
  >> 
  >> 
  >> 
  >> But C-c C-c skips comments right? This should be the default.
  >> 
  >> With ess-eval-region is a bit trickier. It's pretty easy to remove one
  >> liner, but considerably much more difficult to get rid of multiline
  >> comments.
  >> 
  >> Does stata support multilne comments? That is,  doe you need
  >> 
  >> 
  >> /* foo
  >> zoo
  >> */
  >> 
  >> di "bar"
  >> 
  >> 
  >> or, just handling
  >> 
  >> 
  >> /* foo */
  >> /* zoo */
  >> 
  >> di "bar"
  >> 
  >> would be enough?
  >> 
  >> Vitalie.
  >> 
  >> > Which isn't terrible, since it at least gets to the display command.
  >> > However, if the comment is in a loop, it breaks the loop.  Is there
  >> > any way to make ESS skip the commented line?
  >> 
  >> > Thanks!
  >> 
  >> > ______________________________________________
  >> > ESS-help at r-project.org mailing list
  >> > https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list