Repository navigation
Home
If using emacs-mac builds that supports native MacOS tabs which are treated as frames in emacs-mac, you can do this with the following advice when Bufferlo frame is created:
(setq bufferlo-prefer-local-buffers 'frames)
(advice-add #'bufferlo--make-frame :around
(defun my/bufferlo--in-mac-tabs (orig &rest r)
(when (eq bufferlo-prefer-local-buffers 'frames)
(let* ((mac-frame-tabbing t))
(apply orig r)))))To have the frame title set to the Bufferlo's frame bookmark name when loaded, use this advice:
(add-hook 'bufferlo-bookmark-frame-handler-functions
(defun my/bufferlo--set-frame-name (bookmark-name
effective-bookmark-name
new-frame-p
frame)
(set-frame-parameter frame 'name (concat "🐮 " bookmark-name))))If using Window Tab Line, you can limit the tab-line tabs that are shown with tab-line-tabs-buffer-group-function that limits to just the items in the Bufferlo frame's buffer-list, or the Bufferlo Local Buffers:
(defun my/tab-line-buffer-group-function (buffer)
(with-current-buffer buffer
(cond
;; *special* buffers* i want to front no matter bufferlo frame or not
((member (buffer-name)
'("*scratch*" "*Messages*" "*dashboard*" "*eww*"))
"All")
;; Bufferlo - just include buffers in the frame buffer list,
;; but filter out *special* buffers
((and (bound-and-true-p bufferlo-mode)
(frame-parameter nil 'bufferlo-bookmark-frame-name)
(bufferlo-local-buffer-p (current-buffer))
(not (string-prefix-p "*" (buffer-name))))
"All")
;; Non-local Bufferlo buffers
((and (bound-and-true-p bufferlo-mode)
(frame-parameter nil 'bufferlo-bookmark-frame-name)
(bufferlo-non-local-buffer-p (current-buffer))
(not (string-prefix-p "*" (buffer-name))))
"Bufferlo Non-Local")
;; I use eat...
((string-prefix-p "*eat" (buffer-name))
"Shells")
((string-prefix-p "*" (buffer-name)) "Others")
(t "All"))))
(setq tab-line-tabs-buffer-group-function #'my/tab-line-buffer-group-function)
;; tell tab-line to group buffers and only show the current group
(setq tab-line-tabs-function #'tab-line-tabs-buffer-groups)
If using Centaur Tabs, you can limit the tabs that are shown with centaur-tabs-buffer-groups-function that limits to just the items in the Bufferlo frame's buffer-list:
(defun my/centaur-tabs-buffer-groups ()
(list
(cond
;; *special* buffers* i want to front no matter bufferlo frame or not
((member (buffer-name)
'("*scratch*" "*Messages*" "*dashboard*" "*eww*"))
"All")
;; Bufferlo - just include buffers in the frame buffer list,
;;;; but filter out *special* buffers
((and (bound-and-true-p bufferlo-mode)
(frame-parameter nil 'bufferlo-bookmark-frame-name)
(bufferlo-local-buffer-p (current-buffer))
(not (string-prefix-p "*" (buffer-name))))
"All")
((and (bound-and-true-p bufferlo-mode)
(frame-parameter nil 'bufferlo-bookmark-frame-name)
(bufferlo-non-local-buffer-p (current-buffer))
(not (string-prefix-p "*" (buffer-name))))
"Bufferlo Non-Local")
((string-prefix-p "*" (buffer-name)) "Others")
(t "All"))))
(setq centaur-tabs-buffer-groups-function #'my/centaur-tabs-buffer-groups)The setting bufferlo-bookmark-inhibit-bookmark-point prevents buffer point from being included the bufferlo bookmark. This allows save-place-mode to restore the last visited point in the buffer list.
However, separately, the bookmark saves and restores window configuration that will save and restore window-point, placing their cursor at the position it had at bookmark save time, not the most-recently visited point of save-place. This snippet will make those visible windows for file buffers use save-place-mode to restore their cursor to the most recently visited point.
(defun my/bufferlo-restore-save-places (_bookmark-name
_effective-bookmark-name
_tab
_restored-buffer-names
_skipped-buffer-names)
"Re-apply save-place positions after a bufferlo tab bookmark load.
`bufferlo--bookmark-tab-handler' finishes with `window-state-put',
which sets each window's point from the window state saved in the
bookmark, clobbering the position save-place restored during
`find-file'. Runs on `bufferlo-bookmark-tab-handler-functions',
which fires after the window state is applied, with the restored
tab's windows live — so walking the window list covers exactly the
restored buffers, including any renamed by uniquify."
(when save-place-mode
(dolist (window (window-list nil 'no-minibuf))
(with-selected-window window
(when buffer-file-name
(save-place-find-file-hook))))))
(add-hook 'bufferlo-bookmark-tab-handler-functions
#'my/bufferlo-restore-save-places)