[ESS] Problem with ess tab-completion when max.print option is set too low

James W. MacDonald jmacdon at med.umich.edu
Fri Mar 7 21:13:45 CET 2008


Not sure if this is on point, but I have the following in my .emacs, 
that I got from Deepayan Sarkar (needs to be slightly modified now that 
utils swallowed rcompgen if you are using R-2.7.0):

;; use rcompgen in ESS

(defun alt-ess-complete-object-name ()

   (interactive)
   (ess-make-buffer-current)
   (let* ((comint-completion-addsuffix nil)
          (beg-of-line (save-excursion (comint-bol) (point)))
          (end-of-line (point-at-eol))
          (line-buffer (buffer-substring beg-of-line end-of-line))
          (token-string ;; setup, including computation of the token
           (progn
             (ess-command (format
"rcompgen:::.assignLinebuffer('%s')\n" line-buffer))
             (ess-command (format "rcompgen:::.assignEnd(%d)\n" (-
(point) beg-of-line)))
             (car (ess-get-words-from-vector
"rcompgen:::.guessTokenFromLine()\n"))))
          (possible-completions ;; compute and retrieve possible completions
           (progn
             (ess-command "rcompgen:::.completeToken()\n")
             (ess-get-words-from-vector 
"rcompgen:::.retrieveCompletions()\n"))))
     (or (comint-dynamic-simple-complete token-string
possible-completions) 'none)))


(define-key inferior-ess-mode-map "\t" 'alt-ess-complete-object-name)

And I get tab completion for uniq<TAB> with options(max.print = 1000) in 
my .Rprofile

Best,

Jim



Stephen Eglen wrote:
>  > 
>  > This took me a bit to track down.  In my ESS process buffer, sometimes 
>  > tab-completion was not working on certain functions (noticed it with 
>  > unique), yet was working with other functions in the base package.
>  > 
>  > In my .Rprofile, I have set some options, including:
>  > 
>  > options(max.print = 1000) ## default is 99999
>  > 
>  > This is what seems to cause the behavior.  If I have max.print set to 
>  > 1000 and start R through ESS, and then type uniq<TAB>, it will not find 
>  > any completions for unique. ("No completions for uniq" is displayed in 
>  > minibuffer.)
>  > 
>  > When I remove that option, uniq<TAB> does what I expect.
> 
> thanks for this report, I can confirm this behaviour.  (uni<TAB> also
> shows a nice difference -- with max.print set to 1000, completion
> suggests just 'uniroot').
> 
> I'm not sure what the solution here -- one option might be for us to
> temporarily ensure max.print is set high enough when completing, but
> that might have unknown side effects.  
> 
> If we switched our completion mechanism to use rcompgen would that
> help?
> 
> Stephen
> 
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

-- 
James W. MacDonald, M.S.
Biostatistician
Affymetrix and cDNA Microarray Core
University of Michigan Cancer Center
1500 E. Medical Center Drive
7410 CCGC
Ann Arbor MI 48109
734-647-5623




More information about the ESS-help mailing list