mclear-tools / dotemacs

My emacs configuration.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

org agenda view on startup

rieje opened this issue · comments

commented

Hey, I came across your config while attempting to find a solution for my problem. It looks like you use persp-mode and have an org agenda view buffer on startup. What I'm trying to do is simple: on Emacs start via emacs -f gkc-todo-buffers, start with a todo.org buffer on the left and an org agenda view buffer on the right.

In this gist, it does that, but with an annoying quirk--as soon as org-agenda-list is called and an org agenda view buffer is created to the right, it is replaced by a seemingly random (but the same) org agenda file buffer, which is never mentioned in my init.el. Therefore, line 22 switches this buffer back to the org agenda view buffer.

I'm hoping you're getting the same behavior and may know what needs to be tweaked to the code to avoid the "random" org agenda file buffer from replacing the org agenda view buffer. If you comment out line 22 and try it out, you should be able to see what I mean.

Any help is much appreciated.

P.S. What's the dfference between (add-hook 'after-init-hook #'(lambda () (persp-mode 1))) and (persp-mode 1)?

Here's what I think you want:

(defun gkc-todo-buffers ()
    (setq initial-buffer-choice nil)
    (org-agenda nil "a")
    (split-window-horizontally)
    (find-file "~/notes/todo.org"))

As for the difference between calling (persp-mode 1) and calling as part of a hook, well -- the former just turns on persp-mode and the latter turns it on after a specific event, namely emacs starting up.

Also, you don't need persp-mode if all you want is a separate frame to keep your agenda and todos in. Here's an interactive version of the function that generates a new frame with your desired windows/buffers. You could also have this called with a hook (like the after-init-hook discussed above).

(defun gkc-todo-buffers ()
 "Create a frame with todos and agenda"
  (interactive)
    (make-frame)
    (set-frame-name "Org agenda")
    (setq initial-buffer-choice nil)
    (org-agenda nil "a")
    (split-window-horizontally)
    (find-file "~/notes/todo.org"))
commented

I think I found the problem, it's described here. Can you do me a big favor and confirm it? I'm really confused why I'm getting this strange behavior.

Much appreciated.

Sorry - I can't reproduce your problem and the function above works for me both in my emacs and using emacs -q. So I'm not sure what to say. Note too that you can get what you want in terms of emacs displaying agenda and a todo file without persp-mode.