System Crafters Live! - The Hidden Value of Emacs' Tab Bar

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] so [Music] what's up everybody welcome to system crafters i'm david wilson and today we're back with another instance of the system crafters live series of streams where we get together as a community and chat about whatever uh interesting topic that i've concocted concocted for the week as i always tend to say and this week i actually have something worth talking about i think which is um showing off a little bit of the functionality for um let's see i need to fix this i'm trying something new today with uh this stream chat i don't know if it's even visible to read this but you get to see the army of david's again anyway yeah we're going to check out the um uh tab bar in emacs and see what kind of stuff we can make of it i don't know how to make the text bigger on this let's see text color font size can i increase that i wonder if it would do it live appenzell you have a good eye i am back on exwm that's true uh can i restart this somehow let's see ah yeah if i do that it's gonna expose the link this is not showing up very nicely is it a little bit of a behind-the-scenes look here i don't know if this is going to work [Music] because it's very like it doesn't show very much does it let me see if i extend this out there we go ah thank you carmichael 1197 for subscribing okay let's just put this here and see what it does let me know if the chat is hard to read like that as we go through because i'm i'm testing this new stuff out so so here's what i did um for a while i've been wanting to set up something like uh streamlabs on uh obs which is basically like a an overlay that you can load into obs to show things like you know notifications when people subscribe or when they give donations or even like a chat box like you see on the screen right now um and i was not able to use it before because the version of obs i had installed on geeks did not have the browser control because it's got like the chromium embedded framework and it's hard to get that to build in geeks well it may be hard to get to building geeks we spent like five minutes on it last week and didn't get any progress made but um i figured out that if you install obs via flat pack on geeks you do get the full browser control so i was finally able to set up streamlabs to get these overlays uh inside of the stream which is great because i don't have to take up part of my screen space to look at chat anymore i'll still be looking at it on my other screen here but at least you don't have to see it on the screen at the same time which is nice um let's see and anything else interesting to say about that not really i'm gonna try to experiment more with this stuff as time goes on because i think i could do some some cool stream integrations but for now it's going to be super basic and kind of janky with the sounds that you may hear from it so let me say hello to some folks here um i can't see everybody's messages but i see uh case elijah ninja uh rahul appenzell uh elia hyder uh pewter daigo uh pimak justin let's see who else block vitali raslov hider says whoa notifications yeah that sound might get annoying so let me know if it's too loud gon says calispera cali gavin says stump will miss you man uh yeah i um kind of got used to with the way things worked in exwm and it became a little bit limiting to me i think to have uh stump not really set up all the way so i just went back to exwm because i'm very comfortable with it she says i'm in the middle of tweaking with doom mode line that's cool hey phillip all right so yeah that the chat box thing is really annoying me because it's not that big i just keep like stretching it out it's our way to reach to make it refresh okay um yeah that's just a problem here i don't have two screens so i can't actually yeah i think it's going to expose me a little bit if i do that so let's just do this this is not what you expect to see at the beginning of the stream right jeez all right how about that uh let's see duncan says uh have you settled on a completion framework uh yes i um i've been using vertico for months now and i love vertigo i think it's great i don't really have any complaints with it um and also there's something recently that happened that i haven't covered on the channel yet which is uh vertigo got a number of extensions uh shipped along with the package for extra functionality that you might want so we'll take a look at that one day because i think that there's a lot of stuff in there that you're probably looking for if you came from ivy or helm so it's something you can just basically require the feature and just pull it into your configuration which is kind of nice so i need to do that myself because i've got some hacks that would be removed if i started using some of the vertical extensions so we'll talk about that one day for sure maybe pretty soon because it's worth talking about but yeah vertica is great i love it i need to get uh daniel midler on here to talk about it justin says inception let's see i don't know how to pronounce your name sorry uh but buenos diaz buenos dias anyway so updates so some of you may have seen uh this week i announced that my second youtube channel is now live it's called flux harmonic and it's basically the channel where i'm going to do more i guess freeform project work where i'm going to be doing live coding building tools for my various creative projects from scratch but i'm also going to be doing things like you know making music working on uh video editing more like techniques i won't i won't be doing actual video editing on the stream aside from just like you know testing out tools also like you know graphic design tools a lot of stuff that i kind of want to do personally and i've been thinking about them for a long time i just haven't had the time so i'm just going to make the time by doing two live streams per week about three hours each if i can stand it and see how that goes so if you want to follow that channel um you can actually go to uh http colon don't go to https because it doesn't work fluxharmonic.live it will take you right to the youtube channel soon whenever i get enough subscribers on the channel and everything goes the right way i'll be able to get like a custom url for the channel so you don't have to use the the uh the link that i just showed you but uh this is the channel just go there and give it a subscribe if you're interested to see the the streams uh the first one's gonna be next tuesday uh it's gonna be at 1 pm utc which is 3 p.m my time and it's like i want to say 6 a.m pacific time in the united states and 9am uh eastern standard time so that's a little bit early for the people in the u.s i apologize for that but that's like the only time frame that could work for me to actually do like a three-hour stream and also not conflict with work and family responsibilities so we're going to see how that goes for a while and um see if enough people are able to join and then i might try to adjust it later if things don't really work out at that time but i know there's a lot of people who watch this channel who are in uh in europe and asia the uk etc so i think there's plenty of people who should be able to make it around that time frame but let me know if it's overwhelmingly uh a bad time for people heath says nice chat integration yeah hopefully it's it continues working i don't know how it's going right now i'm trying to watch like a live feed of the video on the other screen i don't see chat messages very often so let's see crazy chicken says cool to see you use utc well whenever you have uh a an audience that's across the world you kind of have to use utc because if i say oh it's going to be at 9 00 a.m and people are like what 9 a.m yeah so kind of have to be flexible on that all right hello from siberia that's awesome all right so like i mentioned we're going to talk about the tab bar in emacs today um i made a video about this i want to say toward the beginning of this year um it seems like forever ago now but um it was mainly talking about um using tab bar and emacs 27 and just going through sort of the basics of how to use it but in the development of emacs 28 there's been a lot of new features added and some really interesting things that i don't know which things got added in 28 and or were already there in 27 but i know a lot of work has been done on tab bar mode so i figured it might be interesting to go back to it today and try to build an interesting configuration for it that could replace some of the things i'm already using other packages or programs for in my emacs configuration and see what kind of hidden value we can draw out of the new changes because a lot of stuff isn't really documented as far as i can tell i don't know if there's manual pages for it yet um so it's kind of like you have to you have to dig in the functions and variables to figure out how to use some of this stuff but that's part of the fun so that's what we're gonna try to do today crazy chicken says let's listen to temple os's god songs on harmonic i don't know that sounds like it would be it would make your ears bleed gavin says thanks for reminding me to set a custom url yeah those are kind of necessary because otherwise the uh youtube channel uh urls i don't know if you can see this in the bottom right hand side it's probably covered but they're they're awful in fact i'll just i'll copy that and paste it into the slide here just so you can see how ugly it is it's terrible well edge crusher says in australia in australia it's 2 40 a.m yeah uh in the uh what do you call that the the lower pacific what's what oceania i don't know what what do you call that part of the world uh it's extremely late uh in that part of the world it never really matches up there a friend of mine is in new zealand and um for them it's always like it's very strange how the time works there it's like the next day basically way farther ahead alexander says i'm from siberia too that's awesome good evening cast q3 i'm seeing the twitch messages from restreambot and uh sometimes it's hard to catch them because they have restream bot in front of it ah gavin says i don't know why it requires a c now actually it doesn't as far as i can tell because if i go to youtube.com systemcrafters it works so i think that that's um the sea thing was a temporary issue and now they fixed it so i don't know what to say about that hey eric asia pacific okay that's probably the right way to call that all right so um some of the things that i want to try today i want to try to customize the tabs tab display to show selection better okay so basically um well let's just turn it on i'm gonna go to another emac session because since i'm back in exwm i don't want to take everything down if things go wrong so uh i will drop uh let's see yeah so if you want to start tab bar mode and i guess let me roll back a couple steps and tell you what tab bar mode is first so um i'm sure you've seen plenty of editors text editors that have tabs for each file that you have open tab bar mode is not that there's actually a feature in emacs called tab line mode that gives you that functionality but tab bar mode is actually more like a workspace feature in emacs like a built-in workspace feature and basically what it does is gives you different window configurations that you can switch between so it's almost like having multiple workspaces where one workspace could have like one uh window emax window that's you know taking up the full screen and the next tab could have you know split windows in certain configurations and you can switch back and forth between those very easily and typically you would use this type of thing for maybe you have all your irc chats in one tab you have your you know various projects you're working on in their own individual tabs to keep them separated and it's a good way to um kind of keep your workflow clean so that whenever you need to go do some other tasks you can just create a new tab to have your own window configuration there without all the other clutter from the other configurations so uh you can use the tab bar mode uh command with meta x to turn that on and interestingly it's not actually oh there it goes all right so you can see now there's this little tab that shows up in the top right left-hand corner of the screen and um it just basically says what the current buffer is so if i were to go open up another file like let's say uh e max profiles yes you can see now that the tab here has a change to have the file name in it now the the funny thing about this is that you can't really tell that it's a different piece of ui because um it's not colored in a way that stands out so if i were to create a new tab with the tab bar i think new tab command you've got two tabs now and you can't really distinguish between them whenever you select between them you can kind of tell that the uh the font lights up to like a slightly brighter color but uh it's not really hard it's not really easy to tell so i want to kind of try to customize that a little bit to make it stand out better and see if we can uh make it um sorry i got distracted by the chat uh see if we can make it uh uh more attractive and and sort of eye-catching so you can easily tell which tab is selected jordan says hello from montana that's awesome uh gavin says same i didn't like tabs and vim but i could see the value in emacs since i use emacs for much more than i'd ever use a single vim session yeah really you kind of need to uh um with them i guess you just sort of like you know have one thing going on at the same time because it's very minimal experience but uh with emacs yeah you typically are doing way too many things in emacs gon says is that comparable to layouts um well i'm not sure which layouts we're talking about to be honest i'm trying to adjust this position of this i think it's cutting off text a little bit there we go hello everyone system crafters rocks thanks minas mazar whoops i moved the wrong part of the screen all right move ah come on chat widget it's not easy to do with a touch pad i'm wasting time here there we go i should have clicked it first boom okay that should be better uh elia says do we have an after stream way of chatting yeah go to uh the links in the pinned message in the youtube chat um there's a link to systemcrappers.chat and it's got information on the wiki now i i should say i keep getting uh notified by people that the uh the wiki website for systemcrafters.net has a certificate issue so if you go to the site there and you see that it complains about the certificate don't be afraid just go ahead and click through it the problem is that i'm using github pages for hosting that site and uh for some reason just for that specific site they're having a problem with renewing the certificate so it's just expired right now i need to contact support and get them to fix that but uh eventually it'll get fixed gone says uh spacemax has space l to go to a layout like perspective grouping buffers interesting yep maybe that's uh maybe that's what's happening don are you also on twitch yes twitch.tv systemcrafters i'm streaming there right now actually carmichael says i've been using vim plus tmux for years and i'm currently migrating to emacs plus evo loving it so far uh that's great yeah emacs is fun i don't know i've used vim plus t-mux for a while and um it's cool i think that the advantage of it is that is you know you've got various different tools you can pull into it and since you know tmux is really just sort of multiplexing various terminal programs you can use whatever terminal programs you want in there but you do not have the level of integration between things in tmux with other terminal programs as you do with uh with emacs and emacs works pretty well in the terminal and also has screen like functionality so i don't know i think uh it's it's worthwhile to use emacs if you are a person who's been using um them plus team bucks in the past sam says i usually inherit doom mode line panel to tab bar tab to stand out the current tab color yeah that's basically what i was thinking about doing so we might go ahead with your uh suggestion there sam thank you uh felipe says emac's own tab bar mode has ctrl x t ret to show a list of workspaces uh tab bar mode is a really dumb name for the future yeah tab bar mode is very misleading as a name because the first thing you think of like i said is file tabs and not something else but i don't know i mean the visual metaphor here is tabs so i guess that's why they did it but um it really is more like a workspace metaphor i think so control x return hello control xt return gives you the list of tabs yeah that's right bernard says as far as i can tell tab bar mode is just a way to store multiple window layouts that you can switch between but buffers aren't isolated yes that's another problem that i want to try to solve today so let me actually go back to my uh my notes here so there's another feature that i want to experiment with called tab groups i think this is something new i have not actually tried it before but the idea is that you should be able to group your tabs your workspace tabs by some factor i guess i don't know like you just create a new tab in the current group i'm not sure what the usefulness of that will be but we can try it out and see where it makes sense to be used um so yeah we'll try that out also setting the tab bar format this is kind of interesting there's a variable called tab bar format which controls how the tabs get displayed but it actually has a kind of a secret feature which is that in this area on the right side you can actually display arbitrary text including the global part of the mode line so instead of displaying the global part of the mode line which i don't know which parts of it right now would be considered part of that but you can basically move that up here to always have it visible so one thing i don't like about having like let's say the current clock time or the battery status in the mode line is that it only gets shown on the active window a lot of times but in theory we can move it up here so it's always visible and it's always in the same place so that's kind of a cool little feature that could replace the use of a panel if you're using exwm as your window manager so i want to try that out and see how it looks sam says centaur tabs is old or at least pre-built uh built before tab bar and used to do exactly this grouping by project or by other factors yeah um it could be useful i have not yet um seeing what that's gonna look like but we're gonna find out today uh what else whoops let's see openproject.el projects in new tabs i think we've covered recently a package that would allow you to do this but i think it's actually very simple uh to do this without any external package so i've got a theory on this that we can try out in a little while as well writing a function to show only desired buffers for a given tab there's a few different ways to do this i want to try to do it in a very cheap way that doesn't require us to write our own buffer management code i think i have an idea in mind that could work for a few of the cases that i care about so uh that that might be useful and also does it work with desktop save mode people in the chat may already know the answer to this but um it'll be interesting to find out whether um you can actually save the open set of tabs to your desktop state whenever you close emacs and then when you reopen it be able to load this back up again uh gavin says doesn't emax28 also offer a global mode line header can't remember which it was let's see i don't know okay tab line mode no i i thought that is what this basically does you might be able to pull it up in a header uh thing but i'm not sure let's see emacs 28 global mode line emacs has a global mode line what is this five months ago uh this must be similar to what i'm showing i think this is pcal's website tab yes this is the same thing tab bar format so basically if you set that up then you get basically what amounts to a global mode line so that's what we're going to do yeah and if in fact you can basically abuse the tab bar feature and just throw tabs away entirely don't even show tabs and only show that string so that's basically what philip is showing here which is pretty interesting all right so let's get to it first of all let's try to customize the tab display uh to show a better color and since i'm using doom mode line uh and doom themes in general i think that that is a good place to pull a color from because it would be nice to pull a color like maybe this one down here i don't know if you can see where my cursor is going but basically the leftmost part of the mode line has its own color there and sam said before that there was one called i think doom mode line panel if i'm not mistaken so let's see um i'm going to call up describe face base uh doom mode line panel yeah that looks right so you can basically uh take this color which is a light blue with a darker text on front and inherit that um that color or the sort of basically set the face to inherit the color so describe face tab bar [Music] tab yeah i think it's tab bar tab so there's inactive which is the one that's not currently selected but i think tab bar tab must be the currently selected one so what we can try to do let me go into um let's see config bear config.yel okay so let's do this set face attribute i think we're going to set a tab bar tab now i need to check out how to set up inheritance on this face frame okay so i think it's just uh inherit uh doom mode line panel the wrong argument type frame live p oh i gotta put in uh nil here i think all right so it didn't do anything yet let's actually change these hmm ah we got some spammers up in the chat here see spam okay so let's see uh osmania says uh have have been using else screen for a while is that is this a different use case i'm not sure i haven't actually used l screens i'm not sure exactly what the use case for that one is it might be similar though hi nicholas uh jordan says emacs demons plus tab bar plus perspectives plus projectile plus tree max um or at least until perspectives work with tab bar okay i'm guessing that's the t-mux replacement all right so this is not working yet maybe i should uh turn off tab bar mode and turn it back on again okay so that didn't work either let's go back and check the face list nice all right tab bar tab bar face that's definitely the right one tab bar face for selected tab tab bar tab right that's what i said all right so how about this um emacs uh inherit face let's see if there's a nice programmatic way to do that how i can correctly inherit from multiple faces custom set attributes yeah you could do that base attributes you get the zoom of this uh text in the browser setup right inherit the name of a face from which to inherit attributes or a list of face names if face to inherit is from unspecified is treated the same as nil never merges inherit attributes okay that's interesting i would have thought this would work let me see um i wonder if i do that at all in my own configuration i can't remember inherit oh yeah there we go so that's basically the same thing right if i were to go back to [Music] this run it again and then check describe face tab bar tab yeah it's not doing anything is it sam says custom face uh tab bar tab t um is that uh in use package doom mode line panel four grand nil weight dimmable okay that's basically what you're using there let's see it's actually set to inherit doom mode line panel okay ah that's probably it i need to actually remove the other parts so let's do this foreground nil background nil there we go okay so it was really just a matter of clearing out the other face attributes first so inherit and then clear out foreground and background and now we can see that let's see i think it's uh control xt uh what in yeah oh no that's new control xtk i'll kill that no ctrl xt um so control xt 0 close the tab and then uh it's ctrl x t o to move the next tab okay so control x t 0 control x t uh oh okay so you can see that we actually do have a nice uh color here that uh shows up because we're basically just inheriting that existing um base so if we were to change our doom whoops if we were to change our uh theme so let's say instead of doom snazzy well let's see consult theme or change this to let's say um nord uh this actually does change also which is pretty cool so let's change it again so pale night yeah that that one's not what pale night that was not very interesting let's try that again yeah okay that does actually work whenever you reevaluate it you may have to do that sometimes console theme let's go back to snazzy that's that's kind of a nice theme okay ah don says can you explain a little bit about faces that's a good point one second let me see if i can turn on key cast mode here conspi okay it's not working so um if you don't know what faces are in emacs basically it's just how emacs decides how to display text that goes on the screen so um what you see here is that we're actually setting four back foreground and background colors for this particular element on the screen and there's a lot of other things you could do like the border around something or maybe like a shadow or there's all kinds of settings you can set in fact if you use the describe face command and then load up let's say tab or tab it gives you a bunch of information about the different properties that you can set on a face to change how it looks you can change the the font face so if you want to use a different font you can do that uh strike through text underline i don't know what a distant foreground is but that's something you can do you can make it italic you can change the width and the height of the text so you can do a lot of things to change how text looks by setting face attributes and the easiest way to do that is use the set face attribute function and give it the face you want to change the symbol form of the face you want to change and also nil usually you want to put as the second parameter there and then everything after that is basically just setting the particular properties for the face that you're changing and that typically takes place immediately if you set that correctly with this function then you'll see a change to the element uh necessary and also describe face with a good completion system like vertica or iv you can easily figure out what faces are um active in emacs so you can figure out which one you're trying to change so let's say you want to change um let's see perspective name yeah that's not really a good a good example let's see font lock string face so if you want to change like how text is highlighted you can change some of these faces let's see the default face controls the the background color and the main text color in emacs that's another thing you can change if you wanted to try to tweak things individually so it gives you a way to um change the uh display attributes of certain things that show up in emacs if you want to do that so that's what basically what we're doing here is we're just changing how tabs look gavin says you should clip this and make it into a short that's a great idea actually i need to be doing more of that so yeah i think eventually i need to make a video on faces and it's probably something i'll get into this year but i'm talking about um basically learning how to configure emacs from scratch but not with external packages so we just try to like write emacs list so we'll cover it then i think okay uh gon says are these buffer specific variables i don't think faces are buffer specific but it seems that they can be frame specific so you might be able to change the base of something in the current frame only and not in all frames if you go to the documentation of set face attribute uh it says that frame is the second parameter if frame is nil set the attributes for all existing frames as well as the default for new frames is frame as t change the default for new frames only i would guess you could pass an actual frame in there also but it seems to give you some flexibility if you don't want to affect your current frame but you only want to affect new frames after that gone says what about syntax highlighting um well that's what all those uh let me run describe face again if you look at uh font dash lock dash then you see all of the faces that are used for emacs built-in font locking system which is basically how syntax highlighting works um so that that allows you to change the colors but to actually affect how syntax for particular language is highlighted you would have to go edit the package that defines the syntax uh grammar basically for the language it's not really a grammar per se it's more like just a bunch of regular expressions that know how to identify various elements in the syntax you've heard a lot of people probably talk about tree sitter which is a different thing entirely which actually knows how to parse the actual syntax tree of a particular language and highlight it more effectively but that that does not come in emacs yet so uh not something that you can use without installing a package hey anders duncan says i wrote a syntax highlighting package for a monte carlo input format in a weekend learned all about faces and font lock uh yeah i've tried writing a syntax definition basically tried to copy some existing stuff to make it work um i think to do a good job at that it would take a lot of effort but um it's definitely one of those areas that you max if you dive deeply into it you probably could do some really cool stuff felipe says i've been using tab bar mode with tab bar show set to nil a visual tab bar by default has scared the few emax users i've shown the feature to uh while having named window configurations just clicks yeah that's definitely another thing that you can keep in mind if you don't want to see these tabs i believe tab bar show is a variable you can set to nil if you don't want to show it and then it just won't show up at all um let's see is there any extra stuff you can uh set here if t default is if t enable tab bar mode automatically when using see this is actually not 100 what you think it's supposed to be i think if i remember correctly uh show it automatically upon using the commands to create new window configurations if a non-negative integer show the tab bar only if the number of tabs exceeds the value of this variable which is kind of nice if you don't have multiple tabs in most of your frames it doesn't show the bar uh let's see and show it again once more tabs are created a value that is a non-negative integer also makes a tab bar appearance be different on different frames that's useful in my opinion the tab bar can be shown on some frames and hidden on others depending on how many tab bar tabs are on that frame and whether that number is greater than numerical value of this variable if nil always keep it hidden in this case it's still possible to use persistent named window configurations by relying on the keyboard commands i think also with doom mode line you can have the name of the current tab show up in the mode line as well so you can see which uh window configure currently in without having to um show the tab bar if you don't want to do that so that's a good point though to to make their felipe thank you see elia asks something stump wm mode hey noble and savage okay so let's jump back into it uh and by the way i'm gonna make this this uh configuration we work on today available in the show notes uh at the end of the stream in case you want to play around with it also uh so maybe we'll just uh do this as well so set cue tab bar show i want to set that to 2 because i don't want to see the tab bar unless there's two tabs so i'll evaluate that i'll only show the tab bar if there are two or more tabs um inherit the face of a doom mode line panel for better appearance maybe i should play around with that a little bit more too there's there's another thing we can talk about there so now if i were to close this first tab here uh let's see ctrl x t o then the tab list goes away as you can see but if i were to use the um control xtn to create a new tab oh did it not work what's happening here there we go oh okay i think that it has to be greater than that number so maybe it actually needs to be set to uh one instead so i will go ahead and kill that and that and then i'm gonna go back to config.el i'll set this to one because that's actually what i want it to be all right so now if i were to use control xtn it will create a new tab if i use to use control xt 0 to kill that tab then it will hide the tab bar again so um if you're using exwm this could be really helpful because on some of your exwm workspaces which are their own individual frames maybe you don't have any tabs set up there and you don't want to see the tab line but on the particular workspace where exwm workspace where you have multiple tabs you actually do want to see the tab line so that actually could be pretty useful there uh tamas says i wonder if you can set a face by the name of the face that would simplify figuring out a good attribute combinations for a face that's possible tamas says by default you can set certain face attributes on arbitrary text in a buffer oh that's cool uh what's k saying yeah okay yeah case was basically saying the same thing that i had to to figure out uh whenever i was just stumbling around that's what meta o is for yeah i uh hold on a second meta o is undefined maybe that's because of uh them or evil mode uh control hk meta ah come on all right what happened here control control h k come on control g get me out control h k meta o undefined on my on my uh system here get that k out of there noble says i have a dream i make a config that makes emacs look like vs code just to sharp the button clickers well um people have done that you should take a look on reddit i think there's a few posts about it uh gone says youtube teaser says tab bar feature in emacs 28 yeah it is in 27 but there's new things added in 28. all right so another thing there's a few other things that are interesting about the display of tabs in fact let me set this back to zero so we can see it all the time and then we're gonna go look at the tab bar format that's not right i think it's the tab name format functions there's actually um a lot of configuration capability here to change the way that tabs are displayed so uh tab bar tab name format default is the default function for this not documented um there's a lot of code in here actually which okay actually it's just this part here so we're propertizing a string of tab bar tab hints a list get okay so we have the tab information that's probably the index of the tab the uh the i variable there tab bar okay so you can basically override everything about how a tab bar tab is displayed so let's see if we could do that really quickly i'm going to close that window out i'm going to go back to let's say control xt in let's just get a new tab here go back to config.el um defun uh let's see uh my slash tab bar format and we need to take in a tab and an i and then let's see what else are they doing there is it just returning text it seems propertized text so we can go just you know bare minimum we can grab the tab name with a list get and just return that if we wanted to i really need to get lisby up in here all right so i can eval that then i can also um use set q and what we'll see man i keep trying to hit my own personal key bindings and it doesn't work here tab bar tab name format function let me grab this um let's see right once again hitting the wrong keys i need to put my custom geez i need to put my custom key bindings in here all right so uh tab format function i'm going to set this to my oops my slash tab bar format fomat i'll eval that and now all of a sudden um the text seems to have disappeared but it hasn't actually disappeared you just can't see it because it hasn't been propertized correctly uh andre says rainbow tab colors yeah that's possible hey uh fade all right so um to make it visible we need to actually show something uh or you know make it propertized that it shows up correctly so i think what we can use is this proper type propertize why is this not working geez uh proper ties function so if you don't know about proper ties it's actually a way to take a string and set face properties on it and in this case i think what we're gonna do is oh tab bar tab face functions that's actually interesting too there's another way to just customize only getting the face of the tab so we could change that to and not use the previous method we were using but let's try this first so we're going to propertize the string so we're going to take the name here we're going to use proper ties and then just take the string we're going to say face here i think that's the right way to do that and can i just give it doom mode line panel directly i don't recommend doing it this way because it's a little bit weird but it is possible all right so does it does it work that's the biggest question okay yeah that worked so by default it's setting the property the prop the text properties of sorry i'm hearing noises that was weird anyway it's setting the text properties of um the tabs to whatever we put into properties here and as you can see both of them seem to be highlighted so that function that we saw before must actually have something to see whether it's uh i guess this must be the tab bar tab face function so we were to look at the documentation or the definition of that tab bar tab face function um this tab bar tab face default tab or tab face default and it's basically just a little bit of an if statement that says if it's the current tab return tab bar tab otherwise turn return tab bar inactive so uh you would have the ability to set rainbow tab colors as under suggested by customizing this tab bar tab face function and just returning whatever face you wanted i don't know if there's a way to randomly pick a face in emacs but if you wanted to get really weird you could certainly have a function that just returns a random face and then your uh your tabs look really weird i'm not going to try that right now because too much work hey milner okay so that was all nice and fun but we don't really need to do things that way um because well okay i guess really the other thing that would be useful here is uh setting other stuff on it so let's say format uh let's see i think it formats right isn't it that's a function format string rest objects okay uh what is a syntax for that i always forget ah that's it so percent s i can do this i can put whatever text in here i want to make it have like let's say a little um arrow in front controlling control e and then it gets added to that because every time this function gets called to redisplay the tabs you have this uh little thing there so if you wanted to use that as part of wiki's display when a tab is selected you could do it in fact if we go back and look at this all right let me actually just grab this little piece of code here so i can say let's just build this up uh progressively concat here i can say uh if and then drop that logic in and then uh if it's true i'm going to say little arrow there with a percent s nah i have to do that let's do like this otherwise return an empty string okay and then i'll say percent s here and that should close out the concat now if i were to delete that piece and drop it right here i won't let me format that's lame let's see let's take that part out i'll put that there indent that a little bit and did that a little bit i really need to get uh annotation working correctly here okay so that format should work so now if i eval that um yeah only the selected one gets it oh i need to add an extra space in okay so now the selected tab has the little uh greater than symbol in front and the the non-selected tab does not so that's one way you could set that uh karthik says i like to put a box around the active tab name that's actually a good idea so what if we do let's see with proper ties can i just set the properties directly let's take a look at the let me get this out of the way here propertize functionality look at the text properties documentation so it's just properties right i could do that so if instead of using doom mode line panel um let's pull up special properties format properties okay i'm pressing enter why aren't you letting me go to that there we go no that's not the one examining properties property search probably not the right place up nah gon says might as well cram some of the mode line icons into the tab that is uh something i want to try in a second whoa that's not what i'm looking for hey let's go back to this page because that one actually had what i was looking for so box was it like box or something whether a box should be drawn around the characters uh t draw a box with lines of width one let's try that real quick so i want to do foreground let's just make it white whoops and that's uh the hex code for white and also box was it t yeah let's put box t let's see if this works i don't know if it's gonna work uh no i must have crashed it somehow maybe i should take the face out obviously my proper ties foo is uh failing me right now i've used this before somewhere karateka if you remember the right uh syntax for proper ties to make the property show up then that would be helpful [Music] okay let me see there's a way to set the line with in the color if you want to up faces attribute functions it's privatizing here no i'm already here i guess text properties for more information changing properties format properties come on yeah i looked that one before it didn't work changing properties put property text add text properties properties here we go properties foo face italic mouse face oh is that what it is you do it this way so far it's not showing me anything let me show up in messages saying that i made a huge mistake not complaining is it so let's just drop this back to the default just in case hey simon so that was um tab bar uh tab name format default tab bar tab name format default tab bar mode disabled enabled okay so maybe i just broke something before let's try this again okay that did not work but maybe if i were to put this back it would work something i did it did not like ah okay definitely doing something wrong different properties in different parts of the string you can trust construct a part with properties face italic uh you know what is that what it is base and then you gotta put like the whole p list afterward come on stop let's restart tab our mode just in case no didn't work we're not going to rat hole in this very much longer sometimes you can wrap it twice don't ask me why i don't know oh there it goes okay so that worked so now i can actually check whether let's see it's append sequences okay so concatenate all the arguments and make the result a list that's sequences right so i can just use append here i can start with that and here i can use the same if logic as i used here before i know this is not really the right way to do this but you know we're just doing it as a as an exercise better to change the face format function but uh let's see so if uh equal car tab then we want to return a list containing box t otherwise we're just gonna return an empty list so that will just append nothing at the end make sure we got the right stuff here there we go there we go i think it needs to be um oh hold on so let's do that i think we need an outer list as well so this just depends these two but i also need to have it be wrapped in a list [Music] all right let's make sure that we're matching things up correctly list so that append is not lining up append if pinned okay that's right list okay that looks good terrible indentation awful okay so now um yeah it seems to work so if i were to to select let's see control x t o yeah so now we get an outline and a little arrow at the beginning of the string so you have full control over how that looks which is kind of nice uh tomas says just put the if around the value of the box yeah that that also is definitely something i could do there so let's move on from that because that was fun but you know that's not really what we're here for let's see uh totally customize the format of the tab bar name replace the default that bar function did i just mute the audio yes i did alrighty so next thing let me actually go check my list of stuff that i wanted to try i think i wanted to try uh tab bar groups oh emojis let me try putting an emoji in there really quickly just for fun real fast um there's some new ability to display emoji selections i think is that right oh wrong emacs let's go no emacs that one so is there a command for this i don't want to use a mojify i want to use whatever is built into emacs if anybody remembers that key binding for uh displaying the emojis that would be helpful i don't know if it actually um it was something that is built in or if lars just says that someone had worked on it and it's not actually merged yet uh but you know what here we go um [Music] buyer emoji let's just copy and paste it and see if it works uh if i think i mentioned this maybe last week or the week before last but emacs now has the ability in emacs 28 to display emoji characters correctly which it didn't actually color emoji characters correctly which it did not have in the past um if you can believe it but now you can see i actually just pasted in that fire emoji and it did show up correctly so i'll re-eval that function and i will uh re-eval this function as well and now you can see i actually have an emoji here so you can put whatever you want in the format um so that's kind of cool you have fire emoji as your selected icon control x8e control x8e yeah it's undefined for me i wonder if the build of emacs i have doesn't actually have it sam says i think it's emacs 29 yeah you're probably right cx8 return ah that looks right so they have the the imp emoji okay there you go so that's control x8 return and uh it doesn't seem to allow me to search all of them effectively but that may just be a matter of oh it doesn't show all of them but that's probably just a matter of my uh my font not hammering everything so praying hands can i look for that prayer beads pr hands i don't know oh there we go pray [Music] hands there's your handshake all right there we go person with folded hands there's a praying hands emoji okay anyway that was all we needed to say about that so tab groups let's try that out really quickly uh k says i use control x8 return all the dang time it's great yeah i keep forgetting that exists okay so let's move on to tab groups so let's see tab bar group so let's see move tab to group change tab group so what if i run tab bar change tab group group name for tab um i don't know config what's it doing nothing so i don't know let's look at uh control x t and then use control h to pull up the the um commands in that prefix tab group so control control xt capital g control x t capital g gives you group name for tab so what if i go and create a new tab control x t n and then i call this ctrl x t capital g um another very very uh great naming here i can't really tell what the group name is by looking at this but let's see um so tab group okay tab group tab close group tab bar close group tabs move to habit group change tab group so if i go to another all right i need to change which buffer i'm looking at here because obviously this is not helping we'll go to the messages buffer here we'll go to the let's see emacsprofiles.el there so if i look at tab bar group as a variable name it doesn't actually tell me anything bar group function that's something we should look at in a little bit um so if i were to use that function again uh tab bar change tab group i choose another tab our change sub group another okay i don't know what's going on here let's try this again what about because i think that one of them was supposed to be called something else leave blank to remove group okay so i remove the group there um so far i'm not exactly sure what value they have aside okay control xtn clones the tab it doesn't make a new one okay that makes sense control xt um tab new is ctrl x t2 control xt 2 and we'll open up the info buffer on that one so if i were to use tab group close group those all tabs group name another that does allow you to easily close all of them of the same group but um is there a way to switch between ones of the current group tab oops tab group change tab group add the tab specified by its absolute position to tab number or to group name close all tabs relocate tab closer to his group that's the way you can gather them together i guess which is kind of nice so let's say rlxt to control xt to control xt2 all right so here i've got that window config this one i'm going to say let's call it another that's fine let's go to another tab here let's go to another buffer here another buffer here so i think these two are another let's make this one another i guess and this one should be nothing so what if i run um tab bar group [Music] move tab bar to group what's it doing nothing okay let's uh maybe move to this tab and try that again it doesn't do anything how about this one yeah i'm not sure it's actually doing what i think it's supposed to be doing anyway so far i'm not convinced about that particular thing i don't know if it's just like a matter of me not figuring out the right usage pattern for it but so far why is all x not working ab bar group change tab group close group tabs i mean that thing actually did work so yeah i don't know what's happening or maybe it did work and i just didn't notice it but uh yeah tab groups could be useful maybe we could figure it out um in the chat at some point says i hope it's still ugly and didn't miss the cool stuff yeah we're you know we're still working on it let's see samuel jackson says is there a way to set new tabs to prompt for a name before being created i really really dislike auto named tabs good question let's see there's a lot of fun stuff hiding in um tab bar so if you actually uh look for any variable named tab bar function with those you know words in the name there's a lot of stuff in here for customization so something like uh post open functions uh tab bar and tab name function which we already did customize before oh wait so the tab format is one thing the tab bar tab name function is a different thing entirely so the choice between displaying only the name of the current buffer in the tab name or displaying the names of all buffers from all woo all windows so tab bar tab name current generate tab name from the buffer of the selected window i wonder if this is called dynamically or if it's something that's called only whenever it's first open jordan says you can rename tabs yes that's definitely the case but i wonder about uh being able to control the naming as they get created tab bar function let's see tap group format function prevent close function that's actually interesting you can make sure that you don't close any tabs that you don't want to there's also i guess post change group functions wouldn't that just be a hook unless it filters somehow so uh let's see was it tab name function let's see let's change that really quickly and see what happens i'm curious so set cue tab bar tab name function let's just give it a lambda what does it expect okay so it just doesn't take any parameters so foo we're just going to make every new tab called foo now what i'm curious about is whether when i run this okay so it did make this tab called fu so it just makes everything the same name whatever this thing gets returned so that cannot be used for the new um tabs that show up apparently but if we look at the buffer name window buffer tab name current i wonder how it works when you rename one so let's look at rename tab bar rename tab tab name on call tab bar tabs function tab to rename that's a lot of code in there explicit rename tab explicit name [Music] what does it do in the end tab new name oh it's using set f okay so tab to rename tab new name so it just sets the the a list value okay interesting um i'm guessing okay so a tab bar tab name function can be anything and it updates dynamically i set it to the project name that's actually a good idea so um let's see oops hold on a second project do you get the project name i guess maybe it's the function project name let's see project current return the project instance and directory defaulting to default directory and what do you get when you call project current is returned like an a-list getting the current project name project root of project current thanks garlic project root uh project current probably not gonna give me anything here because uh project current is nil because i'm not in a project currently and it's in the other buffer either so it is possible to do stuff like that for sure so in fact if you wanted to let's actually do this because that might be really useful for the one of the next things i want to do so how about that what we'll do is we're going to define a function so uh define my what is it my tab bar tab name function and doesn't really take anything and what i'm going to do here is uh use a let to get the project project current there's probably a better function i can use for this but that's what i'm going to use for now and then if project i want to return a project root of a project let me indent this properly otherwise i'm going to call um what's it called tab bar current is that right oh i mean project.ell right now tabar.ell see what's called uh tab name function go back to where the default set tab bar tab name current so we're gonna call that function instead so i'll put it right here close if close the let close that and now on this function i'll set that here to [Music] my tab bar tab name function evaluate that okay so now that gets set back to the right thing and but what if i create a new tab uh control x t2 right and i use control xp f like the project okay let's actually go um projects code emacs from scratch uh and now you can see that the project root actually shows up here automatically because oh is that for because it's deer red let's uh let's check that really quick because i could be saying the wrong thing oh yeah okay so it is it has it is actually pulling the the project root so um what if i instead control x t o what if i instead say what is it um file non directory no directory there's a function i can use file name of the directory named directory this is a directory file name directory file name let's see if that works didn't seem to work function named file directory file name directory yeah they all get switched around file name directory because basically i just want to get the name of the folder where the project is stored still doesn't seem to be doing anything tab bar mode tab bar mode okay okay i'm probably doing something stupid here let's see what they're saying in the chat getting the project name um if let yeah if led is what i was thinking garage current project project root default directory okay uh gon says i suggest a short on all the strange lisp symbol sigils like the earmuffs colons yeah um all those things definitely don't make a lot of sense if you haven't studied them before eric says i've got an issue with emacs demon if i run the demon without starting a gooey session my emacs doesn't load evil or my theme um you must have a hook set up somewhere that's only pulling in stuff uh whenever the ui starts up minas mazar says does anyone know about issues with tab bar and mac os i'm struggling but i can't see any bar i don't know i thought i heard about an issue with that that got fixed in newer builds um see explicit name a-list value sounds good for this maybe hey slalom skater trigger the tab updating itself by visiting a file yeah i think um it's supposed to do it automatically let's see uh demo yeah i think i think it updates sort of periodically on its own sam says i wish we just had base name and dear name i always get confused on how to get the base directories or directory names yeah me too for sure file name directory uh return the directory component and file name file name um yeah probably come on there's gotta be another function for that file dash name base that must be it right no not it huh up okay so it did something that's good file dash name we won't spend much more time on this uh give me things to start with file name thank you file name as directory return a string representing the file name oh no don't want that that is weird i swear there's a way to get this i don't want to split this though the base the file name no directory no extension okay that's definitely not the right way to do it then absolute p completion non-special it doesn't tell me anything ah whatever okay let's just leave it this way the way it was before because it's still useful enough to see the the folder path i think all right so next thing what do we want to do next let me check the uh the set of tasks that i had set up for this let's see sc all right there we go so setting the tab bar format a better status panel we should definitely check that out because i think that's a pretty cool feature of this whole thing that has not really been advertised so well so let's uh take a look at the variable tab whoops tarb ab bar format so this is a whoops i'm in the wrong session here we go tab bar format okay so uh template for displaying tab bar items every item in the list is a function that returns a string or a list of menu item elements or nil i don't know what menu item elements means adding a function to the list causes the tab bar to show that string or display a tab button which when clicked will invoke the command that is binding is the binding of the menu item okay that makes sense so basically it's a button that you can click that runs a command if the function returns nil doesn't directly affect the tab bar appearance but can do that by some side effect okay if the tab if the list ends with tab bar format align right and tab bar format global which are the two key elements here um then you will get the global mode string showing up um in there so let's take the initial value of this oh come on all right so i'm going to copy that go back to our config i'm going to drop this in i'm going to say set queue tab bar format and now i'm going to add what's it telling me i need to add a tab bar format align right tab bar format align right and also tab bar format global i execute that it tells me that if i go turn on display time mode then it should start showing up in the the tab lines control x t n x t n oops that's not the right one zero zero all right so so far it's not actually doing what i expect let's see let's check the variable so i do have a line write and tab bar format global in the list let's see let's check global mode string okay so there is something in there it has display time string if i check the variable for that it tells me that there is a time hey benoit sam says you were looking for file name non-directory i think it's not that part i think it gives you only the file name bit okay so let's see should i maybe i should make this an actual list instead i think that's probably the problem oh back trace nope doesn't like that void variable tab bar oh okay yeah of course let's do this again then all right um we take out the align right i wonder what it does how about um make my own function define my well um yeah let's see my uh tab bar string i'm getting some feedback from mike here apparently okay so that's just a string a function that returns a string i'm going to put it right here my slash tab bar string i'm thinking that it's supposed to just take the mode line refresh there a function for that mode line no here let's check that again we'll display time aligned to the right of the on the tab bar instead of the mode line replacing tab bar format tabs with tab tab bar oh so apparently to get the grouping to look right on the tab bar you have to actually replace tab bar format tabs with tab bar format tabs groups for it to show up right that makes a lot of sense that shows why we didn't actually see anything for that before okay so let me think about this for a second this should be working based on what it told me because tab bar format global is a function produce display of global mode string let me actually just execute that what are you doing okay so yeah it gives me global menu item help echo oh system load average it's got a lot of stuff in there how about this let's take out uh tab bar format add tab because i really don't care about that i don't want to see that button there so just take that out and evaluate it so it did update that that icon went away so something is missing to make that show up correctly case says i sure am glad emacs isn't complex oh my goodness i got some uh wire problems here okay so let me see why this is not working is it because i took that other part out it can't be maybe i'm not following the convention correctly tab bar separator let me check what this function has in it it's a native compile lisp function okay so or tab bar separator if windows system so is that a variable string that delimits tabs okay so that's not actually set right now if windows system make it empty otherwise a pipe character benmod says it's simple not easy well it's neither of those two things right now apparently tab bar format global let me jump into this really quickly okay so does it need to be a list is that what's happening i think it needs to follow the mode line format so maybe that's i need to look at that really quick so emax mode line format because i don't remember the actual way to do that sorry case i know that you didn't need another thing to rat hole on while you're supposed to be working okay so mode line variables putting information to the mode line uh no that's not helpful uh properties in mode uh using properties in the mode line okay that does not help mode line variables okay that's that's more useful so you can have okay let's try this i'm just going to put an arbitrary string in how about uh so what is what is history aboard format history produced back and forward buttons interesting i don't even see those let's just take that out because i don't like that anyway let's do this rolex t uh oh control xto does not show up why not there's got to be a reason why this is not doing what i expected to what if i do um another list nothing huh let's toggle tab bar mode doesn't do anything case says my one beef with emacs is how uh everything tries to insert themselves in the mode line which means i have to fix things yeah that's why i like to just turn a whole lot of stuff off in the mode line because uh it just gets too busy down there all right let's check this because something's wrong every item in the list is a function that returns a string or a list of menu item elements or nil and it seems i'm not mistaken that this is just a list of symbols so i'm not sure why it's not um it's not obeying can't spend too much more time on this but let's see okay so it did something there i think okay the problem is that the uh face is not set up so that it's visible so hello is there let's see what's here okay so the clock is actually there you just can't read it let's check the tab bar face maybe doom mode line is working against us here and we may be able to fix this by setting a face attribute um let's see make sure mode line text in the tab bar can be read let's move this down here actually so now i know that's it's there customize the tab bar format to add the global mode line string all right so here i want to use i think it's just tab bar so i use describe face tab bar yeah tab bar face and as you can see here the text is not legible because they do that on purpose to hide it basically which you know by default makes sense but if you're trying to do this it doesn't make sense okay so we're gonna set the text attribute of tab bar uh we're not going to inherit it we're going to just set the foreground to let's just call it white that's fine it's just it's easy to write ffffff without messing it up so now that i did that you can actually see that the text shows up correctly so i wonder if i just broke how the the other text will be rendered but maybe it's not a problem so now i can take this out and i can also um add that was it see tab bar format let's check the variable for that i want to add back this tab bar format align right tab bar format align right eval again and now that gets moved over to the right hand side so basically anything that would show up in the global section of the mode line now will show up here which is cool because you get the clock you get i think this is like a cpu usage indicator what about display battery mode um i think doom mode line is snarfing that one up i don't know if it goes in the global section or if it's somewhere else let's see but you can put whatever you want in there so if we look at the global mode string so let's see display battery see if i can get the battery string battery string battery mode line string string display in the mode line hold on a second display batteries echo area display battery mode okay display battery string so who sets this okay display battery mode i wonder if doom is doing something to change how this works i really don't feel like digging in uh doom's code right now toggle battery status display uh battery mode line format battery status function okay so what about bat batteries come on battery status function um oh it's a variable okay battery u power how about that battery u power okay so there's a lot of data there that i would have to parse see you sam okay so battery status function i'm not gonna screw with this very much okay so if you if you run it through um battery if let's see battery update battery update better update battery status in the mode line okay so let's call that really quickly uh can i put that there that returns a proper tie string and that sets what then if and if battery update okay so this will then it's battery no c doesn't even set that string that's really weird i i want to get that battery information up here for sure maybe i can just do that so how about i add something to the global mode string i can append to that i wonder if this is going to work we're going to find out so um add to list what's the syntax for that is that a list variable um global mode string i think i need to use this as a symbol but let's let's find out first so we're going to add the result of uh oh no we need to add the actual function battery update about that yeah okay i need to make this a symbol i think um it added to the beginning that's fine so does it update i don't see it doing anything yeah i don't see it doing anything okay i wonder hmm more spam how about that oh my goodness look at all these spammers all right sorry i gotta clean up some stuff here [Music] okay so uh next thing batteries [Music] it must actually be doing something like that well anyway the point being that you could put whatever strings you want in here in fact if i were to go and add just like another string of whatever it should show up yeah it does show up so it really is just a matter of having functions that can return text that could be shown in the mode line that could also be shown here as well if you put that in global mode string and you could also just make your own function return whatever text you wanted so if you wanted to have your own custom status area up here in the top right hand corner of the screen while the tab bar is being displayed then you can do whatever you want with that and like uh phillips post showed i still have that yeah right here i'll put that in the show notes because that's pretty useful you can even if you don't use the actual tabs for window configurations you can use this as a global mode line um let's see using tab bar solely as a global mode line which i think is a pretty cool uh way to use it okay so uh next opening project.el projects in new tabs this one's going to be pretty easy i think i have the right approach figured out for that so let's close this up really quick um so if you use i think it's control x p f control xpf it will allow you to select a project um and i think that basically pulls from known projects you've opened before i'm surprised it doesn't actually show the emacs from scratch project right now but typically a project is a folder that has um a git repository particularly see project directory what if there's a way to give it a default list so projectlist.el let's actually open up this file and see what it has in it nothing okay so um it doesn't know about any projects right now but i wonder if uh if this just hasn't saved it yet anyway point being uh whenever you use that command you can easily jump back to a previous project you've worked on in the past basically just by selecting the git repository out of the list of suggestions and whenever you select one of those usually project.el is the built-in project system in emacs it will prompt you for an action it takes so it would be nice if it let me actually see control xpf um oh choose a directory so i'm going to choose projects code emacs from scratch and i think by default it just asks me for what file i want to open so i'm just going to say demo.el whoa i'm in the wrong wrong session that's why okay so let's close that down control xpf choose a directory um projects code emacs from scratch i'll pick the init.el file from that now we're in that project but what actually happened is it just opened that file in this current uh tab but what i want to do is make it automatically open a new tab by default so there is a variable called project um find functions i know that's not the one what's it called there's a function for this oh is it is it the prefix map is that what it was it's something that you can use to do this and i found it the other day project special hook to find a project containing a given directory yeah we don't need that one oh all right that's it project switch commands so each element is of the form command label key where command is the command to run when key is pressed label is used to distinguish the menu entries in the dispatch menu um i think that you can set this to a function ah the value can also be assembled the name of the command to be invoked immediately without any dispatch menu so i think what we can do is create our own uh command we go back to config.el uh my uh project create tab and then make this an interactive function and then uh whenever a project let's see when a project is created i wonder if this is going to work the right way let's try it out and see what happens so um tab bar was it tab bar new tab new tab there's another way to do this too which we can talk about in a minute that's sort of more built into emacs but let's try this first and see what happens so my project create tab um and then also see do i have magic set up here okay so you can also say like magic status just pull up the magic status for what whatever that project is so i'm gonna eval that function and then i'm going to set q project switch commands to the symbol of my slash project create tab now i can use control x p f select that e x from scratch still doing the same thing which is interesting i wonder what i've done wrong i noticed that it didn't do what it's supposed to uh which is to show this dispatch menu which is interesting if key is absent command must be bound in project prefix map use by project okay is that what i'm pressing ctrl h k control x xp f no no no no ctrl hk come on control h k control xp f okay that's project five file that was a wrong command so uh project switch project that is control xp ctrl xp so that's sort of like a projectile if i press enter there did it create a new one yes that was kind of weird though what it did it created a new tab it pulled up magic status but it also saved the current window that was already there but i think it's just because of um magit's window rules so let me actually close out these tabs so control x t zero rolex t o ctrl x t zero we'll do that again uh control x p p we'll select e max from scratch it created a new tab and then pulled up magic status for that project so uh that's something you could do pretty easily if you want to automatically open up whatever basically for any project that is created but also have a separate tab for it so that you can start editing files or doing whatever you need to do in your own special window configuration which is great thanks karthik yeah you reminded me uh i whenever i don't have the chat on the screen with me at the same time where i can see it then i miss things that i would have caught earlier uh project switch commands is an a list meant to be appended to i think you set cue it yes i did that on purpose because i'm trying to override the dispatch behavior because by default it's an a list that allows you to choose an action but for me whenever i switch a project i always wanted to just do that single action but you could definitely set up why is q not working in this buffer that's really strange i think my evil setup is broken somehow on this config um okay so that was that let me see what else i was mentioning in the list of things to do go back to the show notes uh writing a function to show only desired buffers for a given tab so this is one that um you could do a number of ways but i'm going to try to take the cheap approach and actually change the binding or um control x b so this is actually something that you do with um perspective.el if you want to only see the buffers that are associated with a given given perspective you have to rebind your normal buffer switching key binding to use perspective's own switch command so that it shows you only the buffers that are in the current perspective i'm pretty sure so uh we can take a similar approach and um let's see defun um let's see defun my uh switch to tab buffer so this is gonna be very simple what we're going to do is check to see if there's actually a project root and we're going to use the let's see what is it called project switch to buffer which will only give you buffers that are active in the current project but if you're not in a project then it won't actually want to do that demo.eo so if we run project switch to buffer right now it would just give us the list of things that are associated with the project in this buffer which is actually helpful because it gives it gives us the dear ed uh buffer it also gives us the magic buffer and i think that if we were to use ctrl x p e to open e shell for this project then uh project switch to buffer would also give us the uh the e shell for this project so if you use project.el to work on projects which i recommend that or projectile i think also would work then you can use a command like that project switch to buffer to only see the files for that project and that could work in a lot of cases for you i think so what i'll do is go back to my config.el and i will use a similar check to what we had before which is um if project current i'm just checking to see if there's a current project that i'm going to call project switch to buffer otherwise i'm just going to call uh switch to buffer and i don't know if i need to actually make that interactive and invoke the others interactively um maybe i should actually do that call interactively so that it passes through all the uh prefix keys and stuff like that okay so that should do it and now i can say global set key eboard control xb i think this is the right syntax i don't ever use global set key very often so uh and then i'm gonna call my switch excuse me my switch to tab buffer run that now if i use uh control x b here it's going to give me just all the buffers available if i were to go into demo.el and use control xb it's only going to give me stuff that's associated with the project that buffer is in so that can be pretty helpful if you want an easy way to only switch to the uh buffers in a project if you have a tab that's associated with a particular project so if i were to do that again so ctrl xp to switch project i'm going to choose a directory this time i'm going to go to let's say channel x and excuse me it created a new tab it ran magic status and now if i were to run control x b it's only going to show me the magic buffer because it's the only thing that's currently open for this project i use control x f actually let's see control x p f no no no what's happening drill x p f uh i can pull any of the files that are in that project and then now if i use control xb i'll see that guild.scm file that i have open from the project which is pretty cool karthik says meta x consult buffer return p space console buffer uh p space yeah so console buffer is also a good way to do that if you want a more versatile approach this is some of that prefix stuff that's available in vertigo or consult that i haven't really dove into yet is that right space no what's that hidden buffer p because that's not right is it p space more spam okay p capital p no okay let's let's check uh just out of curiosity consult uh there we go p space doesn't seem to work for you nearest the current project whatever your key is to narrow to a category so category ah you need to set categories e-shell source yeah there's a lot of functionality in console that i obviously don't use but uh i mean this is one way that you can do it if you want to do it this way for only switching to the stuff that's available in the current project it would be useful to probably look into consult some more to see if there's a more versatile way to narrow to certain buffers there's also stuff like buffler by alphapapa that can automatically choose the right set of buffers based on uh what workspace you're on and i think it does work with tab bar mode so that's another approach you could take if you wanted to but this episode is more about just sort of like trying to come up with our own little hacks for tab bar mode so let's go back to um was it config.el where did that file go oh it's here ah um my my functionality was defeating me okay so let's jump back to the nodes uh does it work with desktop save mode so i guess the question is if you turn on desktop save mode does it say the state of everything so that it can be loaded the next time you load emacs so if you haven't heard of desktop save mode it's basically just a way to save window configurations and buffered lists i think so if i turn that on desktop save mode i haven't really used this much so i might use it wrong let's see desktop save save the state of emacs in a desktop file and directory your name save in desktop deer so okay so i saved the desktop it went to a particular folder that was probably set up by the no littering package that's probably not the default path so if i were to close this emac session if it wakes up and does what i say oh whoops wrong we're not closing my main me max session we're trying to close uh this one so i think i ran it in the wrong session uh desktop save mode desktop save in desktop deer there we go um desktop let's just do that oh no whatever let's save it right there okay so now if i were to close this emac session um no i think i messed that up i'll go back to excuse me the shell was a v term and run that emac session again uh let's do that oh come on it gets there we go all right let's go emacs here let's close that okay so um desktop load read desktop read not reloading desktop already loaded what does that mean let's see desktop save mode turn it on oh it's disabled so it must have been i'm in the wrong session again desktop say save mode on desktop read doing something um tab bar mode hey okay so it does work you just have to make sure you have tab bar mode show turned on to make sure that you can pull everything back up again um so let's just double check this really quickly here we have config.yel i think all the same buffers we were working on are still up as well yeah a bunch of info buffers just random files that kind of thing so if you want to make sure that you can get right back to where you were with emacs whenever you load it up again you can use uh desktop save mode for that aaron says i use tab bar and exwm for single monitor workspaces yeah that's something i'm planning to do also so um what did i want to check there so desktop save mode i haven't really okay disable it so i want to know if this like saves automatically so it's minor mode if called interactively toggle the mode on this is just boilerplate documentation i think let me see when it's enabled the state of emacs is saved from one session to another in particular emacs will save the desktop when it exits this may prompt you to see the option desktop save the next time emac starts if this mode is active it will restore the desktop so if we have that set up in our configuration in theory it should come back up again so let me turn on desktop save mode and then we can close this emac session and then uh open it again i think it did work so if i turn tab bar mode on yeah okay so let me actually just make sure tab bar mode is on by default tab bar mode one okay let's fix that let's move this up a little bit right there okay so now if i uh close the session start it up again then it should come back up with all the same stuff uh however tab bar mode did not display itself correctly at the beginning that's kind of weird maybe i should just put it at the very end about that uh save the desktop let's see desktop save as variable ask if new that's interesting all right so let's close it start it up again interesting it never displays itself maybe something weird about what i'm doing or is it just not huh weird you have to kind of jiggle it a little bit it seems not sure why that's happening unless i need to add that as like an after init hook or something to make sure that it happens after everything loads up completely uh jordan says tab bars only show when there are multiple tabs open well by this point i've loaded you know what i wonder so how about this let's check after and knit hook um okay so i don't see anything here for loading so what does desktop save mode actually do if we go look at the code for desktop.el is there a hook anywhere let's see yeah yeah yeah ad hook okay so that makes sense desktop delay hook was that that is a crazy function window configuration change hook after a knit hook okay so he just puts a lambda in there that makes sense and it checks for a no desktop argument to avoid loading that if you have trouble with it that's cool but this is a lambda function that let's see when member key command line rx whatever okay so it turns off desktop save mode otherwise inhibit startup screen so if i were to do this ad hook after init book right and then tab bar mode let's just do this instead after start up that will probably work correctly because it should show up after the desktop state is saved nope didn't work hmm now it says it's enabled wow that's really weird i do wonder if that setting is messing with it somehow so how about this try it without that on okay didn't help oh no undo info that's fine okay so let's check after init hook it got added first i don't want that i want it to be added at the end i think there's a thing i can use for that right depth what is depth um always come first uh let's see since nothing's always true like i just give it a depth of 100 right let's do that let's um exit down still nothing it's funny because it says it's enabled i don't know what's happening baron says tab bar mode is somewhat finicky when enabled in initialization well that's kind of weird because you would expect to be able to do that bar mode add bar history mode yeah don't care about that too much so what if instead i set up a lambda interactive um tab bar mode of one this probably is not gonna work but we're gonna try it anyway make sure that's not bogus wait hold on it added it to the beginning did it am i not saying to oh i must have deleted that 100 at the end 100 let's check that one more time probably it's not gonna show it yep okay all right we'll try it girl xc jesus come on yes save it that time it did not load anything did it that's kind of a bust uh it seems like it did actually load the config um the session but it's not loading the tabs or as the tabs aren't being displayed that's very weird rather landed with run at time yeah that's annoying run at time so we're basically just going to delay it by one second nil see again felipe says please read my comments um works perfectly with tab bar mode just need to add desktop save mode i did it's right there thanks nerd bkk um so tab bar mode and so you have to do tab bar mode first i tried that it didn't actually work tab bar mode one let's try that see what happens pretty sure it's not going to do anything if it does this time i'm going to be very confused yeah doesn't do anything i don't know what's going on with that so what if i do control x uh t o troll x t o it doesn't actually um show the tab bar yeah see it's not even doing anything yeah i know i didn't finish writing that so um oops yeah you're right let's take this part put it out here oh no it was right wasn't it yeah that's fine uh so just call run it time directly run at time i don't think that's gonna work is it it'll wait till idle nil what's the time repeat function args okay so let me just grab the entire lambda here and i'll drop it there do the same thing here take this run at time part out because that's obviously not going to go there anymore drop that dropped a hundred okay so get an extra parenthesis okay so now let me try that okay it did actually turn it on then that's great all right let's let's do this three times since it seems to do it says pavel yes i agree still doesn't work that makes no sense okay well um maybe this is a bug that needs to be reported to the emacs maintainers because it makes absolutely no sense um why it doesn't show up correctly let's let's do run it time uh three seconds after idle huh and at the same time i'm going to send a message uh turn on tab bar so we can find out when it actually happens and then uh this is the last thing we're gonna do here okay should have turned it on right then didn't do it who knows why that doesn't make any sense what if you run tab bar mode three times i bet it won't work let's just try it for the sake of science tab bar mode one let's just duplicate that three times if this works then we got like ghost in the machine nope uh yeah there's some kind of like timing issue where it really doesn't want to cooperate tab bar mode app bar mode tab bar mode yeah if i do it manually it works i guess it's not reading your custom desktop save config well it is uh it's pulling up the same buffers again but for whatever reason it's not populating the tabs correctly it seems yeah eric has a good suggestion try running the command to create a new tab let's do that okay so if i run ctrl x t2 it doesn't show it i have to run tab bar mode two more times before it shows up so that's very weird uh but like we uh like we know uh emacs 28 is not a production release yet so uh jordan we tried that and that actually didn't work either so let me let me try it one more time just to to to show that happening so tab bar mode is is set to one there we're going to let it run and start up remove the other tab bar mode oh is it up there i think i moved it tab bar mode yeah there's there is no other one okay so i'm gonna use control x t rhett yeah even switching to one that is uh already existing doesn't do anything about it so i don't know what what to say about that but it's definitely a bug some kind of timing issue and i don't really have time to look into it right now um control x uh t oh let's go to the other buffer control xt enter yeah that one uh eric says for me the bar doesn't show up until i create a new tab with a different buffer than the original one yeah um it shouldn't need to be like that uh mina says you already have a tab bar mode one under global set key uh yeah that's the one right there and there's no other uh time that i'm running it in the code here as far as i know tab bar mode it's just that one these two are commented out currently and none of those approaches actually worked which is very strange in my opinion elijah says you had the unconditional one and the run at time when both uh oh okay yeah probably i did at some point but i i fixed it so i'll just try it one more time see what happens yeah same same issue let's run tab bar mode manually once twice three times four times that was that was a charm that time bible says perspective.el seems a bit friendlier yeah but i think that probably with enough tweaking you could make it be pretty nice if nothing else having the ability to set the global mode string up here would be pretty useful for exwm users i think so i'm gonna try to see if i can work that into my config and possibly get rid of polybar entirely another thing i could possibly do is i mean there's there's all kinds of stuff you could do there like you could put all of your chat notifications like if you're using erc or whatever you can put all your tracking buffers up here you could put um your exwm workspace up here like i could basically replicate the entire uh polybar experience that i currently have in emacs without having to run a separate program which is kind of nice uh for system tray uh exwm already has its own system tray support which you can do like put it in the bottom right hand corner though it is a little bit flaky uh however i'm kind of curious about trying to make some fixes to that and uh make it better because that's kind of a very scoped down problem maybe it's something we could do on a stream one time all right i think that's it for what we wanted to try to do today let's see pablo says i've actually tried to display the list of perspectives as a tab bar but didn't figure it out initially yeah there's a function you can or a variable you can set to override that but i guess you'd have to figure out how to give tab bar the stuff it needs in its own way of understanding um you may have to make their own data structures or something wasn't so obvious but i didn't try too hard yeah well sometimes when it doesn't work the first try you know we've got better things to do with our time so i can understand that okay folks i appreciate all of you being here today to uh to watch me fumble around in the code for a while but i think it's you know we did figure out a couple of kind of cool things and you probably did get to see that this is pretty customizable and it's worth uh looking into if you want to have more like a workspace centric approach in emacs to have separate workspace configs for different projects you're working on et cetera i've been using perspective.el for that for a long time and i might try to use uh tab bar for that in the future and you know just see if i can use yet another thing that comes in the box with emacs instead of using something that is like a third-party package you know it's it's an option it's not necessarily something you have to do you don't have to use all the stuff in box but sometimes it's fun to do that and this one is actually very configurable so you might be able to get whatever behavior you want pretty easily so um i will put all this mess of config into the show notes so you can go and play around with it yourself if you want to and uh next week next friday is christmas eve i don't know if i'm gonna stream yet the likelihood is that i won't but i'll let you know in advance uh one way or the other so that you uh ha you know whether i'm gonna go on or not um and we'll see what happens with that and uh yeah if you are interested in the other channel i have flux harmonic i'm gonna be streaming on tuesday like i mentioned uh the time is very different than it is for this stream so it's like 1 p.m utc so check the the world time clock in emacs to see what time that is for you um in fact if you are in emacs world uh world cluck is the command uh let's see london is effectively utc so if you look at whatever that is and you'll be able to extrapolate from your own time zone so uh yeah so that's gonna be a lot of fun i think we'll we'll just experiment because uh i don't know exactly how those streams are gonna be different functionally from these streams but we're gonna try to make it a little bit different and maybe a little bit more fun we'll see how it goes so until next time thanks everybody for being here today i really appreciate all the the help and the feedback in the chat um and until next time as always happy hacking we'll see you [Music] you
Info
Channel: System Crafters
Views: 1,579
Rating: undefined out of 5
Keywords:
Id: wqdT0xKMQT8
Channel Id: undefined
Length: 127min 39sec (7659 seconds)
Published: Fri Dec 17 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.