How to change size of split screen emacs windows?

后端 未结 7 494
无人共我
无人共我 2020-11-28 00:34

I have emacs split horizontally - on top I\'m editing Perl code, the bottom is the shell. By default emacs makes the two windows equal in size, but I\'d like the shell buffe

7条回答
  •  孤城傲影
    2020-11-28 00:59

    I got the same question. Here is my solution.
    First I define a new function:

    (defun buffer-resize ()
      (delete-other-windows)
      (split-window-vertically (floor (* 0.68 (window-height))))
      (other-window 1)
      (switch-to-buffer buf)
      (other-window 1))
    

    For example, I want to run-scheme in a buffer, So I rewrite it.
    And here is the definition, with the function defined earlier:

    (defun run-scheme-here ()
      "Run a new scheme process at the directory of the current buffer.
       If a process is already running, switch to its buffer."
      (interactive)
      (let* ((proc (format "scheme: %s" default-directory))
             (buf (format "*%s*" proc)))
        (unless (comint-check-proc buf)
          (let ((cmd (split-string scheme-program-name)))
            (set-buffer
             (apply 'make-comint-in-buffer proc buf (car cmd) nil (cdr cmd)))
            (inferior-scheme-mode)
            (buffer-resize)))
        (pop-to-buffer buf)))
    

    So now when I enter: M-x run-scheme-here, the buffer is resized!
    And here is my config file, hoping this will help. https://github.com/judevc/dotfiles/blob/master/.emacs.d/scheme-conf.el

提交回复
热议问题