[ESS] completion in R files

Rainer M Krug r.m.krug at gmail.com
Fri Mar 22 12:00:26 CET 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 22/03/13 11:27, Vitalie Spinu wrote:
> 
> Hi,
> 
> It is not clear what you mean by "not working". Many times everything is working but not in
> the "standard" way that users expect. Can you elaborate on all 3 points below and tell us what
> you do, and what you expect.

Actually, I seem to have a tendency for not being clear - sorry about that.

Point 1) and 3): working if I call the function ess-complete-object-name,
but not activated by pressing TAB  - will come back to this below.

Point 2): nothing happens when pressing TAB - what is the function which
should be called for completion?

> 
> My bet is that the issue is the TAB key. TAB key does *not* complete by default. It is emacs' 
> convention that M-TAB (aka C-M-i) completes at point. TAB is for indentation.

OK - this explains. I might have been used to simple TAB for
completion. C-M-i is working, but M-TAB not.

> 
> ESS has a flexible support for TAB completion in script buffers. See
> ess-tab-complete-in-script and ess-first-tab-never-complete for how to activate the completion
> and configure TAB behavior to your needs.
> 
> We actually had it activated for a short while, but quickly reverted to current behavior 
> because it turned to be somewhat aggressive for many people's taste.

I now added

 (setq  ess-tab-complete-in-script t)

and I have the auto-complete as I expect on TAB - but still M-TAB is not
working - and I found out why: My window manager (awesome) was catching
Alt-TAB. I changed it and now it is working M-TAB is working again!

Thanks for that - helped me a lot.

> 
> Se also auto-complete integration: http://www.emacswiki.org/emacs/ESSAuto-complete

Looks interesting - I will look into it.

Actually, if users are used to use TAB for autocomplete (as it is thae
case in most other editors) instead of M-TAB, this mioght explain why
this question comes up again and again?

Thanks a lot Vitalie,

you helped me solve a problem which was annoying me for quite some time
now - but as I did not use R that much, I could live with it.

Cheers,

Rainer


> 
> HTH, Vitalie
> 
> PS: Andreas feel free to follow this to OP on R mailing list.
> 
>>> Rainer M Krug <r.m.krug at gmail.com> on Fri, 22 Mar 2013 10:41:53 +0100 wrote:
> 
>> On 22/03/13 10:16, Andreas Leha wrote:
>>> Hi all,
>>> 
>>> the possibility to get completion in R files seems not be unknown to many people in the R 
>>> community.
>>> 
>>> Maybe someone more knowledgeable than me should respond to this thread 
>>> (http://permalink.gmane.org/gmane.comp.lang.r.devel/33103) on the R-devel mailing list and
>>>  explain since when completion in R buffers is available and how to activate it.
> 
>> I would like to piggyback on this question:
> 
>> 1) Is there a way of getting completion with function names and
> 
>> 2) path completion is not working for me in my setup - might it be an interaction with org / 
>> ido completion?
> 
>> 3) actually, object completion is also not working...
> 
>> The inferior R process is running, and I get tooltips in the minibuffer.
> 
>> Below please find the ESS section of my emacs.org file
> 
>> Any suggestions welcome,
> 
>> Rainer
> 
>> * ESS ** Load ess #+begin_src emacs-lisp (add-to-list 'load-path "~/.emacs.d/ess/lisp") ;; 
>> (load "~/.emacs.d/ess/lisp/ess-site") (require 'ess-site) #+end_src
> 
>> ** ESS help *** kill "bogus" help buffers #+begin_src emacs-lisp (setq 
>> ess-help-kill-bogus-buffers t) #+end_src
> 
>> *** all help in one window and in own frame #+begin_src emacs-lisp (setq ess-help-own-frame 
>> 'one) #+end_src
> 
>> ** activate tracebug #+BEGIN_SRC emacs-lisp (setq ess-tracebug-prefix "\M-t") (setq 
>> ess-use-tracebug t) #+END_SRC
> 
>> ** Further customisations #+begin_src emacs-lisp (setq inferior-R-args "--vanilla") (setq 
>> ess-eval-visibly-p nil) (setq inferior-ess-same-window t) (setq inferior-ess-client-command 
>> "Initial") (setq inferior-ess-own-frame nil) (setq ess-ask-for-ess-directory "TRUE") 
>> #+end_src ** hideshow hideshow-org 
>> (http://github.com/secelis/hideshow-org/tree/master)#+begin_src emacs-lisp ;;(require 
>> 'hideshow) (require 'hideshow-org) (add-to-list 'hs-special-modes-alist '(ess-mode "{" "}" 
>> "/[*/]" nil hs-c-like-adjust-block-beginning)) (global-set-key "\C-ch" 'hs-org/minor-mode)
>> ;; toggles hideshow-org (add-hook 'ess-mode-hook 'hs-org/minor-mode) ;; starts for ESS files
>> ;; (add-hook 'ess-mode-hook '(lambda () (hs-org/minor-mode 1))) #+end_src
> 
>> ** Additional syntax highlighting #+begin_src emacs-lisp (add-hook 'ess-mode-hook '(lambda()
>>  (font-lock-add-keywords nil '(
> 
>> ("\\<\\(FIXME\\|TODO\\|COMMENT\\|DONE\\|CHANGES\\|FIXED\\)\\>" 1 font-lock-warning-face 
>> prepend) ; highlight certain keywords
> 
>> ("\\<\\(if\\|for\\|function\\|return\\)\\>[\n[:blank:]]*(" 1 font-lock-keyword-face) ; must 
>> go first to override highlighting below ("\\<\\([.A-Za-z][._A-Za-z0-9]*\\)[\n[:blank:]]*(" 1
>>  font-lock-function-name-face) ; highlight function names
> 
>> ("\\([(,]\\|[\n[:blank:]]*\\)\\([.A-Za-z][._A-Za-z0-9]*\\)[\n[:blank:]]*=[^=]" 2 
>> font-lock-reference-face) ; highlight argument names )) )) #+end_src
> 
>>> 
>>> Regards, Andreas
>>> 
>>> ______________________________________________ ESS-help at r-project.org mailing list 
>>> https://stat.ethz.ch/mailman/listinfo/ess-help>
> 


- -- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys.
(Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer at krugs.de

Skype:      RMkrug
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRTDnKAAoJENvXNx4PUvmCBAcH/A0S6NxP0lSiD+pkmkzKhKuv
N/2+KoD57y2aNp57jxRTychXE10FiEQ3Lc4sGlDCQHLnzlgyHlU+7fC2PnG7+jft
35qeyb2pM+cHM73nxNTgWTcZnEiHA4Iw605vYInJQw8i5rW4yz4P2jYFHAzFDJAc
+lnqLFgYpwVGJDhb5q2TpA7nH0EvKQ3RloX9VxyHt5JjgFIk6AC8bmrG46ECPxSY
YPREsVUnuF4Wqpoi8dNNgyWem1p+TFO/PrEEtxnFiLzsGULm1+VBPkP5j6MwUCAn
kmvV+uGdueoIzgHmn/6t/o9NSwho3/EM8zRENnrA7kkYgXokgkO+OHURvnnPbbI=
=whFT
-----END PGP SIGNATURE-----



More information about the ESS-help mailing list