Skip to content

Commit

Permalink
Fix ess-r-args-get
Browse files Browse the repository at this point in the history
  • Loading branch information
vspinu committed Feb 8, 2016
1 parent 6160163 commit 9ef5487
Showing 1 changed file with 6 additions and 27 deletions.
33 changes: 6 additions & 27 deletions lisp/ess-r-args.el
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ found."
(defun ess-r-args-get (&optional function trim)
"Returns string of arguments and their default values of R
function FUNCTION or nil if no possible function name
found. Calls ess-r-args-current-function if no argument given.
found. Calls `ess-r-args-current-function' if no argument given.
If TRIM is non-nill remove tabs and newlines and replace ' = '
with '=' (useful for display in minibuffer to avoid window and
buffer readjustments for multiline string)."
Expand All @@ -215,31 +215,9 @@ buffer readjustments for multiline string)."
(interactive-p)))
(ess-force-buffer-current "R process to use: ")
;; ^^^^^^^^^^^^^^^ has own error handler
(cadr (ess-function-arguments function))
))

;; (let ((ess-nuke-trailing-whitespace-p t)
;; (args))
;; (ess-command (format "try({fun<-\"%s\"; fundef<-paste(fun, '.default',sep='')
;; if(exists(fundef, mode = \"function\")) args(fundef) else args(fun)}, silent=F)\n" function)
;; (get-buffer-create "*ess-r-args-tmp*"))
;; (with-current-buffer "*ess-r-args-tmp*"
;; (goto-char (point-min))
;; (if (null (search-forward "function" 20 t))
;; (message ess-r-args-noargsmsg)
;; (goto-char (point-min))
;; (search-forward "(" nil t)
;; (delete-region (point-min) (point))
;; (goto-char (point-max))
;; (search-backward ")" nil t)
;; (delete-region (point) (point-max))
;; (ess-nuke-trailing-whitespace); should also work in Xemacs
;; (setq args (buffer-string))
;; (if trim
;; (replace-regexp-in-string " = " "="
;; (replace-regexp-in-string "[\n \t]+" " " args))
;; args)
;; )))))
(mapconcat (lambda (arg) (concat (car arg) "=" (cdr arg)))
(cadr (ess-function-arguments function))
", ")))

(defun ess-r-args-show (&optional function)
"Show arguments and their default values of R function. Calls
Expand All @@ -252,7 +230,8 @@ buffer readjustments for multiline string)."
(when function
(let* ((tt (and (equal ess-r-args-show-as 'tooltip)
ess-has-tooltip))
(args (concat ess-r-args-show-prefix (ess-r-args-get function (not tt)))))
(args (concat ess-r-args-show-prefix
(ess-r-args-get function (not tt)))))
(ess-message "(ess-r-args-show): args='%s'" args)
(when args
(if (not tt)
Expand Down

0 comments on commit 9ef5487

Please sign in to comment.