1 Byte

Emacs Smart Split

I spend a lot of time in front of Emacs in a terminal window, and I share my configuration across all my computers. At work I have a large monitor, so I split the emacs frame into 3 side-by-side 80-column windows. At home I have a smaller screen with room only enough for two windows. Sometimes I just use the laptop display. To share the same configuration file, I use the following snippet:

(defun smart-split ()
  "Split the frame into 80-column sub-windows, and make sure no window has
   fewer than 80 columns."
  (interactive)
  (defun smart-split-helper (w)
    "Helper function to split a given window into two, the first of which has 
     80 columns."
    (if (> (window-width w) (* 2 81))
    (let ((w2 (split-window w 82 t)))
      (smart-split-helper w2))))
  (smart-split-helper nil))

(smart-split)

The smart-split function split the emacs frame into a maximum number of 80-column windows. A very portable solution.


LeanCloud 在招聘以下职位:

  • 市场团队负责人
  • 运维团队负责人
  • 后端软件工程师(Clojure、Java)
  • Android 软件工程师

具体的需求以及其他正在招聘的职位请见我们的工作机会页面。除了在官网上可以看到的已经发布的产品外,我们也在开发让人兴奋的新产品,有很多有意义、有价值的工作。

如果转载本文,请包含招聘信息。