emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Sv: Suggestion: two new commands: beginning-of-list and end-of-list


From: arthur miller
Subject: Sv: Suggestion: two new commands: beginning-of-list and end-of-list
Date: Tue, 10 Sep 2024 15:10:26 +0000

>> >I think we do have it: C-M-u, backward-up-list.  What's more, it works
>> >not only in Lisp.  I use it all the time.
>>
>> Yes you have. It works slightly differently when you are in a string, and it
>> places cursor before the opening parenthesis, not after.
>
>Right.  But I think what it does is very useful, since it can be
>invoked repeatedly, each time moving up one level.

We are in agreement about backward-up-list being useful, that was never
in question.

>> >So I wonder why we need another function that does basically the same.
>>
>> I think it makes sense to keep backward-up-list as it is, since it handles
>> literal strings as it does. But the behaviour is controlled via special vars
>> esape-strings and no-syntax-crossing. If we want similar command as
>> beginning-of-string, we have to wrap it and let-bind those variables to
>> change how it works.
>
>Yes, but is that a problem?

Everyone who would like to customize it has to write their own. That is
why I say it is convenience. I didn't say it is revolutionary, or that it
replaces something else. But you skip to press C-f after
backward-up-list. As a note, it will work about the same in C code as
backward-up-list. I haven't tested extensively, just a bit. It uses same
primitives as backward-up-list, so it is not surprising.

There are less useful things, even easier to wrap up than this, but ship
with Emacs for user convenience.

>> I am not sure, what is a symmetric function to move cursor to the end of list?
>
>The converse of C-M-u is C-M-d, but it doesn't move to the end of a
>list, it moves _inside_ one level.

Down-list? I don't think it is close to the end-of-list. In some
situations you would clearly prefer down-list in others end-of-list. I
don't think they compete.

>> But as said in the previous mail: this function is *already* in Emacs, so it is
>> already taking the memory in the process.  It is just not used more than
>> once, and have *potential* to be used more. In other words, I suggest these
>> two functions as a convenience, not because it is impossible to do something
>> similar via some combination of other commands and variables.
>
>It is IME confusing to have two similar functions that do _almost_ the
>same job.

I understand your point, but I am not sure it is confusing. I think the
name is quite different. There is also a symmetri with other functions,
there are several beginning-of-* and end-of-* functions in lisp.el. If
someone is new, it might be easier to discover beginning-of-list and
understand what it doew, than backward-up-list and realize they can use
it for the same purpose if they just click a bit more. The most
important argument is that the function is included, I have basically
just renamed it.

As mentioned, people are speaking about Lispy and Yuri mentions
Smartparens by the same author. Obviously other people do find something
similar to this convenient. Paredit does not have something directly
same (or I have missed it).

Från: Eli Zaretskii <eliz@gnu.org>
Skickat: den 10 september 2024 13:30
Till: arthur miller <arthur.miller@live.com>
Kopia: emacs-devel@gnu.org <emacs-devel@gnu.org>
Ämne: Re: Suggestion: two new commands: beginning-of-list and end-of-list
 
> From: arthur miller <arthur.miller@live.com>
> CC: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> Date: Mon, 9 Sep 2024 19:41:12 +0000
> msip_labels:
>
> >I think we do have it: C-M-u, backward-up-list.  What's more, it works
> >not only in Lisp.  I use it all the time.
>
> Yes you have. It works slightly differently when you are in a string, and it
> places cursor before the opening parenthesis, not after.

Right.  But I think what it does is very useful, since it can be
invoked repeatedly, each time moving up one level.

> >So I wonder why we need another function that does basically the same.
>
> I think it makes sense to keep backward-up-list as it is, since it handles
> literal strings as it does. But the behaviour is controlled via special vars
> esape-strings and no-syntax-crossing. If we want similar command as
> beginning-of-string, we have to wrap it and let-bind those variables to
> change how it works.

Yes, but is that a problem?

> I am not sure, what is a symmetric function to move cursor to the end of list?

The converse of C-M-u is C-M-d, but it doesn't move to the end of a
list, it moves _inside_ one level.

> But as said in the previous mail: this function is *already* in Emacs, so it is
> already taking the memory in the process.  It is just not used more than
> once, and have *potential* to be used more. In other words, I suggest these
> two functions as a convenience, not because it is impossible to do something
> similar via some combination of other commands and variables.

It is IME confusing to have two similar functions that do _almost_ the
same job.

What do others think about this?

> By the way, why did all occasions of the word "_expression_" ended up surroneded
> with underscores in the online archive?

No idea.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]