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

[feature request] Specify tab names #204

Open
morgandavidson opened this issue Apr 7, 2023 · 0 comments
Open

[feature request] Specify tab names #204

morgandavidson opened this issue Apr 7, 2023 · 0 comments

Comments

@morgandavidson
Copy link

morgandavidson commented Apr 7, 2023

I have been using centaur-tabs for some time and have been quite happy with it. Thanks for providing this great package. Recently I started using denote, which is also a great package. Denote has the particularity of being based on an efficient file-naming scheme that produces long names, e.g.: 20230331T093543--name-of-the-org-file__firsttag_secondtag_thirdtag_fourthtag.org

So now that I use it I can only see one tab (max 2) on my Emacs window.

Hopefully, centaur-tabs-label-fixed-length can reduce file names. But applied to denote files, it makes the tab name unreadable. For example, with the value 9, the tab will show "20230331".

Would it be possible to have a centaur-tabs command allowing to change the name of a tab? That is only changing the tab name and keeping the file name and the buffer name unchanged. Like Tab Bars does with tab-rename.

Then some code could be used to specify tab names. e.g. specifying tab names with #+tabname::

(defun org-get-kw-value (kw)
  "Get the value of keyword KW."
  (save-excursion
    (goto-char (point-min))
    (let ((case-fold-search t))
      (re-search-forward (format "^#\\+%s:\\(.+\\)" kw) nil t)
      (when-let (kwval (match-string-no-properties 1))
        (string-trim kwval)))))

(defun my-org-hook-function ()
  "If keyword TABNAME exists, set tab-rename to its value."
  (when-let (new-tab-name (org-get-kw-value "tabname"))
    (tab-rename new-tab-name)))

(add-hook 'org-mode-hook #'my-org-hook-function)
@morgandavidson morgandavidson changed the title [feature request] Skip first 17 chars in tab name [feature request] Specify tab names Apr 15, 2023
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

No branches or pull requests

1 participant