Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate nearest expression, a bit like lisp's C-x C-e #52

Open
torbjorn opened this issue Sep 10, 2013 · 7 comments
Open

Evaluate nearest expression, a bit like lisp's C-x C-e #52

torbjorn opened this issue Sep 10, 2013 · 7 comments
Assignees
Milestone

Comments

@torbjorn
Copy link

Hi, in lisp I can go to the end of a bracket (foo bar)<-here and hit C-x C-e and it will evaluate the list that ends with that bracket

Could something similar be implemented for R?

Im thinking along these lines:

foo <- sum( is.na( some.funcion() ) ) )

If I place the marker after a bracket, it would evaluate the nested code matching that level, ie (showing the marker with underscore):

foo <- sum( is.na( some.function()_ ) ) # would evaluate some.function()

foo <- sum (is.na( some.fun_ction() ) ) # would also evluate some.function()

foo <- sum( is.na( some.function() ) )_ # would evaluate sum( ... )

foo <-_ sum( is.na(some.function() ) ) # would evaluate the assignment (and the sum )

That way I could easily debug nested code on one code line (or paragraph) without having to re-select incremently larger potions of it before running ess-eval-region

@torbjorn
Copy link
Author

(in parentheses remarked, that last request should have said "parentheses" where it said "brackets")

@vspinu
Copy link
Member

vspinu commented Sep 10, 2013

Thanks, this is indeed a very good suggestion. I am also missing it quite a lot, but never got down to actually implementing it.

@torbjorn
Copy link
Author

Are there no lisp-heads that could get around to make this dream come true?

@jabranham
Copy link
Contributor

@lionel- I see you assigned this to yourself a while ago. Have you ever gotten around to looking at how hard this would be to implement?

This came up in the Emacs subreddit recently and I felt bad saying no it's not possible but we have a 5 year old feature request for it :-(

@lionel-
Copy link
Member

lionel- commented Aug 31, 2018

I'm working on it (and other things requiring the same feature) slowly when I find time. But I was sidetracked with other ESS things recently.

@vspinu
Copy link
Member

vspinu commented Sep 1, 2018

C-u M-C-x would also be nice for instrumentationr. I keep pressing it instinctively.

@vspinu vspinu added this to the 19.04 milestone Sep 1, 2018
@jabranham
Copy link
Contributor

I'm removing this (commented) code in #721, perhaps it's useful here:

;; Experimental - after suggestion from Jenny Brian for an 'eval-multiline'
;; 'sentence' is too much : almost like 'paragraph'
;; 'sexp'     is close, but too little [when point is inside function call;
;;         it moves all the way to the end - which is fine]
(defun ess-eval-sexp (vis)
  "Send the current sexp to the inferior ESS process.
Prefix arg VIS toggles visibility of ess-code as for `ess-eval-region'."
  (interactive "P")
  (save-excursion
    (forward-sexp)
    (let ((end (point)))
      (backward-sexp)
      (ess-eval-region (point) end vis "Eval sexp"))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants