That is “against the rules”, as switch-to-buffer is a user-facing command. However, it also guards against (some) misbehaving commands you may encounter: those that call out to switch-to-buffer programmatically. Now Emacs treats manual buffer switching the same as programmatic switching. ( setq switch-to-buffer-obey-display-actions t) I recommend you set this: Requires Emacs 27+ If you effect a window switch yourself with C-x b, it’s manual - and exempt from any display action rules you create yourself. Switching is done with C-x b (or its sibling commands, like C-x 4 b) and it is the default user-facing key binding for switching a window’s buffer.īy default Emacs distinguishes between automatic and manual window switching. There is a subtle but important distinction between displaying a buffer and switching to it. Important Terminology and Concepts Switching Buffers If you use my snippets of templates and examples you can use them as a starting point for your own window excursions. Yet they’re enough to put you firmly in the driver’s seat.Īnd the best thing about it all? Experimenting with it is easy and interactive. These four concepts give you near-complete control of all aspects of Emacs’s window management, and that’s not even everything. You can also dictate if you can switch to windows with C-x o, or even prevent Emacs from deleting a window, and thus preserve your layout, even if you use C-x 1. Using a regular expression you can command all python buffers to appear only in open windows that already have python mode buffers you can order M-x eshell to always pop up a new window, no matter what or insist that M-x compile buffers appear as a side bar on the right-hand side of your screen, and that it must never change your selected window’s buffer. And package authors can still suggest a preferred layout that you can override if you want to. Much like Emacs’s reformed minibuffer completion system you’re able to precisely control how Emacs creates and shapes windows using a tiered system of overrides. Override window and buffer placementĪlmost all window customization now involve one – albeit elephantine – variable that controls all of it. And thanks to a handy command, you can toggle the sidebars to hide or show them all at once. With a sidebar you can finally dedicate sides of a frame to specialized buffers, like the Calendar, Org Agenda, Compilation Output, GDB, you name it. Sidebars are like their kin in other IDEs: they are a full-length (or full-width) windows that resist switching and splitting. You can now attach a window to one of the four sides of a frame: left, right, top or bottom. This feature solves another common complaint: that it’s easy to screw up a perfectly manicured window layout – like gdb’s debug view, M-x calc, your fancy Org agenda setup, and so on – because you accidentally switched buffers in one of them. And if you switch to a buffer that belongs to a dedicated window, Emacs selects the dedicated window instead. Dedicated windows are locked to the buffer it was dedicated to, and so any attempt to switch its buffer will merely display that buffer in another window. It does come with a couple of limitations, but it’s still a great feature. When you call C-x 0 and delete an atomic (ugh) window, all other windows that belong to that cohort also disappear. You can now group windows so certain commands that affect one now affect all of them. So here’s a snapshot of what is possible today: Grouping Windows That means you may not need a third-party window management library – if you ever tried to use one, that is – for most things. Modern Emacs is now able to mirror the paneling so beloved of IDE users, and without the tears! And you can easily control how or where buffers and windows must go, giving you even more control over your Emacs experience. Historically it was a rather difficult affair to control window and buffer placement as you’d have to rein in a cavalcade of variables and functions and hope they did what you wanted. They’re one of Emacs’s greatest assets, and they’re highly configurable. M-x tab-bar-mode adds tab-style window configurations to Emacs, and M-x tab-line-mode a way of browsing visible buffers.īack to windows. Later on, tabs also joined the family business. But few do, and the baleful support for frames in regular window managers nix any temptation to make it work. Frames are just that much harder to deal with - unless you’re using an actual tiling window manager, of course. I’m sure you, like me, eschew frames in favor of windows. And thanks to a number of consolidations and improvements, it’s no longer the indomitable black box it once was.Īt some point in the distant past, Emacs got into the business of handling frames. There, it’s out now I said it now everybody knows. Emacs is a fantastic tiling window manager, and not enough people know that.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |