[ESS] Adjustment to C-c C-p behavior

Martin Maechler maechler at stat.math.ethz.ch
Thu Dec 7 12:32:46 CET 2006


>>>>> "António" == António Ferreira <asfe at di.fc.ul.pt>
>>>>>     on Tue, 05 Dec 2006 20:21:29 +0000 writes:

    António> Hello, I changed the behavior of
    António> ess-eval-paragraph-and-step (bound to C-c C-p) to
    António> be consistent with ess-eval-line-and-step (C-c
    António> C-n).

Hmm, something like the following somewhere in your ~/.emacs
or site-init/default.el or ... file
is rather recommended.

We cannot build it into our own startup file "ess-site.el",
since 'comint' is used in many other places than just ESS,
and ESS is not allowed to overwrite global comint settings :

 (eval-after-load
   "comint"
   '(progn
      (setq comint-scroll-to-bottom-on-output 'others) ; not current
      ;;=default: (setq comint-scroll-to-bottom-on-input nil)
      (setq comint-scroll-show-maximum-output t) ;;; this is the key
      (define-key comint-mode-map [up]
        'comint-previous-matching-input-from-input)
      (define-key comint-mode-map [down]
        'comint-next-matching-input-from-input)

      (define-key comint-mode-map "\C-a" 'comint-bol)
      )
   )

I think this should also solve your problem that *R* is "not
showing the latest output".
Can you please try that?

Note that there are two kinds of "ess-eval-*" functions;

1) a big part all are based on  (ess-eval-region ...)
   and maybe "-step" or "-go".

   ess-eval-paragraph belongs to these

2) a few others are based on ess-eval-linewise
   which is different (and I think not efficient for larger chunks)

For this reason, I think your patch is not acceptable as such,
but we might thinking about having something different with the
same functionality;
however first see below


    António> While debugging a R source file I noticed that I
    António> had to use C-c C-n several times on multi-line
    António> expressions (i.e., paragraphs), to continuously see
    António> the evaluation outcome on the *R* buffer. Naturally
    António> I also tried C-c C-p, but its behavior had a subtle
    António> difference: the cursor on the *R* buffer didn't
    António> stay at the end of the buffer, thereby forcing me
    António> to manually scroll down to see the latest
    António> evaluation results.

    António> To change the behavior of the C-c C-p, so that the
    António> *R* buffer continuously shows the latest evaluation
    António> outcome, I edited the file 'ess-inf.el' that comes
    António> with ESS 5.3.3:


[...............]

    António> ;; New code

    António> (defun ess-eval-paragraph-and-step (vis)
    António> "Send the current paragraph to the inferior ESS process and
    António> move forward to the next paragraph.
    António> Arg has same meaning as for `ess-eval-region'."
    António> (interactive "P")
    António> (let ((beg-end (ess-eval-paragraph vis)))
    António> (goto-char (1+ (cadr beg-end)))
    António> ;; Added by ASFE, December 4, 2006
    António> (ess-eval-linewise "" nil 'eob))
    António> )

this mixes the ess-eval-region and ess-eval-linewise approaches,
something we have been careful to avoid.



    António> I've been using the patched 'ess-inf.el' since yesterday and haven't 
    António> noticed any unusual side effects.

    António> Cheers,
    António> António Ferreira

    António> ______________________________________________
    António> ESS-help at stat.math.ethz.ch mailing list
    António> https://stat.ethz.ch/mailman/listinfo/ess-help




    António> ;; New code

    António> (defun ess-eval-paragraph-and-step (vis) "Send the
    António> current paragraph to the inferior ESS process and
    António> move forward to the next paragraph.  Arg has same
    António> meaning as for `ess-eval-region'."  (interactive
    António> "P") (let ((beg-end (ess-eval-paragraph vis)))
    António> (goto-char (1+ (cadr beg-end))) ;; Added by ASFE,
    António> December 4, 2006 (ess-eval-linewise "" nil 'eob)) )

    António> I've been using the patched 'ess-inf.el' since
    António> yesterday and haven't noticed any unusual side
    António> effects.

    António> Cheers, António Ferreira

    António> ______________________________________________
    António> ESS-help at stat.math.ethz.ch mailing list
    António> https://stat.ethz.ch/mailman/listinfo/ess-help




More information about the ESS-help mailing list