emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: emacs-org list <emacs-orgmode@gnu.org>
Subject: org-table bindings available outside org tables too?
Date: Mon, 23 May 2016 19:37:47 +0000	[thread overview]
Message-ID: <CAFyQvY3_p26HyG=QOqS8saGnXRXc-aRNbiCCnsBz60nRpc73tA@mail.gmail.com> (raw)

[-- 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 --]

             reply	other threads:[~2016-05-23 19:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-23 19:37 Kaushal Modi [this message]
2016-05-24 20:44 ` org-table bindings available outside org tables too? Nicolas Goaziou
2016-05-24 21:07   ` Kaushal Modi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFyQvY3_p26HyG=QOqS8saGnXRXc-aRNbiCCnsBz60nRpc73tA@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).