Hot answers tagged

67

I have another method, which I have tested with Emacs 24.3 and 24.4, as well as on both Windows and GNU/Linux. I have placed the following in my init file: (add-to-list 'default-frame-alist '(fullscreen . maximized)) I believe this was modified slightly from a StackOverflow answer I found a while ago, but I can't seem to find it again now. Edit: Another ...


31

Emacs predates contemporary window-based operating systems, so its terminology also predates the current terms. Unfortunately, it means that new users and experienced users sometimes have trouble making themselves understood to each other, since they're using the terms in different ways. In brief: "Frames" are to Emacs what "windows" are to everything ...


30

Adjust the ...-frame-alist in your init file to tell Emacs how to maximize the frame. You also have multiple options for how, exactly, to maximize it. alist options You have two ...-frame-alist options: default-frame-alist (as in @Scott Weldon's answer) initial-frame-alist If you use default-frame-alist, it will maximize all frames: both the first one ...


28

On Emacs 24.4, (toggle-frame-maximized) toggles the maximized state of the current frame. See also, the Maximize Emacs on start up question on stackoverflow and the Full Screen page on the EmacsWiki.


23

The built in way to do this is with registers. For instance use C-xrwa to save the current window configuration to register a. Then you can use the built in binding C-x1 to run delete-other-windows after you're done looking at the single file, use C-xrja to pop back to the saved window configuration in register a. In short: C-xrwa (save config into ...


23

The file name as window name (setq-default frame-title-format '("%f")) The file name and the major mode as window name (my conf) (setq-default frame-title-format '("%f [%m]"))


22

GNU Emacs has built-in support for fullscreen since version 24.4. From the changelog: New commands toggle-frame-fullscreen and toggle-frame-maximized, bound to <f11> and M-<f10>, respectively. Note that you don't need to use the latest Emacs version just for this feature. Your window manager (KDE/KWin) is able to put any application ...


21

If you mean the number of windows regardless of which buffers are showing, then: (length (window-list)) will do it. Better still, you can just use the existing (count-windows) function. If you want to count the number of unique buffers visible in windows on the frame, then you can use: (length (cl-delete-duplicates (mapcar #'window-buffer (window-list)))) ...


20

I use winner-mode. Here's my setup: (winner-mode) (global-set-key [f7] 'winner-undo) (global-set-key [C-f7] 'winner-redo) (global-set-key [f9] 'delete-other-windows) (global-set-key [C-f9] 'delete-window) I don't know if there's a way to bookmark a layout or something, but being able to continuously switch back to previous layout is enough for me.


18

The content of the mode-line are stored in the variable mode-line-format. Emacs also supports a header line whose content is steered by the variable header-line-format. In principle you can use (setq header-line-format mode-line-format) (setq-default mode-line-format nil) to make the format of the header-line be equal to that of your current mode line and ...


16

If you're using a Window System, you might be able to use x-focus-frame. Note: x-focus-frame works for Windows as well as for Linux prior to Emacs 23.1, use w32-focus-frame on Windows.


15

Try this instead: (defun my-turn-current-window-into-frame () (interactive) (let ((buffer (current-buffer))) (unless (one-window-p) (delete-window)) (display-buffer-pop-up-frame buffer nil)))


14

I found a solution, and no longer I need transparent theme. The solution is : ;; set transparency (set-frame-parameter (selected-frame) 'alpha '(85 85)) (add-to-list 'default-frame-alist '(alpha 85 85))


12

The different sections of text you see in your Emacs are windows. You can, for example, create a new window with C-x 2. Yes, this terminology is confusing. It predates most GUI systems, so it's understandable if still confusing. But once we know we're talking about windows, we can do the changes you want. To get rid of all windows except the one that point ...


11

Emacs offers registers to save and apply data such as your current window configuration, this can be done with C-x r w and C-x r j. However this approach gets unwieldy since you need to remember the window registers. There are a few packages to improve this. iregister makes this basic feature more inspectable and interactive. The other ones I'm aware of use ...


11

If I've understood the question, here's a function that does what you want: (defun maybe-delete-frame-buffer (frame) "When a dedicated FRAME is deleted, also kill its buffer. A dedicated frame contains a single window whose buffer is not displayed anywhere else." (let ((windows (window-list frame))) (when (eq 1 (length windows)) (let ((buffer (...


11

I'm guessing that you are not really looking for a way to "execute the hook only once". I'm guessing that you are looking for a way to execute that particular function only once, whenever the hook is run. The conventional, and simple, answer to that question is for your function to remove itself from the hook, after carrying out the one-time action that ...


10

New recommendation (Jan 2017) neotree comes with default bindings of | for vertical split and - for horizontal split. The functions neotree-enter-horizontal-split and neotree-enter-vertical-split mentioned in my older recommendation below do not exist any more! Old recommendation (May 2015) Currently the i and I keys are not bound in neotree-mode-map. ...


10

One way would be to use ibuffer: Open ibuffer (I have it bound to a key, but M-x ibuffer will work.) Mark all modified buffers: * m Toggle the marks, so that unmodified buffers are marked instead: t Kill the marked buffers: D For frames, you can use delete-other-frames (C-x 5 1). If you do this often you may want to define your own command. Here's a ...


9

You need to configure the 600-pound gorilla that is display-buffer-alist which determines how display-buffer chooses where to display a buffer. It makes display-buffer-reuse-frames obsolete in newer emacsen. Here is a config that should guide you (atleast in emacs 24.3). ;; all buffers, try to reuse windows across all frames (add-to-list 'display-buffer-...


9

@Constantine's answer already covers how this can be achieved by modifying your init-file (if you use Emacs 24.4). If you start Emacs from the command line, from the dash, or from a launcher like Synapse or krunner, you can specify the -mm option (short for --maximized) to achieve the same result: emacs -mm The -mm option was first introduced in Emacs 23....


9

In emacs 26 you can set ns-use-proxy-icon (setq ns-use-proxy-icon nil) I was able to get a completely "clean" transparent title bar: Download emacs 26 for mac, add the following config to your .emacs, and restart emacs. (add-to-list 'default-frame-alist '(ns-transparent-titlebar . t)) (add-to-list 'default-frame-alist '(ns-appearance . dark)) ;; ...


8

You cannot do this using different themes. The solution is to create a theme that has different face definitions depending on the terminal. If you look at an example like font-lock-comment-face, you'll see how it works. Instead of specifying ((class color) (min-colors 88) (background dark)) you could also specifcy (type tty) or (type graphic) etc. The manual ...


8

You're almost there: other-window takes an optional second argument which, if it has the value t, says to cycle through windows on all frames. You can also use the symbol visible to consider only visible frames, or the integer 0 to consider only visible or iconified frames. So replace (other-window 1) by (other-window 1 t) or (other-window 1 'visible). ...


8

With a lot of hacky experimentation I was able to get #6 (using minibuffer text) to a 'good enough' working state. Here's a screenshot: There are several key parts to make this work: Inserting text into the minibuffer surprisingly almost does the right thing out of the box. Text inserted there will actually show up. By making the text be the 'after-string ...


8

It's not enough to just duplicate the frame (e.g. C-x 5 2). You need to clone the Info buffer. Open Info to the first place, then use M-n to clone the buffer. Then navigate in the new Info window (new buffer) to the second place. In other words, it should just work, but you need to use M-n to clone the buffer (getting a new, different buffer). If you don'...


7

In Emacs 24.4 you should be able to use (add-hook 'focus-out-hook #'turn-on-my-jabber-sound) (add-hook 'focus-in-hook #'turn-off-my-jabber-sound) (defun turn-on-my-jabber-sound () ;; t for `on' (setq my-jabber-sound 't)) (defun turn-off-my-jabber-sound () ;; nil for `off' (setq my-jabber-sound 'nil)) Then test if my-jabber-sound is t or nil when ...


7

Your included option of -c is causing this. Per the man page, -c, --create-frame create a new frame instead of trying to use the current Emacs frame. Remove this option from your command and Emacs should refrain from creating a new frame (AKA Window).


7

It is possible to split the frame's root window which encompasses both of your windows, thereby allowing you to add a third window at any side. There is no built-in command to do that though, so here's some example code to define commands for this particular task: (defun my-split-root-window (size direction) (split-window (frame-root-window) ...


7

I would point readers to (1) The glossaries of Emacs Wiki and (2) the Emacs manual for such information. Also to the EmacsWiki Newbie page, which has lots of good introductory information about such things. And to the Emacs manual in general, which also introduces such things well: C-h r then i followed by typing whatever you want to learn about, e.g., ...


Only top voted, non community-wiki answers of a minimum length are eligible