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

Ramon Diaz-Uriarte rd|@z02 @end|ng |rom gm@||@com
Mon Oct 5 12:54:28 CEST 2015

Dear Vitalie,

On Mon, 05-10-2015, at 11:24, Vitalie Spinu <spinuvit using gmail.com> wrote:
> 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
> functionality.
> 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
> (ess-eval-region-or-function-or-paragraph).

Oh, I see. Of course, I actually use C-c C-c and C-M-x a lot and expect
that "series of one-liners" to work; I wasn't aware of the
relationship. And I also intuitively expect that paragraph behavior to work
with C-M-a/e.

Thanks for the explanation.

> 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.

I think that is what I'd intuitively expect. But maybe everyone else is
happy with the current behavior.



>  Vitalie
>>> 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.

Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-25
Facultad de Medicina
Universidad Autónoma de Madrid 
Arzobispo Morcillo, 4
28029 Madrid

Phone: +34-91-497-2412

Email: rdiaz02 using gmail.com
       ramon.diaz using iib.uam.es


More information about the ESS-help mailing list