[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 16:37:12 CEST 2015


I have opened an issue for this (https://github.com/emacs-ess/ESS/issues/251)

Looks like this behavior has been there since ESS inception, but I still think
we need to comply with the standard behavior across emacs modes.

I personally never noticed this because I am mostly relying on paragraph
navigation functions.

  Vitalie

>> On Mon, Oct 05 2015 12:54, Ramon Diaz-Uriarte wrote:

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

> Best,

> R.

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




More information about the ESS-help mailing list