emacs-orgmode
[Top][All Lists]
Advanced

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

Re: Free up C-c SPC/org-table-blank-field?


From: Tim Cross
Subject: Re: Free up C-c SPC/org-table-blank-field?
Date: Fri, 05 Feb 2021 16:32:21 +1100
User-agent: mu4e 1.5.8; emacs 27.1.91

Eric Abrahamsen <eric@ericabrahamsen.net> writes:

>> Does it actually need a key binding? I've never used it and just use
>> <tab> to move to the next field, leaving the field blank.
>
> I assume it's meant for blanking a field you've already typed something
> into. But yes, I can't imagine it's a heavily-used command, and I
> suspect the C-c <SPC> binding is mostly mnemonic: "make this field
> contain only blanks".
>

I guess that makes sense, but not convinced the use of a valuable key
binding is justified given the need. Then again, others probably have
vastly different use cases to mine.

>>>>
>>>> What do people think about making it a no-op when not on a table
>>>> (letting it fall through to the global map), or putting it in a keymap
>>>> text property on tables, or otherwise not hogging the binding?
>>>
>>> In my view, the first would be fine, and the second also unless someone
>>> chimes in with a technical reason not to. For the last, perhaps `C-c
>>> C-SPC' would be an okay replacement, though I'd assume that would break
>>> some users' muscle memory in a surprising and unpleasant way.
>>
>> I'm not familiar with how this is all put together inside org mode.
>> If it is possible to configure things so that it is only bound when
>> inside a table and does not shadow other bindings for that sequence
>> outside a table, I think that would be a positive change. However, I do
>> also note that this is the type of change which tends to cause 'ripples'
>> and may have unexpected impact in other areas, such as other packages,
>> predefined or 'canned' emacs configurations etc.
>
> The way Org handles these situations now is to have a command that is
> named for its actual keybinding (eg `org-shiftmetaleft'), which then
> examines its context and dispatches to various other functions. That's a
> bit odd and not really how it's done in Emacs -- but I am not proposing
> we change this as it is pretty fundamental to how Org is set up and
> would wreck a bunch of stuff if it were changed.
>
> I thought Emacs might have some easy way to let a key event "fall
> through" to other keymaps, but I haven't been able to find anything
> immediately obvious. Maybe I can ask on emacs.devel...
>

I don't believe there is one. I think the basic model is a hierarchy of
key maps with bindings and the first match wins. I guess the only option
is to add a more sophisticated context test and only perform the action
if the context is inside a table cell. If not inside a table cell,
either perform some function which makes sense. It could be that on
loading, org checks to see if there is a binding and stores that as the
default action outside of tables or if we have some action which would
make sense, bind to that or keep it simple and have it defined as a user
option which defaults to a noop and allow the user to define something
if they want?

Since switching to spacemacs and its 'evil' key binding model, I've
become very aware of the dangers associated with modes that try to be
too clever when it comes to key bindings. I think they are really quite
a personal thing and best kept as simple as possible. In general, org
has been reasonably successful with its rather 'advanced' approach, but
there have been times I've found it frustrating. Smart key bindings are
great when they do what you expect, but when they don't....

--
Tim Cross



reply via email to

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