[ESS-bugs] ess-r-args-auto-show: amend doc string

David Reitter david.reitter at gmail.com
Wed Apr 29 23:25:30 CEST 2009


On Apr 29, 2009, at 5:20 PM, Hendrik Weisser wrote:
> Since "skeleton-pair-insert-maybe" is basically broken in its  
> interplay with other functions, I'd suggest removing the call to it  
> from "ess-r-args-auto-show".

If something needs to be bound to (, an (insert "(") can always be  
added there.


For what it's worth, here is the code I've written to give behavior in  
ESS similar to that of SLIME, which shows the arglist whenever the  
point is moved to a suitable place.
Note that I had to change (error (message "bla")) into (error "bla")  
in ess-r-args-current-function; I think it might be a bugfix, but  
folks here are in  a better position to tell.



(defvar ess-arglist-show-timer nil)
(progn
   (if ess-arglist-show-timer
       (cancel-timer ess-arglist-show-timer))
   (setq ess-arglist-show-timer
	(run-with-idle-timer 0.2 t
			     (defun ess-maybe-show-arg-list ()
			       (interactive)
			       (and (eq major-mode 'ess-mode)
				    (or (not (current-message))
					(and (equal ess-r-args-show-as 'tooltip)
					     ess-has-tooltip))
				    ;; to do check tooltip
				    (condition-case nil
					(ess-r-args-show)
				      ;; avoid showing error if not over function
				      (error nil)))))))

(defun ess-r-args-current-function ()
   "Returns the name of the R function assuming point is currently
within the argument list or nil if no possible function name is
found."
   (save-excursion
     (condition-case nil (up-list -1)
       (error "Can't find opening parenthesis."))
     (let ((posend (point)))
       (backward-sexp 1)
       (let ((rfunname (buffer-substring-no-properties posend (point))))
	(if (posix-string-match "^[a-zA-Z0-9_\.]+$" rfunname)
	    rfunname nil)))))



More information about the ESS-bugs mailing list