Emacs: control where buffers are displayed (the 'display-buffer-alist')
ฝัง
- เผยแพร่เมื่อ 15 ก.ย. 2024
- In this ~30 minute video I show how to tell Emacs where to place specific buffers. The idea is to have a set of rules that specify how you want Emacs to make use of the available space in the frame and which windows to use.
You can find actual code and further links on my website. Check the publication that corresponds to this video: protesilaos.co...
Your videos are invaluable, I always learn new things about Emacs
Thank you!
Love how you match your clothing to your Emacs theme (or vice versa) 😂
Hehe! I don't have many clothes, so you will see this in other videos as well.
gruv box aesthetic, retro vibes@@protesilaos
Thanks for the tip about body-function! Based on the documentation for body-function, it sounds like it is intended primarily for use by applications to populate the buffer. Overriding it in user configuration could prevent those applications from working correctly. It seems somewhat rare, but it's something to watch out for. (Also, it would be nice if Emacs could provide an equivalent hook that's less likely to interfere with the buffer initialization!)
thank you! finally I understand how to control those annoying default behaviors
You are welcome!
Exceptionally clear explanation. Your videos are great. Thank you!
You are welcome!
You inspire me to use vanilla emacs instead of using emacs framework
I think this is the best choice long-term, because you get to piece together your system. You thus understand what goes into it. Just make sure you have a good reason to add something before copy-pasting it into your configuration.
Finally the explanation I needed! After years of using emacs I finally will get rid of those default window movement behavior.
Thank you!
You are welcome!
Excellent explanation and demonstration!
Thank you!
This is a fantastic `display-buffer-alist` introduction!
For me, the most off-putting thing about Emacs is its default window placement logic.
It's a major reason why I haven't adopted Emacs still.
I did learn about `display-buffer-alist` from System Crafter videos too, but it just seemed so overwhelming I never even attempted to tailor it to my preferences.
Now that I have a solid understanding of the most useful options, I can grow a `display-buffer-alist` value while using Emacs, without worrying about falling into a rabbit hole.
Take it one step at a time. This is indeed an area where changes can have a big impact on how you use Emacs.
@@protesilaos i just re-watched your former video on this topic and now i understood that one better too.
th-cam.com/video/rjOhJMbA-q0/w-d-xo.html
Great intro! These fine adjustments are what make the experience of text editing quite enjoyable. Thanks, Prot.
You are welcome!
Love that! I was thinking about how to address some of those (sometimes annoying) issues, and now I've got all the answers :-) Thank you very much!
You are welcome!
I want to thank you for all your videos. This is he idea.
You are welcome!
Thanks! Your videos is always very good and educational.
Thank you!
Thanks for the great tutorial as always! I also needed to `(setq switch-to-buffer-in-dedicated-window 'pop)` to get the same behaviour shown in the video with M-x switch-to-buffer inside the dedicated window.
Thank you! You are right: I have that in my configuration and I also included it in the sample code that I posted on my website about this.
lookin FRESH in the jacket today prot 💯
Prot has enabled trendsetting-mode 👍
Thank you!
"trendsetting-mode", haha!
👏🏻👏🏻👏🏻
Thanks!
Thank you for another fantastic demonstration!
I've experimented a little with dedicated side windows in the past, but after a while they always seem to lose their dedicated status and start getting taken over by other buffers... do you have any recommendations on how to debug these rules when they don't work as expected?
You are welcome! Do you remember under which conditions the dedicated buffers would not be in place anymore? The manual mentions cases here: (info "(elisp) Dedicated Windows")
@@protesilaos After looking around the manual I've come to the conclusion that I'm using it wrong! I was trying to set it up so that only buffers A, B, & C may be shown in a given side window. However, once you open a second buffer the side window loses its dedicated status... which seems obvious in hindsight! Thank you for the help :)
What do you think about using emacs inside the terminal?
I've used it like that for years but I'm aware I'm missing some esthetics functions
I have only used it for demo purposes. Some key bindings do not work, colours are less accurate, and we cannot have multiple fonts at once. Otherwise, it is fine.
Hey Teacher prot! Thanks for this content. I wanted to ask, could you provide this theme and font? Thanks! By the way I love using your custom themes!
The theme in this video is 'ef-autumn' from my 'ef-themes' package. The font is Iosevka Comfy, my modified version of Iosevka: github.com/protesilaos/iosevka-comfy
Thank you !
Hi, switched to doom eMacs from vim, and I followed this tutorial to open eww to the right side always. My issue is, as soon as I restart eMacs, it goes to default behavior (where it launches any wiki link or something with eww to the bottom) , I have to manually evaluate the code in config.el to make it work. Any ideas? How to resolve this? I checked and the code is loading fine, I added message statements if it’s working or not. Thanks.
Maybe the code is not loading properly. Can you check the value of display-buffer-alist before you start using EWW? Does it include the value you expect?
@@protesilaosactually your code is right; there was popup ui elements causing this issue. I commented that in init.el and seems to be working . Your explanation is awesome
Are u friends with theodore alenas ?
No, I am not familiar with that name.
(let ((weapon "Emacs")
(hero "Prot")
(message-prefix "In the realm of life,"))
(if (string= weapon "Emacs")
(message "%s %s is my weapon, then %s is my hero!" message-prefix weapon hero)
(message "I wield %s as my weapon, and %s is a worthy comrade." weapon hero)))
Looks good, haha!