org-super-agenda
org-super-agenda copied to clipboard
Origami example binds Tab incorrectly
Hi there,
I've tried integrating with origami as described in 3b5e8faeec1333aca3cafbbaa350dacc95412086, but use-package
does not like the :general
symbol in its given position. Actually, it does not seem that use-package
knows anything about either :general
or :keymaps
(I've grepped the source). I've also tried putting (define-key org-super-agenda-header-map (kbd "TAB") #'origami-toggle-node)
in the :config
section with no luck. Do you have any other ideas for getting the TAB keybinding to work? Running M-x origami-toggle-node
on a header works, so the only issue is getting the keybinding to work reliably.
You need to install the general
package to use the :general
keyword.
Thanks! That's helpful. Action item # 1, then, will be documenting this in that example. I am still having difficulty getting the example to work (i.e., TAB still results in "Command not allowed on this line"), but will try to get debug this soon and will let you know what I figure out.
I am still having difficulty getting the example to work (i.e., TAB still results in "Command not allowed on this line"), but will try to get debug this soon and will let you know what I figure out.
Be sure that the point is on the header line. If it is and still doesn't work, use describe-text-properties
and see if the keymap is set to org-super-agenda-header-map
. If it is, check org-super-agenda-header-map
and see if TAB
is bound to the command. If it is and still doesn't work, I don't know what the problem would be.
I had to change "TAB"
to "<tab>"
to get it to work. This is on emacs 26.1. Before it was bound to key 9, whatever that is. Now it is bound to "tab".
Guess you'd better refer to the Emacs manual for how to specify key bindings. :)
Guess you'd better refer to the Emacs manual for how to specify key bindings. :)
I'm afraid I don't understand. I copy and pasted an example from examples.org
, and it did not work without modification. Should this not be fixed? And 9 == 011
, which is supposed to be tab, so I am doubly confused why it did not work.
In any case, I believe it should be documented that the general
package is required, as this is not mentioned in examples.org
or in the Emacs manual.
And 9 ==
011
, which is supposed to be tab, so I am doubly confused why it did not work.
Well, there are at least three different ways to bind the Tab key, I think:
[tab]
"\t"
(kbd "<tab>")
See, e.g. https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Sequences.html.
I'm afraid I don't understand. I copy and pasted an example from examples.org, and it did not work without modification. In any case, I believe it should be documented that the
general
package is required, as this is not mentioned inexamples.org
or in the Emacs manual.
Ah, yes, I put TAB
in the example when it should have been one of those other ways. Thanks. And I think I'll just remove general from the example.
This is what worked for me:
(require 'use-package)
(require 'general)
(use-package origami
:general (:keymaps 'org-super-agenda-header-map
"<tab>" #'origami-toggle-node)
:config
:hook ((org-agenda-mode . origami-mode)
))
Just include this in your .emacs file.
thanks, I got stuck on this same problem, and this helped me!
Hi! for the ones using Doom Emacs, this worked for me:
(after! org-agenda
(map!
:map org-super-agenda-header-map
:g [tab] #'origami-toggle-node))
This way you can avoid Doom from overriding the keybinding with its default. I was having the same problem than the OP You should include it in the config.el file
I got it working with this snippet:
(use-package org-super-agenda
:config
(use-package origami
:bind (:map org-super-agenda-header-map
("<tab>" . origami-toggle-node))
:hook ((org-agenda-mode . origami-mode))))
I was confused by :general
(this hint makes sense), looked into use-package
's documentation and substituted with :bind
and :map
. However, it seems folding does not work for all headlines now and I assume my substitutions are the reason (or my customised super-agenda setup). Calling origami-toggle-node
manually works for e.g. super agenda's section titles.
Thanks @garrison with your comment on using <tab>
further up!