wasamasa/shackle

no effect on org-agenda buffer

alienbogart opened this issue · 5 comments

I'm using the following configuration:

(use-package shackle
  :ensure t
  :delight
  :init
  (setq shackle-rules '((compilation-mode :noselect t)
          ("\\`\\*Occur.*?\\*\\'" :regexp t :align t :select t :size 0.4)
          ("\\`\\*Help.*?\\*\\'" :regexp t :align t :select t :size 0.4)
          ("\\`\\*Register Preview.*?\\*\\'" :regexp t :align t :select t :size 0.4)
          ("\\`\\*Agenda Commands.*?\\*\\'" :regexp t :align 'below :popup t :select t :size 0.4)
          shackle-default-rule '(:select t)))
  :config
  (shackle-mode 1))

Shackle works with everything, except for the Agenda Commands window. I tried using org-agenda-mode but it didn't work either. Any suggestions?

Use M-x shackle-trace-functions, play around with the agenda and check the trace buffer for display-buffer calls. This will either point to the right buffer name/mode or not show anything useful which means you're out of luck as it's not using display-buffer at all.

I tried shackle-trace-functions, but I don't know the meaning of the results:

======================================================================
1 -> (switch-to-buffer-other-window " *Agenda Commands*")
| 2 -> (pop-to-buffer " *Agenda Commands*" t nil)
| | 3 -> (display-buffer #<buffer  *Agenda Commands*> t)
| | 3 <- display-buffer: #<window 8 on  *Agenda Commands*>
| 2 <- pop-to-buffer: #<buffer  *Agenda Commands*>
1 <- switch-to-buffer-other-window: #<buffer  *Agenda Commands*>
======================================================================
1 -> (display-buffer #<buffer *Help*> nil)
1 <- display-buffer: #<window 12 on *Help*>

Well, this shows that switch-to-buffer-other-window has been called with an agenda buffer which calls pop-to-buffer which calls display-buffer and then they're shown returning buffers. The critical part here is that the name of the buffer starts with a space, your regex however doesn't permit that. Fix it.

You mean something like that?
("\\\\ Agenda Commands.?\*\'" :regexp t :align 'below :popup t :select t :size 0.4))`?

Yes, something like that. Feel free to use M-: (string-match-p "some re" "some string to match") for testing. Also, go read the Regex section of the elisp reference to get an idea what these backslashes are for.