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: Christopher Dimech
Subject: Re: Scratch buffer on either side of current buffer
Date: Sat, 21 Nov 2020 15:09:11 +0100

Have modified it like below, but is not weird enough yet.

I would like only to set the size of the two scratch buffers to
be small by default (e.ge size 8), and my working buffer to stay
in as my working buffer and take the remaining space in the middle
of the screen.

(defun gungadin-buffer (&optional width)
   (interactive
      (list (when current-prefix-arg
         (prefix-numeric-value current-prefix-arg))) )
   (let ((buffer (current-buffer))
      ;; ----- body of let -----
      (scratch (get-buffer-create "*scratch*"))
      (width (or width 8)))
      (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)) ))



> Sent: Saturday, November 21, 2020 at 6:02 AM
> From: "Jamie Beardslee" <jdb@jamzattack.xyz>
> To: help-gnu-emacs@gnu.org
> Subject: Re: Scratch buffer on either side of current buffer
>
> 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]