emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Old 'C-c tab' binding shadowed


From: Adrian Bradd
Subject: Re: [O] Old 'C-c tab' binding shadowed
Date: Sat, 9 Sep 2017 13:02:31 -0400

I also use this keybinding for opening subtrees to certain depths. My reasoning is identical to Marco's, it provides a great overview with very little noise.

Would be nice to have these actions context dependent in org so we get the best of both worlds. Failing that, Kaushal's setup looks like a good solution.

Cheers,

Adrian

On 7 September 2017 at 18:11, Marco Wahl <address@hidden> 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

Thanks!

Good to know a path to a personal configuration for the case no one else
is interested in the old C-c TAB behavior.


Ciao,
     Marco




reply via email to

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