A modern Emacs look-and-feel without pain

Pedro A. Aranda (he)

Help wanted: main talk does not have captions

This talk does not have captions yet. Would you like to help caption this talk? You may be able to start with these autogenerated captions.

(If you want to work on this and you think it might take you a while, you can reserve this task by editing the page and adding volunteer="your-name date" or by e-mailing emacsconf-submit@gnu.org.)

Format: 23-min talk; Q&A: BigBlueButton conference room
Status: Q&A to be extracted from the room recordings

Duration: 22:20 minutes

Description

In my talk I will show how to enrich themes without having to write them from scratch, using the flat-button style. This gives you the possibility of creating a nice Emacs GUI with minimal extra ELISP.

About the speaker:

Pedro A. Aranda is a 30+ year Emacs user, who started on an HP mainframe and soon started using the DJGPP port of emacs on a 386 at home. Currently lecturing at a university in Madrid, he uses emacs for most of his teaching activities.

Discussion

Questions and answers

  • Q: Do you plan to upstream this style into core Emacs?
    • A: It's in core emacs
  • Q: How difficult is it to modify face styles like this internally?
    • A: It's very simple, just set the :style of the :box face attribute.
  • Q: How much work was involved in implementing this style internally in Emacs core?
    • A: About a 20-line patch.
  • Q: Could you please share the code for copy and paste? Thx!
    • A: 
    • (defun flat-style(theme &rest args)
    •   (custom-set-faces
    •    `(mode-line
    •      ((t (:inherit mode-line
    •                    :box (:line-width ,mode-line-height :style flat-button)))) t)
    •    `(mode-line-inactive
    •      ((t (:inherit mode-line-inactive
    •                    :box (:line-width ,mode-line-height :style flat-button)))) t)))
    • (advice-add 'load-theme :after #'flat-style)
  • Q: Do you teach Emacs to any of your university students?
    • A: No teaching, but a lot of introdcuing ;-)

Notes

  • It looks great, thanks for upstreaming it in GNU Emacs core as well!

Transcript (unedited)

That's how I came into this. Finally, the next big thing was starting 2005, I went fully Linux and then for Mac OS, and I switched to vanilla self-compiled versions of Emacs. So what do I want to show? Couple of time ago in the development list there was a short exchange about the nil and the flood button, flood button button styles, saying that it was equivalent and they are not. So instead of starting a Flame Wars, I thought it was better to go and publicize the goodies you get with Flood Button. And this is what I'm going to be showing you practically. Why Flood Button? 2005, more or less, I came across DOOM Emacs, which was nice. And I, especially I liked the DOOM mode line, which was, I think it is, it is, and it was cool at that time. I was using other themes and it was not that easy to adapt for these other themes and even less when you are in an environment with dynamic themes like mine because I tend to adapt the theme to the light conditions in my working place. So what I did at the end was coming up with a style for faces called flood button for boxes, called flood button as a simple way to get modern looking buttons and bars. So flood button is a face style for boxes within buttons that automatically sets the border color to the background of the face, as opposed to nil, which uses the foreground. And this produces a very doom mode line-ish look and feel. And if you want to know where I use it, basically for the mode line and I'm using tab line for a long time now. So for the mode line and for tab line to organize my windows. And since an image is worth more than a thousand words, I'm just going to stop this and start sharing a small Emacs environment I have ready for this talk where I'm going to show you a flat button in real life. So if you hold with me, I'm going to share a window. It's going to be this 1. Share and share. Here we are. And share. Here we are. So this is an Emacs which is recent, reasonably recent. Nothing especially it was compiled, it's Emacs 30. And I think what I have here is something that I compiled last weekend. I was tempted to use something compiled this morning, but I saw a patch by Ellie regarding something in the faces and I didn't want to live a too risky life here, so I'm going to use this. I'm not starting the ZMAC from the normal Emacs directory. I have my own, I have a special customization directory for Emacs, and this is this 1. And here what I have is basically an early init and an init. So the early init, which is quite stupid as you see, the only thing that it does is getting rid of most of the things that I'm not going to be using here. So I have no toolbar, no scroll bar, no tool tips. I don't like global highlighting my line art, so I'm not using that. I'm not using dialogues. And to start up easier, I don't inhibit, I don't use any startups screen. So just to make sure that everything is correct, that everything is as I want, just to show you my Emacs. As you see the Emacs 30, which was built on the 26th of November which was not very long ago. And now here comes the real magic. My init and my init file. Maybe I go to my init file here. What I have is just a variable saying that I want an extra 8 pixels for my mode line. And I have 2 functions. 1 is modifying the mode line, both the active and the inactive, using the nil style with this line width of 8 pixels and to compare with it what I have here is another function which will customize the face for mode line and instead of using nil I'm using here flat button. So this is my all the magic that I need. I'm going to copy that and I'm going to go to the scratch buffer which is always the best way of checking these things. When I normally work with themes, what I do is if I want to further modify the themes, I add an advice to load a theme after the theme is loaded. In this first case, what I'm going to be doing is adding the nil sign so that you can see it. And once this is done, I'm going to load 1 of the Modo Soprandi themes, the tinted 1. Here we are. And as you can see, when I loaded the theme, what I see here is my mode line with the x-ray pixels using since I'm using the nil style it's using the background color and this gives you this thick black line there furthermore if you have the inactive line you see that it is grayed out so it's always using the foreground color. So now what I'm going to do is to load the models we have any which is the dark theme and this case what you see is the love deal the lines always using the foreground color use the Give you an extra 8 pixels of a white color here, which is not what we really want. At least not what I wanted to have. So what I'm going to do now is I'm going to remove this advice and add the flat style thing, flat style function, so that we're going to do the same. But now when I load the themes I'm going to have a flat button style for the mode line and you'll see the difference. So if I now load Modo Software Andy theme, tint it, what I get here is as you see I get a solid mode line which is a bit more which is wider than the normal mode line And if I go to the dark theme, I am going to see, you're going to see that now the theme changes and I have a mode line which is, if not the doom mode line, quite close to the Doom mode line. Where do I use this? Personally, I use it for the mode line and for the tab line, as I've said. And it gives me this clean themes with thicker mode line and tab lines which at least in my personal feeling look quite modern. And this will be my demonstration. So I'm going to stop sharing the screen and I'm going to try and see if there's anything on the on the chat. And I just wanted to know if there are any questions. Thank you Pedro. Yeah We are now into the Q&A portion of the talk. So if folks have questions, please post them on IRC or on the pad and we'll take them up here. Okay, I see a question here saying, do you plan to upstream the style into core-remix? It's part of core-remix since Emacs 29, so you have it. How difficult to...I mean, you already have the flat button style in Core Remax. And you've seen that the main thing is, if you want to have a thing like that, you just have to customize the face. I don't think it's too difficult to do. It's adding the style that you want. So if you want to see it again, I'm going to go and share the screen once again and show you the only thing that you really need to do. And control X 1, control X buffer to init. So this is what you would have to do to get your mode line or mode line inactive with a flat button style. So what you do is you get your face like this, the face that you want to modify. You say that you inherit from the original face and what you do is that you add a box with the line width that you want and the style plug button. I don't think it's too difficult to do. How much work was involved in implementing this style? It is not 1 of the biggest patches you have in Emacs. It was my first patch, so it was like 20 liners. It's not too much. Yes, I am going to go and... Oops. SKB and... There you are. And there you are. I've checked it for copy and paste. Of course, then what you have to do is to add an advice and add this thing after the add this code after the well after you've loaded the theme. It says, ModeLine and ModeLineInactive. I'm also using it for TabLine and TabLineInactive and all this kind of things. Thanks. Thanks. Any other questions? Reactions? Thank you. Thank you. Okay, I think we still have about 6 or 7 more minutes of live Q&A on stream, so if folks have any more questions, please do feel free to post them on the pad. Silence. Silence. Silence. Well, do you teach eMAX to any of your university students? As such, there's no course that we teach, but in tutorships and in tutoring sessions, when we do practical things, and I do a lot, I tend to use Emacs for all the tasks so that the students get involved in it. I also have a small introduction to Emacs that I share with my students. So So every year I have 2 or 3 new adepts. We have a question on IRC. Someone asking can you please show what the tab line looks like? Just a second. This would be like this. For that I'm going to use my regular Emacs. Just my my regular emacs so just let me fire it up. Sure. And That's my current situation with the tab line. I do have a couple of functions. So this is 1 of the things that I use. As you see, both the tab line here and the mode line change. And the other thing is I can, this is for some situations, not currently because it's just later, it's a bit too dark. But this is for light days. I have like 3 or 4 themes that I can switch to these are the themes that I normally use This is how the tab line looks. This is how the tab line here looks with the with a flat button style. Looks great, Thank you for sharing. You're welcome. Okay, I think we have 2 or 3 more minutes. So if folks, if you have any final questions for Pedro, please post them in. Okay. Okay. Okay. No further questions. Yeah, it seems we don't have any further questions. Just another audience member also thanking you on the chat. So with that, I'll say Thank you very much, Pedro, for your great talk and for the Q&A, for your work and for helping spreading the joy of Emacs. Okay, thanks. Thank you. Bye-bye. It was a nice experience here. Very nice tool. Cheers. Awesome. Take care. Bye. Bye. Bye.

Questions or comments? Please e-mail emacsconf-org-private@gnu.org