Git Product home page Git Product logo

Comments (7)

mclearc avatar mclearc commented on July 20, 2024

I think this is a function of how you set tab-bar-new-tab-choice. I have mine set to the scratch buffer. But if it is set to t then this is what happens:

If t, start a new tab with the current buffer, i.e. the buffer
that was current before calling the command that adds a new tab
(this is the same what make-frame does by default).

If that is what is going on here I'm not sure I want to make any changes in the code since I don't want to conflict with people's tab settings etc. But I can put something in the README about it. Can you try it with something other than t set and see if that fixes the issue?

from tabspaces.

aaronjensen avatar aaronjensen commented on July 20, 2024

Ah, yes, I do have that set to t. It works as you described. I can make use of that in my function. Thanks.

from tabspaces.

mclearc avatar mclearc commented on July 20, 2024

Great - thanks for raising the issue though. I'll put a note in the docs about this setting.

from tabspaces.

aaronjensen avatar aaronjensen commented on July 20, 2024

Hm, seems it is not so straight forward when using this, it does not include the current buffer initially in the buffer list. It gets there eventually though. I admit I don't fully understand the way the buffer list works. That said, I wonder if the current buffer should be included within tabspaces-create-workspace? If so, you might consider doing:

(defun tabspaces-open-existing-project-and-workspace ()
  "Open an existing project as its own workspace."
  (interactive)
  (let ((tab-bar-new-tab-choice (lambda () (call-interactively #'tabspaces-project-switch-project-open-file))))
    (tabspaces-create-workspace))
  (tab-bar-rename-tab (tabspaces--name-tab-by-project-or-default)))

from tabspaces.

mclearc avatar mclearc commented on July 20, 2024

Interestingly, this function doesn't work well for me (i.e. it doesn't show the buffer picked with tabspaces-project-switch-project-open-file initially in the buffer list, though it does open that buffer correctly). The old function works perfectly well. I suspect this may also be just a consult problem since the buffer list seems to update just using tabspaces-switch-to-buffer.

from tabspaces.

aaronjensen avatar aaronjensen commented on July 20, 2024

I don't think it's a consult problem. I think it doesn't get added to the buffer list until it is switched away from and it is initially filtered out by tabspaces-create-workspace. Try this:

(defun tabspaces-create-workspace (&optional arg)
  "Create a new tab/workspace with cleaned buffer lists.

ARG is directly passed to `tab-bar-new-tab'. Only buffers in
`tabspaces-include-buffers' are kept in the `buffer-list' and
`buried-buffer-list'."
  (interactive)
  (tab-bar-new-tab arg)
  ;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Current-Buffer.html
  ;; The current-tab uses `buffer-list' and `buried-buffer-list'.
  ;; A hidden tab keeps these as `wc-bl' and `wc-bbl'.
  (set-frame-parameter nil
                       'buffer-list
                       (seq-filter (lambda (buffer)
                                     (or (eq buffer (current-buffer))
                                         (member (buffer-name buffer)
                                                 tabspaces-include-buffers)))
                                   (frame-parameter nil 'buffer-list)))
  (set-frame-parameter nil
                       'buried-buffer-list
                       (seq-filter (lambda (buffer)
                                     (member (buffer-name buffer)
                                             tabspaces-include-buffers))
                                   (frame-parameter nil 'buried-buffer-list))))

from tabspaces.

aaronjensen avatar aaronjensen commented on July 20, 2024

The previous method only works coincidentally because your tab-bar-new-tab-choice happens to be in your tabspaces-include-buffers. (and the tabspaces-project-switch-project-open-file happens after the buffer-list is filtered, ensuring that the new buffer gets added to the buffer-list)

from tabspaces.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.