[ESS] C-M-e and C-M-a: move to next end/previous beginning?

Vitalie Spinu @p|nuv|t @end|ng |rom gm@||@com
Mon Oct 5 11:24:06 CEST 2015

There is an explicit check in the code for the point to be inside the
function. So I guess this is a bug which is there by design.

Fixing it would be very easy, but it would break the paragraph navigation

The reason for the -or-paragraph is that as compared to elisp or C++ R code
commonly contain paragraphs of code which are not defuns, like a series of
one-liners which you want to evaluate as one block. I personally would like that
C-M-a/e should perceive such paragraphs as defuns.

These commands are meant to be consistent with C-c C-c
(ess-eval-region-or-function-or-paragraph-and-step) and C-M-x

One fix wold be to detect if two defuns follow one after another and then jump
to previous/next function, otherwise jump to paragraphs in between.


>> On Sun, Oct 04 2015 21:57, Ramon Diaz-Uriarte wrote:

> Dear All,

> With C-M-e ( ess-goto-end-of-function-or-para) and C-M-a
> (ess-goto-beginning-of-function-or-para), once you reach the end/beginning
> of a function, further C-M-e/a will not move you to the end/beginning of
> the next/previous function.

> Is it possible to somehow achieve this? Or the "otherwise go to the end of
> paragraph" that C-M-e does precludes it?

> Why do I want to do this? Yes, the ESS manual explicitly says "Don’t forget
> the usual Emacs commands for moving over balanced expressions and
> parentheses", so combining C-M-e with, say, C-M-n will do what I want, but
> I'd rather just keep hitting "e" than alternating C-M-e and C-M-n. And I
> also keep tripping on this as, for instance, C-M-e and C-M-a in C++ code
> (c-end/beginning-of-defun) or elisp code (end/beginning-of-defun) keep
> moving you to subsequent/previous ends/beginnings. 

> Thanks,

> R.

More information about the ESS-help mailing list