Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want emacs to be truly maximized on start up.

There are solutions to the problem - that just make emacs window screen-wide. That's not enough for me. I want emacs window do docked to the right upper corner of the screen - so that when I press there with a mouse - I will close emacs, not firefox or krusader - or what ever - which was maximized in the background.

I thried to do it with kwin - but no luck.

P.S. I'm using Kubuntu, end emacs is quite fresh one 23.2 or smth like that.

share|improve this question

migrated from stackoverflow.com Jun 8 '11 at 7:43

This question came from our site for professional and enthusiast programmers.

    
@user maximized or full screen - which do you want? Your second paragraph is a bit vague. –  David Jun 8 '11 at 20:08
    
There are some window manager dependent solutions. Which WM are you using? In Fluxbox, I use the ~/.fluxbox/apps file to set maximized preference for specific applications. –  Daniel Andersson Mar 29 '12 at 15:31
    
I'm using KWM (it's KDE's default one). It has option "maximised" - but emacs window is not truely maximized: if You'll press "x" at the top right corner with a mouse - You'll close something else - not emacs. –  Adobe Mar 29 '12 at 15:45
add comment

8 Answers

Put (w32-send-sys-command ?\xf030) on your .emacs file. I think it solves your problem.

share|improve this answer
    
That's cool, only though I'm working in linux. But still -- sometimes I have to work in windows too. Thanks. –  Adobe May 27 '13 at 3:53
    
I forgot to mention. This solution is only for Windows. –  Paulo Tomé May 27 '13 at 7:45
    
Yep, I see the w32 thing. –  Adobe May 27 '13 at 8:54
add comment
up vote -2 down vote accepted

I found that it's known and long standing bug of emacs (vim sufferst the same).

share|improve this answer
add comment

I found a funny solution:

emacs -nw

starts emacs in a console - and you can maximize console itself!

share|improve this answer
add comment

I use the following on Linux:

(defun my-frame-toggle ()
    "Maximize/Restore Emacs frame using 'wmctrl'."
    (interactive)
    (shell-command "wmctrl -r :ACTIVE: -btoggle,maximized_vert,maximized_horz"))

and then bind it to a key:

(global-set-key [(control f4)] 'my-frame-toggle)

If you want to start out maximized, you can just add a call to my-frame-toggle to the end of your .emacs file.

share|improve this answer
add comment

Here are two non-lisp ways to achieve the same:

1) Alias your emacs command to 'emacs -fs'. Add this line of code to your .bashrc file in your home directory: alias emacs='emacs -fs'

Personally, I don't like this approach because I wouldn't want emacs to startup in full screen all the time and would like some control.

2) My solution; In Ubuntu, you can assign a keyboard shortcut to 'full-screen' any window. This seems to be the most convenient and simple option. Besides, it has the advantage that the same shortcut also applies to all your applications.

share|improve this answer
add comment

If you would like to toggle fullscreen in emacs with the F11 key, add the following to .emacs:

;; the following should give fullscreen mode when F11 is depressed
(defun fullscreen ()
 (interactive)
 (set-frame-parameter nil 'fullscreen
              (if (frame-parameter nil 'fullscreen) nil 'fullboth))

If you want the fullscreen emacs to be very minimal (no tool bar, scroll bar, or menu bar, also add:

(progn
  (if (fboundp 'tool-bar-mode) (tool-bar-mode -1))  ;; no toolbar
  (menu-bar-mode -1) ;;no menubar
  (scroll-bar-mode -1) ;; no scroll bar
  )
)
share|improve this answer
add comment

I think emacs will respect gconf settings, so you could set /apps/emacs/maximize, but don't know if that will help on Kubuntu -- worth a try.

share|improve this answer
add comment

I've taken this from somewhere on emacswiki, some time ago. Note that I no longer use it, as I've switched to dwm to have everything fullscreen, but it used to work.

(defun fullscreen ()
       (interactive)
       (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
                 '(2 "_NET_WM_STATE_FULLSCREEN" 0)))

If you want it to run on startup, you should be able to add

(fullscreen)

to your .emacs

EDIT: Rereading your question, I think this is not what you want. This will go really fullscreen, not maximized: you will not have any close button.

This one should do:

(defun fullscreen (&optional f)
  (interactive)
  (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
             '(2 "_NET_WM_STATE_MAXIMIZED_VERT" 0))
  (x-send-client-message nil 0 nil "_NET_WM_STATE" 32
             '(2 "_NET_WM_STATE_MAXIMIZED_HORZ" 0)))

Now it's directly from http://www.emacswiki.org/emacs/FullScreen

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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