[ESS] ess completion

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Thu Jun 12 14:49:15 CEST 2008

Dear Steve,
copying this to ess-help.

The trace you've sent suggests that XEmacs is complaining that
comint-bol has not been given any arguments (the arg is optional in
Emacs).  I do not have XEmacs here; please can you send me the output of
"C-h f comint-bol" so that I can check.  Either that or please put the
following in your .emacs (after the place where ESS has been loaded) and
try again.

(defun ess-R-complete-object-name ()
  "Completion in R via R's completion utilities (formerly 'rcompgen').
To be used instead of ESS' completion engine for R versions >= 2.5.0
 (or slightly older versions of R with an attached and working
  'rcompgen' package)."
  (let* ((comint-completion-addsuffix nil)
	 (beg-of-line (save-excursion (comint-bol nil) (point)))
	 (end-of-line (point-at-eol))
	 (line-buffer (buffer-substring beg-of-line end-of-line))
	 (NS (if (ess-current-R-at-least '2.7.0)
	 (token-string ;; setup, including computation of the token
	     (format (concat NS ".assignLinebuffer('%s')\n") line-buffer))
	    (ess-command (format (concat NS ".assignEnd(%d)\n")
				 (- (point) beg-of-line)))
	    (car (ess-get-words-from-vector
		  (concat NS ".guessTokenFromLine()\n")))))

	 (possible-completions ;; compute and retrieve possible completions
	    (ess-command (concat NS ".completeToken()\n"))
	     (concat NS ".retrieveCompletions()\n")))))

    (or (comint-dynamic-simple-complete token-string

(Please also tell us what R version and what you typed in *R* to get the

Thanks, Stephen

Steve Goldstein <sgoldstein at wisc.edu> wrote:

> Hello Stephen,
> In reply to the Nabble ess-help thread about completion...
> When I attempt to complete an R object by hitting TAB, I encounter an
> error.  File completion works.
> I am using ess-5.3.7 on linux.
> Thanks,
> Steve Goldstein
> ===================================================
> Backtrace:
> Debugger entered--Lisp error: (wrong-number-of-arguments comint-bol 0)
>  comint-bol()
>  (save-excursion (comint-bol) (point))
>  (let* ((comint-completion-addsuffix nil) (beg-of-line ...)
> (end-of-line ...) (line-buffer ...) (NS ...) (token-string ...)
> (possible-completions ...)) (or (comint-dynamic-simple-complete
> token-string possible-completions) (quote none)))
>  ess-R-complete-object-name()
>  (if ess-use-R-completion (ess-R-complete-object-name)
> (ess-internal-complete-object-name listcomp))
>  ess-complete-object-name()
>  run-hook-with-args-until-success(ess-complete-object-name)
>  #<compiled-function nil "...(4)" [run-hook-with-args-until-success
> comint-dynamic-complete-functions] 2
> ("/usr/share/xemacs/xemacs-packages/lisp/xemacs-base/comint.elc"
> . 52969) nil>()
>  call-interactively(comint-dynamic-complete)

More information about the ESS-help mailing list