Hello, I found myself always complaining about the lack of auto-completion feature for data.frame columns. I decided try my hand at writing a backend that seems to be working, so I thought of sharing it on the mailing list.
It is just a small hack that mainly relies on the ess--get-cached-completions function. Hope this helps, Jeremie ;;; usage (require 'company-df-backend) (setq ess-r-company-backends '((company-R-library company-R-args company-df-backend company-R-objects company-files company-yasnippet :separate))) ; file company-df-backend.el (defun data-frame () "Returns the name of the current data frame in use. If no data.frame is begin written returns nil" (interactive) (format "%S" (data--frame))) (defun data--frame () "Returns thw sexp at point of the current data frame in use. If no data.frame is begin written returns nil wrap with message to test." (interactive) (save-excursion (progn (re-search-forward ".*\\[" nil t -1) (backward-char) (sexp-at-point)))) (defun sample-fuzzy-match (prefix candidate ) (interactive) (cl-subsetp (string-to-list prefix) (string-to-list candidate))) (defun fuzzy-match-list1 (arg dt) "Filter candidate. ARG the symbol at point. DT the name of the data.frame." (interactive) (cl-remove-if-not (lambda (c) (sample-fuzzy-match arg c)) (let ((proc (ess-get-next-available-process))) (when proc (with-current-buffer (process-buffer proc) (mapcar (lambda (x) (replace-regexp-in-string ".*\ \$" "" x)) (ess--get-cached-completions (concat dt "$" arg)))))))) (defun company-df-backend (command &optional arg &rest ignored) (interactive (list 'interactive)) (cl-case command (interactive (company-begin-backend 'company-df-backend)) (prefix (company-grab-symbol)) (candidates (fuzzy-match-list1 arg (data-frame))) (annotation " <data.frame>"))) (provide 'company-df-backend) ______________________________________________ ESSfirstname.lastname@example.org mailing list https://stat.ethz.ch/mailman/listinfo/ess-help