Fix 'command not found' errors for hidden commands

This commit is contained in:
Henrik Lissner 2019-07-22 04:46:14 +02:00
parent c24567a545
commit 1c4215c187
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
15 changed files with 120 additions and 106 deletions

View file

@ -8,14 +8,14 @@
;;;###autoload
(defun +tabbar-window-tab-list ()
(+tabbar-window-buffer-list))
(+tabbar-window-buffer-list-fn))
;;;###autoload
(defun +tabbar-window-buffer-list ()
(defun +tabbar-window-buffer-list-fn ()
(cl-delete-if-not #'buffer-live-p (window-parameter nil 'tabbar-buffers)))
;;;###autoload
(defun +tabbar-buffer-groups ()
(defun +tabbar-buffer-groups-fn ()
(list
(cond ((or (string-equal "*" (substring (buffer-name) 0 1))
(memq major-mode '(magit-process-mode
@ -53,11 +53,11 @@
;;; Advice
;;;###autoload
(defun +tabbar*kill-current-buffer (&rest _)
(defun +tabbar-kill-current-buffer-a (&rest _)
(+tabbar|remove-buffer))
;;;###autoload
(defun +tabbar*bury-buffer (orig-fn &rest args)
(defun +tabbar-bury-buffer-a (orig-fn &rest args)
(if centaur-tabs-mode
(let ((b (current-buffer)))
(apply orig-fn args)
@ -67,7 +67,7 @@
(apply orig-fn args)))
;;;###autoload
(defun +tabbar*kill-tab-maybe (tab)
(defun +tabbar-kill-tab-maybe-a (tab)
(let ((buffer (centaur-tabs-tab-value tab)))
(with-current-buffer buffer
;; `kill-current-buffer' is advised not to kill buffers visible in another
@ -80,7 +80,7 @@
;;; Hooks
;;;###autoload
(defun +tabbar|add-buffer ()
(defun +tabbar-add-buffer-h ()
(when (and centaur-tabs-mode
(doom-real-buffer-p (current-buffer)))
(let* ((this-buf (current-buffer))
@ -97,7 +97,7 @@
'tabbar-buffers (delete (current-buffer) (window-parameter nil 'tabbar-buffers)))))
;;;###autoload
(defun +tabbar|new-window ()
(defun +tabbar-new-window-h ()
(when centaur-tabs-mode
(unless (window-parameter nil 'tabbar-buffers)
(+tabbar|add-buffer))))
(+tabbar-add-buffer-h))))

View file

@ -7,22 +7,22 @@
centaur-tabs-set-bar 'left
centaur-tabs-set-modified-marker t)
(defun +tabbar|init-frames ()
(dolist (frame (frame-list))
(if (not centaur-tabs-mode)
(set-frame-parameter frame 'buffer-predicate (frame-parameter frame 'old-buffer-predicate))
(set-frame-parameter frame 'old-buffer-predicate (frame-parameter frame 'buffer-predicate))
(set-frame-parameter frame 'buffer-predicate #'+tabbar-buffer-predicate))))
(add-hook 'centaur-tabs-mode-hook #'+tabbar|init-frames)
(add-hook 'centaur-tabs-mode-hook
(defun +tabbar-init-frames-h ()
(dolist (frame (frame-list))
(if (not centaur-tabs-mode)
(set-frame-parameter frame 'buffer-predicate (frame-parameter frame 'old-buffer-predicate))
(set-frame-parameter frame 'old-buffer-predicate (frame-parameter frame 'buffer-predicate))
(set-frame-parameter frame 'buffer-predicate #'+tabbar-buffer-predicate)))))
(setq centaur-tabs-buffer-list-function #'+tabbar-window-buffer-list
centaur-tabs-buffer-groups-function #'+tabbar-buffer-groups)
(setq centaur-tabs-buffer-list-function #'+tabbar-window-buffer-list-fn
centaur-tabs-buffer-groups-function #'+tabbar-buffer-groups-fn)
(advice-add #'centaur-tabs-buffer-close-tab :override #'+tabbar*kill-tab-maybe)
(advice-add #'bury-buffer :around #'+tabbar*bury-buffer)
(advice-add #'kill-current-buffer :before #'+tabbar*kill-current-buffer)
(add-hook 'doom-switch-buffer-hook #'+tabbar|add-buffer)
(add-hook 'doom-switch-window-hook #'+tabbar|new-window)
(advice-add #'centaur-tabs-buffer-close-tab :override #'+tabbar-kill-tab-maybe-a)
(advice-add #'bury-buffer :around #'+tabbar-bury-buffer-a)
(advice-add #'kill-current-buffer :before #'+tabbar-kill-current-buffer-a)
(add-hook 'doom-switch-buffer-hook #'+tabbar-add-buffer-h)
(add-hook 'doom-switch-window-hook #'+tabbar-new-window-h)
(add-hook '+doom-dashboard-mode-hook #'centaur-tabs-local-mode)