emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-table bindings available outside org tables too?
@ 2016-05-23 19:37 Kaushal Modi
  2016-05-24 20:44 ` Nicolas Goaziou
  0 siblings, 1 reply; 3+ messages in thread
From: Kaushal Modi @ 2016-05-23 19:37 UTC (permalink / raw)
  To: emacs-org list

[-- Attachment #1: Type: text/plain, Size: 1145 bytes --]

Hi,

We have a lot of org-table specific functions bound in org-mode-map whether
or not the point is actually in an org table.

Reference[1].

Is there a specific reason to have those bindings available globally in an
org mode buffer?

To prevent that, I have come up with this[2].

The idea is to use context-aware key mapping[3]. Also the info node:
"(elisp) Extended Menu Items".

Here is what binding "C-c SPC" looks like when using the bind-keys macro
from bind-key.el[4].

(bind-keys
 :map org-mode-map
 :filter (org-at-table-p)
  ("C-c SPC" . org-table-blank-field))

Below is the same without bind-key.el dependency:

(define-key org-mode-map (kbd "C-c SPC")
  '(menu-item "" nil :filter
              (lambda (&optional _)
                (when (org-at-table-p)
                  'org-table-blank-field))))

[1]:
http://orgmode.org/cgit.cgi/org-mode.git/tree/lisp/org.el?id=58f5def6256ebef9cde9485daf7f57c45cd4402a#n20025
[2]: http://emacs.stackexchange.com/a/22457/115
[3]: http://endlessparentheses.com/define-context-aware-keys-in-emacs.html
[4]: https://github.com/jwiegley/use-package/blob/master/bind-key.el
-- 

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 2216 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-table bindings available outside org tables too?
  2016-05-23 19:37 org-table bindings available outside org tables too? Kaushal Modi
@ 2016-05-24 20:44 ` Nicolas Goaziou
  2016-05-24 21:07   ` Kaushal Modi
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Goaziou @ 2016-05-24 20:44 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-org list

Hello,

Kaushal Modi <kaushal.modi@gmail.com> writes:

> We have a lot of org-table specific functions bound in org-mode-map whether
> or not the point is actually in an org table.
>
> Reference[1].
>
> Is there a specific reason to have those bindings available globally in an
> org mode buffer?

We do not have a char map specific to tables. 

In most cases, bindings are context-aware (see, e.g., the dauting C-c
C-c). However, the bindings you cite are not claimed by other parts of
Org, so they just do table specific stuff.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: org-table bindings available outside org tables too?
  2016-05-24 20:44 ` Nicolas Goaziou
@ 2016-05-24 21:07   ` Kaushal Modi
  0 siblings, 0 replies; 3+ messages in thread
From: Kaushal Modi @ 2016-05-24 21:07 UTC (permalink / raw)
  To: emacs-org list

[-- Attachment #1: Type: text/plain, Size: 576 bytes --]

On Tue, May 24, 2016 at 4:44 PM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> We do not have a char map specific to tables.
>
> In most cases, bindings are context-aware (see, e.g., the dauting C-c
> C-c). However, the bindings you cite are not claimed by other parts of
> Org, so they just do table specific stuff.
>

Thanks for the reply.

In that case, I think that the bind-keys approach is clean enough if a user
wants to prevent the org-table-* fn bindings from shadowing their global
map bindings when the point is not in a table.
-- 

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 942 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-05-24 21:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-23 19:37 org-table bindings available outside org tables too? Kaushal Modi
2016-05-24 20:44 ` Nicolas Goaziou
2016-05-24 21:07   ` Kaushal Modi

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).