<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Tab-Bar on Emacs@ Dyerdwelling</title><image><url/><title>Tab-Bar on Emacs@ Dyerdwelling</title><link>https://www.emacs.dyerdwelling.family/tags/tab-bar/</link><width>32</width><height>32</height></image><link>https://www.emacs.dyerdwelling.family/tags/tab-bar/</link><description>Recent content in Tab-Bar on Emacs@ Dyerdwelling</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>captainflasmr@gmail.com (James Dyer)</managingEditor><webMaster>captainflasmr@gmail.com (James Dyer)</webMaster><lastBuildDate>Tue, 01 Oct 2024 09:50:00 +0100</lastBuildDate><atom:link href="https://www.emacs.dyerdwelling.family/tags/tab-bar/index.xml" rel="self" type="application/rss+xml"/><item><title>Syncing Tab Theme After Theme Load</title><link>https://www.emacs.dyerdwelling.family/emacs/20241001092329-emacs--syncing-tab-theme-after-theme-load/</link><pubDate>Tue, 01 Oct 2024 09:50:00 +0100</pubDate><author>James Dyer</author><guid>https://www.emacs.dyerdwelling.family/emacs/20241001092329-emacs--syncing-tab-theme-after-theme-load/</guid><description>&lt;p>Previously I wrote about the incompatibility of some Emacs themes with the tab-bar and my temporary fix:&lt;/p>
&lt;p>&lt;a href="https://www.emacs.dyerdwelling.family/emacs/20240817082349-emacs--syncing-tab-bar-to-theme/">Syncing Tab Bar To Theme&lt;/a>&lt;/p>
&lt;figure>&lt;img src="https://www.emacs.dyerdwelling.family/emacs/20241001092329-emacs--Syncing-Tab-Theme-After-Theme-Load.jpg" width="100%">
&lt;/figure>
&lt;p>The tab bar was introduced in Emacs 27.1, during which I created a function to apply some simple logic to make the tabs look moderately decent and fit in with the new theme. The only thing I couldn&amp;rsquo;t figure out was how to activate the function after a theme load, as there didn&amp;rsquo;t seem to be a hook.&lt;/p>
&lt;p>Well, actually there does seem to be such a hook and it seems to have gone into Emacs 29. As with a lot of these little tweaks I found this on reddit in the emacs subreddit:&lt;/p>
&lt;p>&lt;a href="https://www.reddit.com/r/emacs/comments/1ft3wwm/did_the_much_needed_theme_change_hook_arrive_with/">https://www.reddit.com/r/emacs/comments/1ft3wwm/did_the_much_needed_theme_change_hook_arrive_with/&lt;/a>&lt;/p>
&lt;p>From my previous post I wrote :&lt;/p>
&lt;blockquote>
&lt;p>Now that the &lt;code>defun&lt;/code> is available, how to activate it? My first thought was to add a hook for when a theme is loaded, but there doesn&amp;rsquo;t seem to be such a feature!? I also tried advising around `load-theme`, but that didn’t go well either, it worked for themes that were not loaded, but for those that were, a change in state was not detected, and the tab theme tweak was not applied.&lt;/p>
&lt;/blockquote>
&lt;p>The solution is to simply add the following to your init file. Now that I know about this, I might even find some other use for it.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(defun my/after-theme-loaded(theme)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (my/sync-tab-bar-to-theme))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>(add-hook &lt;span style="color:#e6db74">&amp;#39;enable-theme-functions&lt;/span> &lt;span style="color:#e6db74">&amp;#39;my/after-theme-loaded&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>with the original &lt;code>my/sync-tab-bar-to-theme&lt;/code> as follows:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(defun my/sync-tab-bar-to-theme ()
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#e6db74">&amp;#34;Synchronize tab-bar faces with the current theme.&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (interactive)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (let ((default-bg (face-background &lt;span style="color:#e6db74">&amp;#39;default&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (default-fg (face-foreground &lt;span style="color:#e6db74">&amp;#39;default&lt;/span>))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (inactive-fg (face-foreground &lt;span style="color:#e6db74">&amp;#39;mode-line-inactive&lt;/span>))) &lt;span style="color:#75715e">;; Fallback to mode-line-inactive&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> (custom-set-faces
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">`&lt;/span>(tab-bar ((&lt;span style="color:#66d9ef">t&lt;/span> (:inherit default :background &lt;span style="color:#f92672">,&lt;/span>default-bg :foreground &lt;span style="color:#f92672">,&lt;/span>default-fg))))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">`&lt;/span>(tab-bar-tab ((&lt;span style="color:#66d9ef">t&lt;/span> (:inherit default :background &lt;span style="color:#f92672">,&lt;/span>default-fg :foreground &lt;span style="color:#f92672">,&lt;/span>default-bg))))
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#f92672">`&lt;/span>(tab-bar-tab-inactive ((&lt;span style="color:#66d9ef">t&lt;/span> (:inherit default :background &lt;span style="color:#f92672">,&lt;/span>default-bg :foreground &lt;span style="color:#f92672">,&lt;/span>inactive-fg)))))))
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>My tab theme fix is now activated on every theme load, and I no longer have to rely on muscle memory to make Emacs look colour-coherent when changing themes, which I do a lot!! 😀&lt;/p></description></item><item><title>Winner Undo to Tab Bar History</title><link>https://www.emacs.dyerdwelling.family/emacs/20240114145517-emacs--winner-undo-to-tab-bar-history/</link><pubDate>Sat, 03 Feb 2024 10:56:00 +0000</pubDate><author>James Dyer</author><guid>https://www.emacs.dyerdwelling.family/emacs/20240114145517-emacs--winner-undo-to-tab-bar-history/</guid><description>&lt;p>Now I am using the &lt;code>tab-bar&lt;/code> workflow I noticed that &lt;code>winner-mode&lt;/code> was not working per tab in that the winner undo would return to the previous state of another tab, pretty annoying! 😕&lt;/p>
&lt;figure>&lt;img src="https://www.emacs.dyerdwelling.family/emacs/20240114145517-emacs--Winner-Undo-To-Tab-Bar-History.jpg" width="100%">
&lt;/figure>
&lt;p>But there is an easy fix, replace &lt;code>(winner-mode 1)&lt;/code> with &lt;code>(tab-bar-history-mode 1)&lt;/code>&lt;/p>
&lt;p>and for example I replaced my following keybindings:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(global-set-key (kbd &lt;span style="color:#e6db74">&amp;#34;M-u&amp;#34;&lt;/span>) &lt;span style="color:#e6db74">&amp;#39;winner-undo&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>(global-set-key (kbd &lt;span style="color:#e6db74">&amp;#34;M-i&amp;#34;&lt;/span>) &lt;span style="color:#e6db74">&amp;#39;winner-redo&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>with&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(global-set-key (kbd &lt;span style="color:#e6db74">&amp;#34;M-u&amp;#34;&lt;/span>) &lt;span style="color:#e6db74">&amp;#39;tab-bar-history-back&lt;/span>)
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>(global-set-key (kbd &lt;span style="color:#e6db74">&amp;#34;M-i&amp;#34;&lt;/span>) &lt;span style="color:#e6db74">&amp;#39;tab-bar-history-forward&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Ironically I had just been reading a related section in &lt;strong>Mastering Emacs&lt;/strong> and this configuration was recommended to avoid confusion and general vexation.&lt;/p>
&lt;p>I would also recommend increasing the number of tab bar history elements remembered, the default is 10 and I quickly found myself running out.&lt;/p>
&lt;p>Therefore I put in:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-elisp" data-lang="elisp">&lt;span style="display:flex;">&lt;span>(setq tab-bar-history-limit &lt;span style="color:#ae81ff">100&lt;/span>)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item></channel></rss>