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

Martin Maechler maechler at stat.math.ethz.ch
Mon Dec 10 18:48:15 CET 2007


replying to myself ....


>>>>> "MM" == Martin Maechler <maechler at stat.math.ethz.ch>
>>>>>     on Mon, 10 Dec 2007 16:30:05 +0100 writes:

>>>>> "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.

    MM> well, you could (and should) have replied to Tony's answer which *was* CC'ed
    MM> 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]>

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

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

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

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

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

    MM> What do you think, Tony?

Actually, I'm less sure now and have wanted to preserve 
Tony's idea to use options("prompt").

I've added a regexp to explicitly match   "Browse[<n>]> "
but otherwise using  options("prompt") and options("continue")
and even added re-evaluation of these, at some occasions.

The goal would be that that user changes like

   options(prompt = "myR# ")

or even

   options(prompt = "myNew(@*&)$Prompt||")

should work which they have never before.

Unfortunately, I'm currently fighting with an infite loop
problem when the  'prompt' has been changed and the regexp is
out of sync,
Becuse of the wrong prompt,
I can no longer use (ess-commmand ..) to enquire about the
prompt..

Hmm,..  more later
Martin




    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.

    MM> 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.]*\\)?> \\|+ ?"

    MM> Are you sure?  Would this really match "^+ ?" as well ?
    MM> 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.

    MM> Thanks;
    MM> you *have* already contributed.


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

    MM> 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

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

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



More information about the ESS-bugs mailing list