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...

ความคิดเห็น • 50

  • @pushqrdx
    @pushqrdx 7 หลายเดือนก่อน +21

    Your videos are invaluable, I always learn new things about Emacs

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน +1

      Thank you!

  • @timhansinger8030
    @timhansinger8030 7 หลายเดือนก่อน +10

    Love how you match your clothing to your Emacs theme (or vice versa) 😂

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน +2

      Hehe! I don't have many clothes, so you will see this in other videos as well.

    • @paulywalnutz5855
      @paulywalnutz5855 6 หลายเดือนก่อน +1

      gruv box aesthetic, retro vibes@@protesilaos

  • @spdevlin
    @spdevlin 3 หลายเดือนก่อน

    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!)

  • @lighthousekeeper7463
    @lighthousekeeper7463 7 หลายเดือนก่อน +7

    thank you! finally I understand how to control those annoying default behaviors

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน

      You are welcome!

  • @gpietroiusti
    @gpietroiusti 6 หลายเดือนก่อน +2

    Exceptionally clear explanation. Your videos are great. Thank you!

    • @protesilaos
      @protesilaos  6 หลายเดือนก่อน

      You are welcome!

  • @fikrirahmatnurhidayat4988
    @fikrirahmatnurhidayat4988 7 หลายเดือนก่อน +3

    You inspire me to use vanilla emacs instead of using emacs framework

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน

      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.

  • @AlfonsoAlvz
    @AlfonsoAlvz 5 หลายเดือนก่อน +1

    Finally the explanation I needed! After years of using emacs I finally will get rid of those default window movement behavior.
    Thank you!

    • @protesilaos
      @protesilaos  5 หลายเดือนก่อน

      You are welcome!

  • @yafz
    @yafz 7 หลายเดือนก่อน +3

    Excellent explanation and demonstration!

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน

      Thank you!

  • @0netom
    @0netom 7 หลายเดือนก่อน +2

    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.

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน

      Take it one step at a time. This is indeed an area where changes can have a big impact on how you use Emacs.

    • @0netom
      @0netom 7 หลายเดือนก่อน

      ​@@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

  • @arthurcgusmao
    @arthurcgusmao 6 หลายเดือนก่อน +1

    Great intro! These fine adjustments are what make the experience of text editing quite enjoyable. Thanks, Prot.

    • @protesilaos
      @protesilaos  6 หลายเดือนก่อน

      You are welcome!

  • @avkoval2
    @avkoval2 6 หลายเดือนก่อน +1

    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!

    • @protesilaos
      @protesilaos  6 หลายเดือนก่อน

      You are welcome!

  • @clarkkent4818
    @clarkkent4818 7 หลายเดือนก่อน +1

    I want to thank you for all your videos. This is he idea.

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน

      You are welcome!

  • @antonstalheim
    @antonstalheim 7 หลายเดือนก่อน +1

    Thanks! Your videos is always very good and educational.

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน +1

      Thank you!

  • @dawran6
    @dawran6 7 หลายเดือนก่อน

    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.

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน +1

      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.

  • @hashbrunz
    @hashbrunz 7 หลายเดือนก่อน +1

    lookin FRESH in the jacket today prot 💯

    • @mcxds
      @mcxds 7 หลายเดือนก่อน +2

      Prot has enabled trendsetting-mode 👍

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน +1

      Thank you!

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน +1

      "trendsetting-mode", haha!

  • @akojic5486
    @akojic5486 7 หลายเดือนก่อน +2

    👏🏻👏🏻👏🏻

  • @alcarney
    @alcarney 7 หลายเดือนก่อน +1

    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?

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน +1

      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")

    • @alcarney
      @alcarney 7 หลายเดือนก่อน

      @@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 :)

  • @AlfonsoAlvz
    @AlfonsoAlvz 5 หลายเดือนก่อน

    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

    • @protesilaos
      @protesilaos  5 หลายเดือนก่อน +1

      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.

  • @groultaria6732
    @groultaria6732 6 หลายเดือนก่อน

    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!

    • @protesilaos
      @protesilaos  6 หลายเดือนก่อน

      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

    • @groultaria6732
      @groultaria6732 6 หลายเดือนก่อน

      Thank you !

  • @horrorspidey7033
    @horrorspidey7033 6 หลายเดือนก่อน

    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.

    • @protesilaos
      @protesilaos  6 หลายเดือนก่อน

      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?

    • @horrorspidey7033
      @horrorspidey7033 6 หลายเดือนก่อน

      @@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

  • @thock_enjoyer
    @thock_enjoyer 7 หลายเดือนก่อน

    Are u friends with theodore alenas ?

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน

      No, I am not familiar with that name.

  • @randomsearches369
    @randomsearches369 7 หลายเดือนก่อน

    (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)))

    • @protesilaos
      @protesilaos  7 หลายเดือนก่อน

      Looks good, haha!