i have the following in my .emacs file(thanks to SOer nikwin), which evaluates the current buffer content and displays the output in another buffer.
(defun shell-compile ()
(interactive)
(save-buffer)
(shell-command (concat "python " (buffer-file-name))))
(add-hook 'python-mode-hook
(lambda () (local-set-key (kbd "\C-c\C-c") 'shell-compile)))
The problem is that the output window takes half the emacs screen. Is there any way to set the output windows's height to something smaller. I googled for 30mins or so and could not find anything that worked. Thanks in advance.
This expands the source code buffer by 20 lines whenever its height is less than or equal to half the frame's height. Pretty crude, but it may serve your purpose.
(defun shell-compile ()
(interactive)
(save-buffer)
(shell-command (concat "python " (buffer-file-name)))
(if (<= (* 2 (window-height)) (frame-height))
(enlarge-window 20)
nil))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With