Maximize Emacs on start up? (not the fullscreen)

前端 未结 5 466
迷失自我
迷失自我 2020-12-10 11:17

It\'s common for me to press alt-f10 (in GNU/Linux) after Emacs start up for maximizing window (in the Emacs terminology, it\'s actually a frame). Most of the time I press t

5条回答
  •  忘掉有多难
    2020-12-10 11:54

    OSX:

    The developer build of Emacs Trunk has a function called toggle-frame-maximized, which is included within .../lisp/frame.el. That function can be added to the after-init-hook or emacs-startup-hook, or simply included in the .emacs file that gets loaded on startup. On OSX, it increases both width and height in one-fell-swoop.


    Windows XP:

    The following command can be used after a make-frame command, or after Emacs generates the initial frame.

    (w32-send-sys-command 61488)
    

    OSX and Windows

    Here is an example for setting the initial frame size and location -- I have it near the beginning of my .emacs file:

    (let ((frame (selected-frame)))
      (cond
        ((eq system-type 'darwin)
          (setq ns-auto-hide-menu-bar t)
          (set-frame-position frame 0 0) ;; must come after `ns-auto-hide-menu-bar`
          (cond
            ((and
                (= 1920 (display-pixel-width))
                (= 1080 (display-pixel-height)))
              (set-frame-size frame 1895 1054 t))
            ((and
                (= 1920 (display-pixel-width))
                (= 1200 (display-pixel-height)))
              (set-frame-size frame 1895 1174 t))
            ((and
                (= 1280 (display-pixel-width))
                (= 800 (display-pixel-height)))
              (set-frame-size frame 1265 774 t))) )
        ((and
            (eq system-type 'windows-nt)
            (equal (w32-version) '(5 1 2600)))
          ;; (w32-send-sys-command #xf030)
          (set-frame-position frame 0 0)
          (cond
            ((and
                (= 1920 (display-pixel-width))
                (= 1003 (display-pixel-height)))
              (set-frame-size frame 1898 924 t))
            ((and
                (= 1920 (display-pixel-width))
                (= 1123 (display-pixel-height)))
              (set-frame-size frame 1876 1052 t))
            ((and
                (= 1280 (display-pixel-width))
                (= 723 (display-pixel-height)))
              (set-frame-size frame 1250 670 t))))
          ((and
              (eq system-type 'windows-nt)
              (equal (w32-version) '(6 1 7601)))
            (set-frame-position frame 0 0)
            (cond
              ((and
                  (= 1920 (display-pixel-width))
                  (= 1080 (display-pixel-height)))
                (set-frame-size frame 1890 1003 t))
              (t
                (message "Not yet contemplated.")))) ))
    

    Here is an example of what I use to create new frames -- controling the exact size and location:

    (defun lawlist-make-frame (&optional alist)
      (let ((frame (make-frame alist)))
        (set-frame-position frame 0 0)
        (cond
          ((eq system-type 'darwin)
            (cond
              ((and
                  (= 1920 (display-pixel-width))
                  (= 1080 (display-pixel-height)))
                (set-frame-size frame 1895 1054 t))
              ((and
                  (= 1920 (display-pixel-width))
                  (= 1200 (display-pixel-height)))
                (set-frame-size frame 1895 1174 t))
              ((and
                  (= 1280 (display-pixel-width))
                  (= 800 (display-pixel-height)))
                (set-frame-size frame 1265 774 t))))
          ((and
              (eq system-type 'windows-nt)
              (equal (w32-version) '(5 1 2600)))
            (select-frame frame)
            (cond
              ((and
                  (= 1920 (display-pixel-width))
                  (= 1003 (display-pixel-height)))
                (set-frame-size frame 1898 924 t))
              ((and
                  (= 1920 (display-pixel-width))
                  (= 1123 (display-pixel-height)))
                (set-frame-size frame 1876 1052 t))
              ((and
                  (= 1280 (display-pixel-width))
                  (= 723 (display-pixel-height)))
                (set-frame-size frame 1250 670 t))))
          ((and
              (eq system-type 'windows-nt)
              (equal (w32-version) '(6 1 7601)))
            (select-frame frame)
            (cond
              ((and
                  (= 1920 (display-pixel-width))
                  (= 1080 (display-pixel-height)))
                (set-frame-size frame 1890 1003 t))
              (t
                (message "Not yet contemplated.")))) )))
    

提交回复
热议问题