0

Pressing q in an agenda view restores the window layout if org-agenda-restore-windows-after-quit is non-nil. Is there a way to do the same on RET (org-agenda-switch-to)?

  • Is it your intention to disable q as a regular key in the org-mode buffer such that you can no longer type a heading such as * queens and kings :qbert:? – lawlist Jan 31 '17 at 7:01
  • I don't want to do anything with q, just that RET in the agenda first close agenda and restore the window layout and then jump to the task in "other window". – Davor Cubranic Feb 1 '17 at 18:15
0

I think he means after selecting an entry, it splits the frame in two pieces. After some debugging, I found out the org-agenda-switch-to can be called with an "optional" argument, which instructs the function to close all other windows.

(add-hook 'org-agenda-mode-hook
      (lambda()
        (define-key org-agenda-mode-map
          (kbd "RET") (lambda () (interactive) (org-agenda-switch-to t)))))

Note: I'm not an emacs expert.

  • That's not quite what I meant, @anakha: I don't want to delete all other windows, but to restore the window layout that was active before I ran org-agenda-list, and then open the task in "other window", using the standard Emacs logic for switch-to-buffer-other-window and find-file-other-window. – Davor Cubranic Jul 14 '17 at 13:49
  • In that case this can probably be done with a function that uses window-configuration-to-register then launch org-agenda-list, select your entry and have another hook at org-agenda-after-show-hook that will save the current point/buffer, jump-to-register and display-buffer in the frame you like. If I have some time later today, I will look into it. – anakha Jul 15 '17 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.