From: Kaushal Modi <kaushal.modi@gmail.com>
To: Marco Wahl <marcowahlsoft@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: Old 'C-c tab' binding shadowed
Date: Thu, 07 Sep 2017 19:53:16 +0000 [thread overview]
Message-ID: <CAFyQvY2OxMs=d5iNzgrXbLud+wuMrM2qMU--cqBb6Sjx0zmamw@mail.gmail.com> (raw)
In-Reply-To: <84lglqgvcv.fsf@tm6592>
[-- Attachment #1: Type: text/plain, Size: 2129 bytes --]
On Thu, Sep 7, 2017 at 3:33 PM Marco Wahl <marcowahlsoft@gmail.com> wrote:
> I think the bindings could coexist peacefully since
>
`org-table-toggle-column-width' makes sense only for the cursor located
> in a table and `outline-show-children' makes most sense (AFAICS) when
> called on a headline.
>
> Does this sound reasonable?
>
> Does anyone see clearly how to implement this? (I don't.)
>
I always wondered the same about other org-table-* bindings in org.el.
This works:
diff --git a/lisp/org.el b/lisp/org.el
index a03d8c5a429..cba9b20482f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19632,7 +19632,12 @@ COMMANDS is a list of alternating OLDDEF NEWDEF
command names."
(org-defkey org-mode-map "\C-j" 'org-return-indent)
(org-defkey org-mode-map "\C-c?" 'org-table-field-info)
(org-defkey org-mode-map "\C-c " 'org-table-blank-field)
-(org-defkey org-mode-map (kbd "C-c TAB") #'org-table-toggle-column-width)
+(org-defkey org-mode-map (kbd "C-c TAB")
+ '(menu-item "toggle-column-width-when-in-table" nil
+ :filter (lambda (&optional _)
+ (if (org-at-table-p)
+ #'org-table-toggle-column-width
+ #'outline-show-children))))
(org-defkey org-mode-map "\C-c+" 'org-table-sum)
(org-defkey org-mode-map "\C-c=" 'org-table-eval-formula)
(org-defkey org-mode-map "\C-c'" 'org-edit-special)
I actually do this for org-table-* bindings in my config:
;; Bind the "org-table-*" command ONLY when the point is in an Org
table.
;; http://emacs.stackexchange.com/a/22457/115
(bind-keys
:map org-mode-map
:filter (org-at-table-p)
("C-c ?" . org-table-field-info)
("C-c SPC" . org-table-blank-field)
("C-c +" . org-table-sum)
("C-c =" . org-table-eval-formula)
("C-c `" . org-table-edit-field)
("C-#" . org-table-rotate-recalc-marks)
("C-c }" . org-table-toggle-coordinate-overlays)
("C-c {" . org-table-toggle-formula-debugger))
Inspiration:
http://endlessparentheses.com/define-context-aware-keys-in-emacs.html
--
Kaushal Modi
[-- Attachment #2: Type: text/html, Size: 3614 bytes --]
next prev parent reply other threads:[~2017-09-07 19:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-07 19:30 Old 'C-c tab' binding shadowed Marco Wahl
2017-09-07 19:41 ` Nicolas Goaziou
2017-09-07 21:28 ` Marco Wahl
2017-09-07 19:53 ` Kaushal Modi [this message]
2017-09-07 22:11 ` Marco Wahl
2017-09-09 17:02 ` Adrian Bradd
2017-09-18 19:29 ` Nicolas Goaziou
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='CAFyQvY2OxMs=d5iNzgrXbLud+wuMrM2qMU--cqBb6Sjx0zmamw@mail.gmail.com' \
--to=kaushal.modi@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=marcowahlsoft@gmail.com \
/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).