我的 .emacs 文件中有以下内容(感谢 SOer nikwin),它评估当前缓冲区内容并在另一个缓冲区中显示输出。
(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)))
问题是输出窗口占据了 emacs 屏幕的一半。有没有办法将输出窗口的高度设置为更小的值。我用谷歌搜索了 30 分钟左右,但找不到任何有用的东西。提前致谢。
最佳答案
只要源代码缓冲区的高度小于或等于框架高度的一半,它就会将源代码缓冲区扩展 20 行。非常粗糙,但它可以满足您的目的。
(defun shell-compile ()
(interactive)
(save-buffer)
(shell-command (concat "python " (buffer-file-name)))
(if (<= (* 2 (window-height)) (frame-height))
(enlarge-window 20)
nil))
关于python - Emacs shell 输出缓冲区高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2748880/