help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scratch buffer on either side of current buffer


From: Jamie Beardslee
Subject: Re: Scratch buffer on either side of current buffer
Date: Sat, 21 Nov 2020 18:02:44 +1300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Christopher Dimech <dimech@gmx.com> writes:

> I want to have a window-buffer (containing *scratch*) on each side of
> my current buffer.

Here, try this:

(defun weird-window-configuration-please (&optional width)
  "Split the frame into three windows.
The current buffer is placed in the middle, and the \"*scratch\"
buffer is placed on either side, with WIDTH columns.  WIDTH is 80
by default, and can be specified by a prefix argument (C-u)."
  (interactive (list (when current-prefix-arg
                       (prefix-numeric-value current-prefix-arg))))
  (let ((buffer (current-buffer))
        (scratch (get-buffer-create "*scratch*"))
        (width (or width 80)))
    (delete-other-windows)
    (with-selected-window (split-window nil (- width) 'left)
      (switch-to-buffer scratch))
    (with-selected-window (split-window nil width 'right)
      (switch-to-buffer scratch))))

--
Jamie




reply via email to

[Prev in Thread] Current Thread [Next in Thread]