unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jamie Beardslee <jdb@jamzattack.xyz>
To: help-gnu-emacs@gnu.org
Subject: Re: Scratch buffer on either side of current buffer
Date: Sat, 21 Nov 2020 18:02:44 +1300	[thread overview]
Message-ID: <87a6vbz4i3.fsf@jamzattack.xyz> (raw)
In-Reply-To: trinity-c890399e-dc37-404c-a6e7-bf1f86610d3c-1605922892925@3c-app-mailcom-bs01

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	other threads:[~2020-11-21  5:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-21  1:41 Scratch buffer on either side of current buffer Christopher Dimech
2020-11-21  5:02 ` Jamie Beardslee [this message]
2020-11-21 14:09   ` Christopher Dimech
2020-11-21 14:52     ` Yuri Khan
2020-11-21 15:43       ` Christopher Dimech
2020-11-21 16:03         ` Yuri Khan
2020-11-21 16:12           ` Christopher Dimech
2020-11-21 16:43             ` Christopher Dimech
2020-11-21 19:50           ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a6vbz4i3.fsf@jamzattack.xyz \
    --to=jdb@jamzattack.xyz \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).