[ESS-bugs] ess-mode 5.3.0; comint-prompt-regexp follow-up

Martin Maechler maechler at stat.math.ethz.ch
Mon Dec 10 16:30:05 CET 2007


>>>>> "t" == tyler  <tyler.smith at mail.mcgill.ca>
>>>>>     on Mon, 10 Dec 2007 14:02:59 -0400 writes:

    t> This is a follow up to a previous message. Since I can't
    t> subscribe to the mailing list, there appears to be no way
    t> of replying to a particular message.

well, you could (and should) have replied to Tony's answer which *was* CC'ed
to you...

    t> I don't know how Emacs communicates with inferior
    t> processes, so I don't know how to implement the changes
    t> that were suggested by Tony Rossini. However, I read
    t> through the info files regarding debug and browser
    t> commands in ESS, and it appears that comint-prompt-regexp
    t> needs to match lines like:

    t> Browser[1]>

In R, that's   "Browse[1]> "  but that's not important

The really important thing I have found out in the mean time
(since my last e-mail on this, less than an hour ago):
When you are inside the debugger i.e., browser,
the "prompt" option is *not* modified,
and hence the whole idea of Tony --- which I've finished
implementing in the mean time --- of looking up
options("prompt") and options("continue") dynamically,
breaks down as soon as you are debug()ging a function, something
I (and Kurt, I assume) do quite frequently.

==> Indeed,
  1) "Browse[1]> " needs to be matched by the regexp
  2) it cannot be determined via options("prompt")

Hence I think we have to "bury"  Tony's proposal
and go with (a version of) Tyler's proposed amendment below.

One alternative might be to
add "Browse\[[0-9]+\]" explicitly to the options("prompt")
result, but I think that's a kludge we'd not really prefer...

What do you think, Tony?

    t> as well as the usual:
    >> 
    t> +

    t> The current value of comint-regexp-prompt generated for R
    t> processes will match all of these, but as designed will
    t> also match:

    t> Browser[1]Browser[1]Browser[1]>


    t> Is this necessary? If not, changing comint-regexp-prompt to

    t> "^\\(\\([A-Z][][A-Za-z0-9.]*\\)?> \\|+ ?\\)"
    t>                                ^ 
    t> Will match all three possible expressions, and doesn't hang on long
    t> output. If duplicated prefix strings do occur, perhaps the search
    t> could be limited with a \{0,N\} construct in place of the first ?, with
    t> N set to some reasonable upper limit.

That's a good suggestion.  What do others think?

    t> I don't know if it makes any differences to the efficiency of the
    t> regexp, but as far as I can tell the outermost grouping is not used,
    t> so the regexp could be reduced to

    t> "^\\([A-Z][][A-Za-z0-9.]*\\)?> \\|+ ?"

Are you sure?  Would this really match "^+ ?" as well ?
I'd rather keep that part just for clarity.


    t> The relevant line in the source code is L79 of essd-r.el:
    t> (inferior-ess-primary-prompt	. "\\([A-Z][][A-Za-z0-9.]*\\)*> ")

    t> Please let me know if this is helpful. I enjoy working with regexps,
    t> and I'm eager to learn more elisp, so if I'm pointed in the right
    t> direction I'm happy to contribute.

Thanks;
you *have* already contributed.


ESS-core,  what about  letting  Tyler subscribe to ESS-bugs
(which has been a closed list, open to ESS-core only till now),
so he could contribute even more ?

Martin


    t> Thanks,

    t> Tyler
     
    t> Emacs  : GNU Emacs 22.1.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
    t> of 2007-11-03 on pacem, modified by Debian
    t> Package: ess-mode 5.3.0

    t> current state:
    t> ==============
    t> (setq
    t> ess-language "S"
    t> ess-dialect "R"
    t> ess-ask-for-ess-directory t
    t> ess-ask-about-transfile nil
    t> ess-directory nil
    t> ess-keep-dump-files "always"
    t> ess-source-directory "/tmp/"
    t> )
    t> [ess-site.el]: ess-customize-alist=nil 
    t> [ess-site.el _2_]: ess-customize-alist=nil 
    t> (S): ess-s-versions-create making M-x defuns for (R): ess-r-versions-create making M-x defuns for [ess-site.el]: ess-customize-alist=nil 
    t> [ess-site.el _2_]: ess-customize-alist=nil 
    t> (S): ess-s-versions-create making M-x defuns for (R): ess-r-versions-create making M-x defuns for 
    t> (R): ess-dialect=nil, buf=*scratch*, start-arg=nil
    t> current-prefix-arg=nil
    t> (inferior-ess 0): ess-start-args=--no-readline   
    t> ess-setq-vars-default 0: ess-language=Initial, -dialect=nil, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
    t> ess-setq-vars-default 1: ess-language=S, -dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
    t> (inf-ess 1): lang=S, dialect=R, tmp-dialect=R, buf=*scratch*
    t> (inf-ess 1.1): procname=R temp-dialect=R, buf-name=*R* 
    t> (inferior-ess) Method #3 start=/home/tyler/rworkingdirectory/ buf=*R*
    t> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=nil, comint..sender=comint-simple-send
    t> (inf-ess 2.1): ess-language=S, ess-dialect=R buf=*R* 
    t> (inf-ess 2.2): start args = --no-readline  , inf-ess-start-args=--no-readline   
    t> (inf-ess finish [S(R), R(nil,nil)]
    t> (ess-multi 0):  inf-ess-start-args=--no-readline  , comint-..echoes=nil
    t> (i-ess 1): buf=*R*, lang=S, comint..echo=nil, comint..sender=comint-simple-send,
    t> (i-ess 2): buf=*R*, lang=S, comint..echo=t, comint..sender=inferior-R-input-sender,
    t> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t, comint..sender=inferior-R-input-sender
    t> (i-ess 3): curr-buf=*R*, comint..echo=t, comint..sender=inferior-R-input-sender,
    t> (ess-multi post inf-ess: start-args=--no-readline  , comint-echoes=t
    t> (ess-multi 1):  start-args=--no-readline   
    t> Making Process...Buf *R*, Proc R, Prog R
    t> Start File=nil, Args= --no-readline  .
    t> (R): inferior-ess-language-start=options(STERM='iESS', editor='emacsclient')

    t> _______________________________________________
    t> ESS-bugs ESS-bugs at stat.math.ethz.ch
    t> https://stat.ethz.ch/mailman/listinfo/ess-bugs

    t> _______________________________________________
    t> ESS-core list: https://stat.ethz.ch/mailman/listinfo/ess-core



More information about the ESS-bugs mailing list