19

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.

4
  • By "status bar" do you mean the mode-line or the minibuffer?
    – Malabarba
    Commented Oct 22, 2014 at 10:42
  • 3
    Possible duplicate: How to display the content of minibuffer in the middle of the emacs frame?
    – Malabarba
    Commented Oct 22, 2014 at 10:44
  • @Malabarba Sorry I'm not 100% up on emacs terminology. I mean both. I cant see much at the bottom of the screen. Commented Oct 22, 2014 at 11:28
  • BTW, a different use case: I frequently take screen clippings of various apps, includinf emacs. Typically I want to show the contents of a file or buffer, and the mode line indicating the name of the file, etc. Frequently the window is much taller, I has many more lines than the file in the buffer. Rather than having a lot of blank space in the screen clip, or resizing the window to exactly match the buffer height, putting the mode line at the top is nice.
    – Krazy Glew
    Commented Sep 4 at 22:28

2 Answers 2

24

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.

7
  • 4
    If you are adding this to your init file, you will want to use setq-default instead of setq.
    – nispio
    Commented Oct 21, 2014 at 22:49
  • May I ask for the reason of the downvote?
    – elemakil
    Commented Oct 22, 2014 at 15:27
  • @elemakil The answer was wrong without the setq-default. Now it's right. :-)
    – Malabarba
    Commented Oct 22, 2014 at 16:57
  • (though technically it's now incomplete regarding the new details provided by the user)
    – Malabarba
    Commented Oct 22, 2014 at 17:21
  • @Malabarba I see. Thanks for clearing that up! :-)
    – elemakil
    Commented Oct 22, 2014 at 17:32
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.

4
  • 1
    I support your point. But it's not necessary to hack a package. See default-frame-alist.
    – Malabarba
    Commented Oct 22, 2014 at 17:03
  • @Malabarba On an unrelated note, about 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. Commented Oct 22, 2014 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
    Commented Oct 22, 2014 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. Commented Oct 22, 2014 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.