emacs-devel
[Top][All Lists]
Advanced

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

Re: Major mode and implementation of expected editing facilities


From: Daniele Nicolodi
Subject: Re: Major mode and implementation of expected editing facilities
Date: Tue, 28 May 2019 13:52:35 -0600
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.7.0

On 28-05-2019 08:55, Eli Zaretskii wrote:
>> From: Daniele Nicolodi <address@hidden>
>> Date: Mon, 27 May 2019 22:40:15 -0600
>>
>>   A major mode can also rebind the keys M-n, M-p and M-s. The bindings
>>   for M-n and M-p should normally be some kind of moving forward and
>>   backward, but this does not necessarily mean cursor motion.
>>
>>   It is legitimate for a major mode to rebind a standard key sequence if
>>   it provides a command that does the same job in a way better suited to
>>   the text this mode is used for. For example, a major mode for editing
>>   a programming language might redefine C-M-a to move to the beginning
>>   of a function in a way that works better for that language.
>>
>> in "Major Mode Conventions", which describes exactly what I want to do,
>> but does not give any pointer which key sequences it makes sense and it
>> is most common to rebind. For example I don't fins mention of M-q
>> (fill-paragraph) which was in my original example.
>>
>> Am I overlooking something?
> 
> Given the above text, I'm not sure I understand what are you looking
> for.  Clearly, what specific keys a major mode can reasonably rebind
> depends on the mode and what it does, right?  IOW, it's your decision,
> as someone who knows what the mode does, and which of its commands
> could be usefully regarded as "generalizations" or "customizations" of
> those in the related modes.

The text above mention four example of keybindings that make sense to
rebind in a mode: M-n, M-p, M-s, C-M-a. I'm surer this is not an
exhaustive list and I am also sure there are cases in which rebinding
the keys is not the right thing to do as in the case of M-q.

>From your answer I understand that consistency in the "user interface"
of major modes is not a desirable thing or that emacs hackers want to
reserve for themselves the right to complain that new modes will not
follow the emacs way. I understand that the elders like to have
something to be grumpy about, but it does not invite new contributions.

By the way, what is M-s supposed to do? It is not bind in the couple of
modes I looked at.

Cheers,
Dan



reply via email to

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