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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPC TAB switches to scratch buffer when using layouts #8879

Closed
dathinaios opened this issue May 10, 2017 · 6 comments
Closed

SPC TAB switches to scratch buffer when using layouts #8879

dathinaios opened this issue May 10, 2017 · 6 comments

Comments

@dathinaios
Copy link
Contributor

Description :octocat:

When using different layouts SPC Tab keeps switching to the scratch buffer instead of the last used one.

Reproduction guide 馃

  • Start Emacs
  • Use SPC l l to create a new layout
  • Use SPC f r to open some recent file [file 1]
  • Use SPC f r to open another file
  • Use SPC Tab to switch to the first one

Observed behaviour: 馃憖 馃挃
Switches to the scratch buffer

Expected behaviour: 鉂わ笍 馃槃
Should switch to [file 1]

System Info 馃捇

  • OS: darwin
  • Emacs: 25.1.1
  • Spacemacs: 0.200.9
  • Spacemacs branch: master (rev. 8e1af14)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: helm
  • Layers:
(yaml osx git org emacs-lisp html javascript ruby django nginx markdown ycmd supercollider
      (python :variables python-enable-yapf-format-on-save t)
      (auto-completion :variables auto-completion-enable-snippets-in-popup nil)
      (shell :variables shell-default-height 30 shell-default-position 'bottom)
      (syntax-checking :variables syntax-checking-enable-by-default nil)
      (spell-checking :variables spell-checking-enable-by-default t spell-checking-enable-auto-dictionary t =enable-flyspell-auto-completion= t))
  • System configuration features: NOTIFY ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS
@ddoherty03
Copy link

I second this comment with the observation that sometimes its not the scratch buffer that comes up.

I also notice that project files seem to get buried in the recent file list rather than being shown as open buffers when I use layouts.

@CeleritasCelery
Copy link
Contributor

This is because your recent files are part of another layout. They can only be part of one layout at a time. SPC b Tab only switches between buffers open in the current layout. Use SPC l a to add them to the current layout and this won't happen anymore. And yes, I agree this can be confusing.

@dathinaios
Copy link
Contributor Author

dathinaios commented May 18, 2017

Thank you @CeleritasCelery this helps. So what seems to be happening is that when a file has been opened before, opening it in a layout does not add it to that layout unless it is explicitly added with SPC l a. If on the other hand it has not been opened before it adds it to it. I would argue that this is inconsistent as it produces different results for the same series of actions. It trips up muscle memory and requires a different key command (SPC l a) based on non-obvious information.

There are so many ways of opening files in spacemacs and I use them interchangeably (SPC f r SPC p p SPC p f etc.). Isn't it right for spacemacs to make the assumption that if I am opening a file in a layout I want it in the layout?

@CeleritasCelery
Copy link
Contributor

CeleritasCelery commented May 18, 2017

@dathinaios I understand what your saying, I initially thought it was a bug too. But believe it or not, buffer isolation is a feature. if opening a buffer in a layer automatically added it to that layer, then all buffers would be essesntially global. There are some functions such as SPC s b that only operate on open buffers in the current layout. This also helps reduce buffer clutter from ones you are not currently using. The ablity to "peak" at a buffer from another layout, but not have it added to the current layout, can be a useful.

If you find that you are always trying to open buffers from other layouts, you should ask yourself if you would not be better off using the default layout, which has global scope. The way this is designed to work, you shouldn't have much need to share buffers between layouts as they should be conceptually distinct. Workspaces allow you to have different groups of window configurations but they all share the same buffers.

@dathinaios
Copy link
Contributor Author

@CeleritasCelery I see what you are saying. The isolation will then allow to batch run operations without inadvertently editing unrelated buffers.

Ok, that's quite fun :) I will give it a try. Now that I know what is going on maybe I will find this way of working to be better.

Thanks!

@CeleritasCelery
Copy link
Contributor

You may want to add a comment to #8587 about your confusion. And if you feel that you have the answers you need feel free to close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants