Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to enter the nil perspective #5233

Closed
wants to merge 1 commit into from

Conversation

russell
Copy link
Contributor

@russell russell commented Feb 25, 2016

Some buffers end up in the nil perspective, this provides a way to
switch back to the nil perspective using the same mechanism that you
use to leave it.

@russell
Copy link
Contributor Author

russell commented Feb 25, 2016

This patch could possibly activate helm-mini on re-entry into the nil perspective? at the moment it just switches back to the perspective.

@bmag
Copy link
Collaborator

bmag commented Feb 25, 2016

FYI SPC l 1 switches to the nil perspective, so there is already a way to enter the nil perspective. But another way won't hurt.

:fuzzy-match helm-projectile-fuzzy-match
:mode-line helm-read-file-name-mode-line-string
:action '(("Switch to Project Perspective" .
(lambda (project)
(let ((persp-reset-windows-on-nil-window-conf t))
(persp-switch project)
(let ((projectile-completion-system 'helm))
(projectile-switch-project-by-name project)))))))
(when (not (equal project persp-nil-name))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use (unless ... instead of (when (not ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, too much python for me i think...

@TheBB
Copy link
Collaborator

TheBB commented Feb 25, 2016

Doesn't SPC l h switch to the nil perspective also?

@bmag
Copy link
Collaborator

bmag commented Feb 25, 2016

It does, somehow I missed it when looking at SPC l ? before...

Some buffers end up in the nil perspective, this provides a way to
switch back to the nil perspective using the same mechanism that you
use to leave it.
@russell
Copy link
Contributor Author

russell commented Feb 25, 2016

Ah yeah, i didn't find SPC l I think I was too busy looking with desc-bindings. Thanks, for the tip.

@russell
Copy link
Contributor Author

russell commented Feb 26, 2016

Ok, after some time to think about it, I believe that this patch could be better.

  1. It mixes perspective sources and projectile sources, so that means that when the different source provides different behaviour it's surprising to the user.
  2. If there are multiple perspectives, then it doesn't list them.

I have an alternative implementation below that instead of adding the nil perspective to the list, it adds in the spacemacs//helm-perspectives-source below the projectile source. Does this seem more reasonable? I think it would probably provide a better switching experience.

(defun spacemacs/helm-persp-switch-project (arg)
  (interactive "P")
  (helm
   :sources
   `(,(helm-build-in-buffer-source "Switch Project"
     :data (lambda ()
             (if (projectile-project-p)
                 (cons (abbreviate-file-name (projectile-project-root))
                       (projectile-relevant-known-projects))
               projectile-known-projects))
     :fuzzy-match helm-projectile-fuzzy-match
     :mode-line helm-read-file-name-mode-line-string
     :action '(("Switch to Project Perspective" .
                (lambda (project)
                  (let ((persp-reset-windows-on-nil-window-conf t))
                    (persp-switch project)
                    (let ((projectile-completion-system 'helm))
                      (projectile-switch-project-by-name project)))))))
     ,(spacemacs//helm-perspectives-source))
   :buffer "*Helm Projectile Layouts*"))
``

@github-actions
Copy link

This PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this PR is still need merging!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Sep 30, 2020
@github-actions github-actions bot closed this Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ☺ stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants