Leverage org-roam-titles-cache for centaur-tabs org titles
This commit is contained in:
parent
6c89580e3e
commit
abc1a38e16
@ -2310,12 +2310,14 @@ UI-related keybindings:
|
|||||||
(centaur-tabs-mode)
|
(centaur-tabs-mode)
|
||||||
:config
|
:config
|
||||||
(centaur-tabs-group-by-projectile-project)
|
(centaur-tabs-group-by-projectile-project)
|
||||||
|
|
||||||
;; Only show tabs in buffers visiting files
|
;; Only show tabs in buffers visiting files
|
||||||
(advice-add 'centaur-tabs-line :around
|
(advice-add 'centaur-tabs-line :around
|
||||||
(lambda (oldfn &rest args)
|
(lambda (oldfn &rest args)
|
||||||
(if (buffer-file-name)
|
(if (buffer-file-name)
|
||||||
(apply oldfn args)
|
(apply oldfn args)
|
||||||
(setq header-line-format nil))))
|
(setq header-line-format nil))))
|
||||||
|
|
||||||
;; Enable prefix argument for tab switching keybindings
|
;; Enable prefix argument for tab switching keybindings
|
||||||
(advice-add 'centaur-tabs-forward :around
|
(advice-add 'centaur-tabs-forward :around
|
||||||
(lambda (oldfn &rest args)
|
(lambda (oldfn &rest args)
|
||||||
@ -2329,13 +2331,16 @@ UI-related keybindings:
|
|||||||
(dotimes (_ current-prefix-arg)
|
(dotimes (_ current-prefix-arg)
|
||||||
(apply oldfn args))
|
(apply oldfn args))
|
||||||
(apply oldfn args))))
|
(apply oldfn args))))
|
||||||
|
|
||||||
;; Use Org-mode titles for tab names when possible
|
;; Use Org-mode titles for tab names when possible
|
||||||
(advice-add 'centaur-tabs-buffer-tab-label :around
|
(advice-add 'centaur-tabs-buffer-tab-label :around
|
||||||
(lambda (oldfn tab &rest args)
|
(lambda (oldfn tab &rest args)
|
||||||
(if-let ((title (org-get-title
|
(if-let ((title (or (gethash (buffer-file-name (car tab))
|
||||||
(with-current-buffer (car tab)
|
org-roam-titles-cache)
|
||||||
(buffer-substring (point-min)
|
(org-get-title
|
||||||
(min (point-max) 200))))))
|
(with-current-buffer (car tab)
|
||||||
|
(buffer-substring (point-min)
|
||||||
|
(min (point-max) 200)))))))
|
||||||
(if (> centaur-tabs-label-fixed-length 0)
|
(if (> centaur-tabs-label-fixed-length 0)
|
||||||
(centaur-tabs-truncate-string centaur-tabs-label-fixed-length
|
(centaur-tabs-truncate-string centaur-tabs-label-fixed-length
|
||||||
(format " %s" title))
|
(format " %s" title))
|
||||||
|
Loading…
Reference in New Issue
Block a user