emacs-orgmode
[Top][All Lists]
Advanced

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

[O] org-table bindings available outside org tables too?


From: Kaushal Modi
Subject: [O] org-table bindings available outside org tables too?
Date: Mon, 23 May 2016 19:37:47 +0000

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


reply via email to

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