Hot answers tagged

108 votes
Accepted

How to maximize my Emacs frame on start-up?

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 '(...
user avatar
  • 2,615
48 votes
Accepted

What's the difference between a buffer, a file, a window, and a frame?

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 ...
user avatar
  • 31.2k
41 votes

How to maximize my Emacs frame on start-up?

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 ...
user avatar
  • 31.2k
38 votes
Accepted

How to change the frame title from `emacs@host` to visited file name

The file name as frame name (setq-default frame-title-format '("%f")) The file name and the major mode as frame name (my conf) (setq-default frame-title-format '("%f [%m]")...
user avatar
  • 3,056
34 votes

How to maximize my Emacs frame on start-up?

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.
user avatar
  • 8,992
28 votes
Accepted

Switching between window layouts

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 ...
user avatar
25 votes
Accepted

How to toggle fullscreen in Emacs GUI mode (`Full Screen` option is greyed out in Kubuntu)?

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>, ...
user avatar
  • 1,886
24 votes

Switching between window layouts

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-...
user avatar
  • 13.6k
24 votes
Accepted

How to count all of the windows in a frame?

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 ...
user avatar
  • 31.2k
23 votes
Accepted

Moving the mode line and minibuffer to the top

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 (...
user avatar
  • 2,457
19 votes
Accepted

Quick way to close all but one window, and then revert to previous window setup?

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 ...
user avatar
  • 8,629
17 votes
Accepted

Is there a transparent theme?

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 ...
user avatar
17 votes
Accepted

Can you activate/(bring to front) emacs using native elisp? (e.g when working in another program)

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.
user avatar
16 votes
Accepted

"Pop" a window into a frame

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 ...
user avatar
  • 21.1k
15 votes

How to remove the icon in the titlebar?

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 ....
user avatar
  • 311
14 votes
Accepted

How to set emacs frame size by pixels

I have a screen with resolution of 1024X600, but i set the display to 1024X724, here is my solution. (setq frame-resize-pixelwise t) (set-frame-position (selected-frame) 0 0) (set-frame-size (...
user avatar
  • 1,165
13 votes

How to maximize my Emacs frame on start-up?

To startup Emacs maximised, add to your init file: ;; Start maximised (cross-platf) (add-hook 'window-setup-hook 'toggle-frame-maximized t) In case you want to go full screen or, as they say now, ...
user avatar
  • 1,638
12 votes

Running Emacs from Windows taskbar

I stumbled on another answer to the problem on SuperUser today. It seems more hackish, but the result is more consistent with other programs on Windows. Run runemacs.exe with no pre-existing ...
user avatar
  • 391
12 votes
Accepted

Kill buffer when frame is deleted

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 ...
user avatar
  • 19.4k
11 votes

Switching between window layouts

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 ...
user avatar
  • 21.1k
11 votes

How to maximize my Emacs frame on start-up?

@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 ...
user avatar
  • 14.3k
11 votes
Accepted

Is there any way to run a hook function only once?

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 ...
user avatar
  • 70.3k
11 votes

What's the difference between a buffer, a file, a window, and a frame?

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 ...
user avatar
  • 70.3k
11 votes
Accepted

Get a reference for the current frame

You can use selected-frame and selected-window to get the current frame and window. Also see the focus-in-hook an focus-out-hook hooks (new in Emacs 24.4) if you want to take some action when a frame ...
user avatar
  • 19.4k
11 votes
Accepted

How can I kill all unmodified buffers / files and delete their related frames?

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 ...
user avatar
  • 19.4k
10 votes
Accepted

How can I block a frame from being split?

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 ...
user avatar
  • 3,836
10 votes
Accepted

Neotree open file in split window

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 ...
user avatar
  • 24.3k
10 votes
Accepted

Disable scrollbar on new frame

I also ran into this issue, until I added the following code. (I believe I came across the snippet here on Stack Exchange, but sorry I don't recall the author.) (defun my/disable-scroll-bars (frame) ...
user avatar
  • 1,279
9 votes
Accepted

How to prevent emacsclient starting a new frame every time?

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 ...
user avatar
  • 398
9 votes

Different themes for terminal and graphical frames when using Emacs daemon

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'...
user avatar

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