Skip to content

Commit

Permalink
Add: tab-bar support
Browse files Browse the repository at this point in the history
See #16.
  • Loading branch information
alphapapa committed Nov 7, 2020
1 parent f082af9 commit e23aa78
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion burly.el
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@
Functions are called with keyword arguments, currently including
`:name', the name of the bookmark. (Using `&allow-other-keys' is
recommended for forward compatibility.)"
:type 'hook)
:type 'hook
:options (list (when (featurep 'tab-bar)
'burly-tab-bar-select-or-new-tab)))

(defcustom burly-window-persistent-parameters
(list (cons 'burly-url 'writable)
Expand Down Expand Up @@ -386,6 +388,24 @@ URLOBJ should be a URL object as returned by
(bookmark-jump record)
(current-buffer))))

;;;;; Tabs

;; Support for Emacs 27+ `tab-bar-mode'.

(declare-function tab-bar-new-tab "ext:tab-bar")
(declare-function tab-bar-rename-tab "ext:tab-bar")

(when (featurep 'tab-bar)

(cl-defun burly-tab-bar-select-or-new-tab (&key name &allow-other-keys)
"Switch to an existing tab, or open a new tab, named NAME."
;; `tab-bar-select-tab-by-name' always returns nil, so we have to
;; use `tab-bar--tab-index-by-name' to check if such a tab exists.
(if (tab-bar--tab-index-by-name name)
(tab-bar-select-tab-by-name name)
(tab-bar-new-tab)
(tab-bar-rename-tab name))))

;;;;; Org buffers

;; We only require Org when compiling the file. At runtime, Org will
Expand Down

0 comments on commit e23aa78

Please sign in to comment.