Bad-ptr / persp-mode.el

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

def-auto-persp is the future #52

Open kootenpv opened 7 years ago

kootenpv commented 7 years ago

I believe def-auto-persp is the real future of any kind of management. Finally being able to group dired? And jabber? And magit? Everything can be organized on type. You can nicely play around with magit, and then afterwards just use "persp-previous", or what it is called, and be back where you want.

In fact, we can just set up some 8 key chords to bring us into each "land" that we want (magit, jabber, notmuch, dired, programming1, programming2, programming3, programming4).

However, I have trouble setting it up. Could you perhaps add some more examples to def-auto-persp?

kootenpv commented 7 years ago

When I try to create a new persp it says:

persp-add-new: Symbol's function definition is void: make-persp-internal

SOLVED: Resolved long time ago by https://github.com/Bad-ptr/persp-mode.el/issues/9

kootenpv commented 7 years ago

I'm really trying, but I do not see how all the dired buffers are grouped together?

When I do persp-switch-to-buffer, it offers all buffers?

kootenpv commented 7 years ago

I currently have this:

(with-eval-after-load "persp-mode-autoloads"
  (setq wg-morph-on nil) ;; switch off animation
  (setq persp-autokill-buffer-on-remove 'kill-weak)
  (add-hook 'after-init-hook #'(lambda () (persp-mode 1))))

(with-eval-after-load "persp-mode-autoload"
  (with-eval-after-load "dired"
    (def-auto-persp "dired"
      :parameters '((dont-save-to-file . t))
      :mode 'dired-mode
      :dyn-env '(after-switch-to-buffer-functions ;; prevent recursion
                 (persp-add-buffer-on-find-file nil)
                 persp-add-buffer-on-after-change-major-mode)
      :hooks '(after-switch-to-buffer-functions)
      :switch 'window)))

(defvar config-layouts-after-find-file-hook nil)
(def-auto-persp "projectile"
  :parameters '((dont-save-to-file . t))
  :hooks '(config-layouts-after-find-file-hook)
  :switch 'frame
  :predicate
  (lambda (_buffer)
    (when (and (buffer-file-name) (projectile-project-p))

      t))
  :get-name-expr
  (lambda ()
    (abbreviate-file-name (projectile-project-root))))

It's not automatically making these perspective, neither for dired nor for projectile.

Bad-ptr commented 7 years ago

I believe def-auto-persp is the real future of any kind of management. Finally being able to group dired? And jabber? And magit? Everything can be organized on type. You can nicely play around with magit, and then afterwards just use "persp-previous", or what it is called, and be back where you want.

Yes, It was intended to be like this. But it is really hard to implement it in a way that will satisfy everyone. For now it is a raw and experimental feature. However theoretically you must be able to implement whatever you want the question is how much time and code it will take.) I'll write some code for you at the end of the week... maybe).

kootenpv commented 7 years ago

@Bad-ptr That would be very much appreciated! I believe you should try to come up with "the one way to do it". Then people will take their own spin on it. Given the popularity of projectile and perspective, I think you could decide what is the best way to make use of them.

In the end, I believe we just need projectile (any git repo -> own perspective), and then dired/magit/jabber/notmuch aka "own mode buffers" to be able to grouped, which should be quite generic: just "if keyword in buffername".

When you could combine those, you have something very unique that I think everyone is missing. I would define some keychords to jump into these auto-perspectives (which is something a user would setup) and use previous perspective key to perfectly transition between "state of mind".

I really hope you will continue this feature, and look forward to some code to test! :)

kootenpv commented 7 years ago

@Bad-ptr Wondering if you had a chance to look at it :)?

mfiano commented 7 years ago

I'm having the same problems.

alphapapa commented 4 years ago

I've implemented something similar in Bufler: https://github.com/alphapapa/bufler.el