Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Emacs conventions (was: Re: Overriding emacs key bindings)

12 views
Skip to first unread message

Emanuel Berg

unread,
May 17, 2016, 9:43:11 PM5/17/16
to help-gn...@gnu.org
Drew Adams <drew....@oracle.com> writes:

> What Emacs reserves (by convention) are keys
> from modes. It says that major modes should
> use only these keys and minor modes should
> use only those keys. And neither major nor
> minor should use a third set of keys, which
> are _only_ for users (again, by convention).

Are those "Emacs conventions" - and not just
those who deal with keys -
summarized somewhere?

Because they are obviously good to be aware of,
so when you disregard them, it is something you
do because you think it'll benefit you, and not
because you are unaware of something that on
the contrary makes sense...

--
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
- so far: 32 Blogomatic articles -


Drew Adams

unread,
May 18, 2016, 12:39:18 AM5/18/16
to Emanuel Berg, help-gn...@gnu.org
> > What Emacs reserves (by convention) are keys
> > from modes. It says that major modes should
> > use only these keys and minor modes should
> > use only those keys. And neither major nor
> > minor should use a third set of keys, which
> > are _only_ for users (again, by convention).
>
> Are those "Emacs conventions" - and not just
> those who deal with keys - summarized somewhere?

(elisp) `Key Binding Conventions':
http://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html

> Because they are obviously good to be aware of,
> so when you disregard them, it is something you
> do because you think it'll benefit you, and not
> because you are unaware of something that on
> the contrary makes sense...

Yes, they are good to be aware of. But again, they are
for someone writing a library for more than personal use.
They are in no way restrictions on users.

There is no convention (that I know of) that restricts
key bindings for users or even suggests that users
should stay away from certain keys.

The exceptions I can think of, in terms of suggestions,
are `C-u' and `C-g'. You might get into some difficulty
if you try to bind `C-u' (and a few users seem to want
to do that). You can use another key in place of `C-g',
but there are some hard-coded bindings of `C-g' to its
usual behavior, AFAIK.

I would recommend that no one try to use `C-g' or `C-u'
for something else. (But there is no restriction against
trying to do that.)

Emanuel Berg

unread,
May 18, 2016, 1:23:15 AM5/18/16
to help-gn...@gnu.org
Drew Adams <drew....@oracle.com> writes:

> Yes, they are good to be aware of. But again,
> they are for someone writing a library for
> more than personal use. They are in no way
> restrictions on users.
>
> There is no convention (that I know of) that
> restricts key bindings for users or even
> suggests that users should stay away from
> certain keys.

OK.

No doubt, disregarding conventions in code that
is supposed to be shared - you should have
a very good reason for doing that! (The
assumption being the convention makes sense.)

Still, there is a hesitation in my mind doing
a to sharp division between libraries that are
professional, and then the user stuff... The
user stuff is the best school. So it is a good
place to start acting like a skilled
programmer, and that skilled programmer may
well write or contribute to a library, and that
doesn't have to take three decades like some
people think....

As they say in boxing, "you want to be
a champion? Start acting like one, today".

So a list of conventions, good habits, known
pitfalls, etc. is a good idea. (Perhaps it can
in large parts be compiled from different parts
of existing material.) Just a thought - I'm not
up for the job myself :)

But here is one thing that might help for code that
is a package:

(defun check-package-style ()
(interactive)
(checkdoc-current-buffer t) ; TAKE-NOTES
(message "Style check done.") )

Eh :)

--
underground experts united .... http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
- so far: 33 Blogomatic articles -


Barry Margolin

unread,
May 18, 2016, 10:31:35 AM5/18/16
to
In article <mailman.37.146354635...@gnu.org>,
Drew Adams <drew....@oracle.com> wrote:

> Yes, they are good to be aware of. But again, they are
> for someone writing a library for more than personal use.
> They are in no way restrictions on users.
>
> There is no convention (that I know of) that restricts
> key bindings for users or even suggests that users
> should stay away from certain keys.

But if a user binds a key that's supposed to be for modes, and then they
load a mode that also binds that key, they'll have a conflict. The point
of these conventions is to avoid conflicts like this.

If you don't mind losing one of the mode's keybindings, that's fine, but
you should do it with full knowledge of the potential conflict.

--
Barry Margolin, bar...@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***

Emanuel Berg

unread,
May 19, 2016, 12:38:51 AM5/19/16
to
Barry Margolin <bar...@alum.mit.edu> writes:

>> There is no convention (that I know of) that
>> restricts key bindings for users or even
>> suggests that users should stay away from
>> certain keys.
>
> But if a user binds a key that's supposed to
> be for modes, and then they load a mode that
> also binds that key, they'll have a conflict.
> The point of these conventions is to avoid
> conflicts like this.

Thats exactly right.

Part of the reason a convention is useful is
that the convention itself makes sense, but
part of it has little to do with the particular
definition, and the usefulness lies in the
status as convention as such, and likely some
other definition would have worked just as
good...
0 new messages