I have a key which calls `gnus-other-frame`, a handy function that not only 
pops up a gnus frame, but also kills the frame when I exit gnus. I'd like 
something similar with my org agenda; the following function is used to pop it 
up, but I'm not sure how to kill the frame when I hit close the agenda (i.e. 
hitting `q`). The result should work whether I'm using sticky agenda or not. 
Any suggestions? 

--8<---------------cut here---------------start------------->8---
(defun go-or-make-agenda (&optional new-frame)
  (interactive "P")
  (let ((buffer org-agenda-buffer-name)
        (my-switch-function (if new-frame 'switch-to-buffer-other-frame 
'switch-to-buffer)))
    (if (get-buffer buffer)
        (funcall my-switch-function buffer)
      (org-agenda-list))))
--8<---------------cut here---------------end--------------->8---

Reply via email to