17

Is there any way I can move the mode line and the minibuffer from the bottom to the top of the screen?

The minibuffer is covered by the previous question How to display the content of minibuffer in the middle of the emacs frame?, so this question is primarily about the mode line.

I have just dropped my laptop and cracked the screen, so can't see much along the bottom row.

Mongus Pong
  • 537
  • 4
  • 14

2 Answers2

23

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 remove the mode-line.

Edit: If you want to use this setting permanently put

(setq-default header-line-format mode-line-format)

in your init file (thanks to nispio for that suggestion).

Since you also want the minibuffer to appear at the top, I will re-link @Malabarba's answer to the questionHow to display the content of minibuffer in the middle of the emacs frame? which can be adapted to show the minibuffer at the top. Also, consider @phils answer to the question Is it possible to move the emacs minibuffer to the top of the screen? on the "old" emacs tag on stackoverflow.

As far as I know, there is no way to directly put the minibuffer at the top. The only approach (which is also used by the above answers) is to use a second frame.

elemakil
  • 2,517
  • 1
  • 18
  • 26
  • 4
    If you are adding this to your init file, you will want to use `setq-default` instead of `setq`. – nispio Oct 21 '14 at 22:49
  • May I ask for the reason of the downvote? – elemakil Oct 22 '14 at 15:27
  • @elemakil The answer was wrong without the setq-default. Now it's right. :-) – Malabarba Oct 22 '14 at 16:57
  • (though technically it's now incomplete regarding the new details provided by the user) – Malabarba Oct 22 '14 at 17:21
  • @Malabarba I see. Thanks for clearing that up! :-) – elemakil Oct 22 '14 at 17:32
  • Thanks. Moving the mode line to the top of the window works very well. Setting (minibuffer . nil) in this initial-frame-alist causes emacs to create the minibuffer in a separate window. Setting the mini-buffer-frame-alist has no effect, I am using XMonad as a window manager so this is probably hindering the process. It is still a fairly quick process to move the window where I want it. – Mongus Pong Oct 22 '14 at 22:19
  • The results : http://imgur.com/NBiSKP1 – Mongus Pong Oct 22 '14 at 22:28
4

Your real question is how to make Emacs avoid the defective portion of your screen; the mode line and minibuffer are only what tends to end up unreadable.

Rather than moving them and leaving something else (like text) in the unreadable screen portion, the more clean and general solution is shrinking and moving the Emacs frame (i.e. what's usually called a window) so that it's completely contained in the good region of the screen.

As usual with Emacs, there are specific tools for that. The Maxframe library (Github home) is designed to automatically fill the whole screen with the Emacs frame, the opposite of what you need, but it exposes a useful mf-set-frame-pixel-size function, which can be called from the init file along with the standard set-frame-position function to place your frame in the proper position automatically when you open Emacs.

  • 1
    I support your point. But it's not necessary to hack a package. See [default-frame-alist](http://doc.endlessparentheses.com/Var/default-frame-alist). – Malabarba Oct 22 '14 at 17:03
  • @Malabarba On an unrelated note, about [doc.endlessparentheses.com](http://doc.endlessparentheses.com), why is only the second forward slash converted to ascii code? Example: I get `http://doc.endlessparentheses.com/Var%2F2C-window-width.html` when I click on `2C-window-width` [here](http://doc.endlessparentheses.com/variables.html#main_content). – Kaushal Modi Oct 22 '14 at 17:42
  • @kaushalmodi it's just a small bug in how the index is generated. You can use regular slashes on links and they'll work fine. I've fixed it locally, but regenerating the index takes hours, so I'm postponing it until emacs 25. :-) – Malabarba Oct 22 '14 at 18:02
  • 1
    @Malabarba: mf-set-frame-pixel-size is useful because the stock way to set frame height and width is by characters, not by pixels, which isn't very practical in this scenario. default-frame-alist and its relatives also measure in characters. – Lorenzo Gatti Oct 22 '14 at 20:16