Bad-ptr / persp-mode.el

named perspectives(set of buffers/window configs) for emacs
401 stars 44 forks source link

switching to *scratch* buffer with 24.4 #13

Closed farosas closed 9 years ago

farosas commented 9 years ago

I'm using emacs 24.4 and when I open it for the first time with emacsclient -c <filename> it will show the file and then switch to the scratch buffer.

Is this the expected behavior?

I am using the following init.el:

(with-eval-after-load "persp-mode-autoloads"
  (setq wg-morph-on nil) ;; switch off animation of restoring window configuration
  (add-hook 'after-init-hook #'(lambda () (persp-mode 1))))

(setq persp-auto-save-opt 2)
Bad-ptr commented 9 years ago

Is this the expected behavior?

No.) I'll take a look.

farosas commented 9 years ago

Don't know if it's relevant, but I do not run emacs --daemon beforehand. I have ALTERNATE_EDITOR="" in my .bashrc so that the first time I run emacsclient, it will start the daemon for me.

Bad-ptr commented 9 years ago

Well, for now I came up with this temporary solution(until I invent something cleverer):

(with-eval-after-load "persp-mode-autoloads"
  (setq wg-morph-on nil)
  (add-hook 'after-init-hook #'(lambda () (persp-mode 1)))

  (defun persp-first-find-file-hook ()
    (lexical-let ((cb (current-buffer)))
      (setq persp-restore-window-conf-method
        #'(lambda (frame persp new-frame)
        (setq persp-restore-window-conf-method t)
        (persp-restore-window-conf frame persp new-frame)
        (switch-to-buffer cb)))
      (remove-hook 'server-visit-hook #'persp-first-find-file-hook)))

  (when (daemonp)
    (add-hook 'server-visit-hook #'persp-first-find-file-hook)))

I tested it a bit and it looks like working for your case.

Bad-ptr commented 9 years ago

This must be solved by 3d87018216c7c71001cea56119c8a64f2d88f553