<<I'm adding ess-help to the addressees because apparently this needs to be
solved in ESS, not in R.>>

Thanks!  So I guess you're suggesting something like

(add-hook 'comint-output-filter-functions
      (lambda (s)
        (save-restriction
          (narrow-to-region comint-last-output-start
                (+ -1 (process-mark (get-buffer-process (current-buffer)))))
                ;; stop one char before the end of the output region to
avoid
                ;; deleting the space after the R prompt
          (delete-trailing-whitespace))))

I have almost succeeded in making this work right. But if it is called for
an output chunk which isn't the last one (with the prompt), it can suppress
spaces in the middle of the line.  Test with

      for (i in 1:1000) print("
                                                  ")

for example. Any ideas? This is the sort of niggling little edge-case
complication which made me hope that someone had already solved the problem
in R or ESS....

                -s

On Wed, Nov 11, 2009 at 8:43 PM, RICHARD M. HEIBERGER <r...@temple.edu>wrote:

> On Wed, Nov 11, 2009 at 8:12 PM, Stavros Macrakis <macra...@alum.mit.edu>
> wrote:
> > Thanks for the suggestion. I'mm familiar with the truncate-lines
> variable,
> > but that's not quite what I was looking for.  I don't want the padding
> > spaces displayed, but I do want to see long strings at the end of the
> line.
>
> Then we can use a different emacs trick.
>
> delete-trailing-whitespace    M-x ... RET
>  Command: Delete all the trailing whitespace across the current buffer.
> ess-nuke-trailing-whitespace  M-x ... RET
>  Command: Nuke all trailing whitespace in the buffer.
> whitespace-toggle-trailing-check M-x ... RET
>  Command: Toggle the check for trailing space in the local buffer.
>
> Rich
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to