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

Minibuf-X appears in Treesitter buffers #238

Open
Icy-Thought opened this issue Aug 15, 2024 · 2 comments
Open

Minibuf-X appears in Treesitter buffers #238

Icy-Thought opened this issue Aug 15, 2024 · 2 comments

Comments

@Icy-Thought
Copy link

Icy-Thought commented Aug 15, 2024

Something is not working properly within the (centaur-tabs-group-by-projectile-project) defun to such an extent that I am somehow able to see hidden buffers within Centaur-Tabs when inside a buffer that is using tree-sitter.

For testing purposes try the following snippet from my personal config: (relies on elpaca, modify as desired)

Note

If you only remove (centaur-tabs-group-by-projectile-project) from the equation, then the buffers won't appear; as expected.

(unless (<= emacs-major-version 29)
  (defvar elpaca-core-date (list (string-to-number (format-time-string "%Y%m%d")))))

(defvar elpaca-installer-version 0.7)
(defvar elpaca-directory (expand-file-name "var/elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
                              :ref nil :depth 1
                              :files (:defaults "elpaca-test.el" (:exclude "extensions"))
                              :build (:not elpaca--activate-package)))
(let* ((repo  (expand-file-name "elpaca/" elpaca-repos-directory))
       (build (expand-file-name "elpaca/" elpaca-builds-directory))
       (order (cdr elpaca-order))
       (default-directory repo))
  (add-to-list 'load-path (if (file-exists-p build) build repo))
  (unless (file-exists-p repo)
    (make-directory repo t)
    (when (< emacs-major-version 28) (require 'subr-x))
    (condition-case-unless-debug err
        (if-let ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
                 ((zerop (apply #'call-process `("git" nil ,buffer t "clone"
                                                 ,@(when-let ((depth (plist-get order :depth)))
                                                     (list (format "--depth=%d" depth) "--no-single-branch"))
                                                 ,(plist-get order :repo) ,repo))))
                 ((zerop (call-process "git" nil buffer t "checkout"
                                       (or (plist-get order :ref) "--"))))
                 (emacs (concat invocation-directory invocation-name))
                 ((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
                                       "--eval" "(byte-recompile-directory \".\" 0 'force)")))
                 ((require 'elpaca))
                 ((elpaca-generate-autoloads "elpaca" repo)))
            (progn (message "%s" (buffer-string)) (kill-buffer buffer))
          (error "%s" (with-current-buffer buffer (buffer-string))))
      ((error) (warn "%s" err) (delete-directory repo 'recursive))))
  (unless (require 'elpaca-autoloads nil t)
    (require 'elpaca)
    (elpaca-generate-autoloads "elpaca" repo)
    (load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))

(elpaca elpaca-use-package
  (elpaca-use-package-mode)
  (setq use-package-always-ensure t
        use-package-compute-statistics t))

(use-package centaur-tabs
  :preface
  (defun refresh-centaur-tabs ()
    "Fixes bar color of Centaur-Tabs."
    (centaur-tabs-mode -1)
    (centaur-tabs-mode 1)
    (centaur-tabs-headline-match))
  :hook (focus-in-hook . refresh-centaur-tabs)
  :init (centaur-tabs-mode t)
  :config
  (centaur-tabs-enable-buffer-reordering)
  (centaur-tabs-group-by-projectile-project)
  (setq x-underline-at-descent-line t))

(use-package treesit-auto
  :config
  (advice-add 'org-src-get-lang-mode
              :filter-return (lambda (mode)
                               (pcase (assoc mode major-mode-remap-alist)
                                 (`(,mode . ,ts-mode) ts-mode) (_ mode))))
  (treesit-auto-add-to-auto-mode-alist 'all)
  (global-treesit-auto-mode)
  :custom (treesit-auto-install nil)) ;; comes from nixpkgs

(use-package python-mode
  :mode ("\\.py\\'" . python-mode)
  :hook (python-mode . eglot-ensure)
  :custom
  (python-shell-interpreter "ipython")
  (python-shell-interpreter-args "--simple-prompt"))
@jcs090218
Copy link
Collaborator

I'll look into it!

@toyboot4e
Copy link

toyboot4e commented Sep 16, 2024

Cause: Mini* is grouped to the current projectile project:

(list (projectile-project-name)))

Workaround: add the following after line 424:

          ((string-equal " *" (substring (buffer-name) 0 2)) '("group-for-hiding-minibuffers"))

I think the original function centaur-tabs-buffer-groups is not handling the problem properly, either. I'll open another issue for that.

It calls centaur-tabs-get-group-name and *Mini buffer group name result in centaur-tabs-common-group-name, which is "Comman". If you're in a "Common" group buffer, you'll see *Mini buffers in the tab line. I guess *Mini buffers deserve their own group so that they are always hidden.

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

Successfully merging a pull request may close this issue.

3 participants