unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Bruno Barbier <brubar.cs@gmail.com>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Re: How to force display-buffer-in-side-window to open side window on right?
Date: Thu, 2 Feb 2023 22:38:01 +0300	[thread overview]
Message-ID: <Y9wRGayaUCcQgXUp@protected.localdomain> (raw)
In-Reply-To: <63dbfcd2.050a0220.79573.311d@mx.google.com>

* Bruno Barbier <brubar.cs@gmail.com> [2023-02-02 21:13]:
> 
> Jean Louis <bugs@gnu.support> writes:
> 
> >
> > What am I doing wrong?
> 
> At least the following line is wrong:
> 
>    	   (display-buffer-in-side-window buffer-right '(side right))
> 
> it should be:
> 
>        (display-buffer-in-side-window buffer-right '((side . right)))

Thank you, that is good to understand.

Though I can see tha windows are not equal. So I changed it to:
  (switch-to-buffer-other-window buffer-right)))

and now it works well, but I am not sure how would that be affected by
user options.

(defun rcd-two-windows (buffer-left buffer-right &optional window-register)
  "Display BUFFER-LEFT and BUFFER-RIGHT only.

Previous window configuration is saved register ?r or to optional
WINDOW-REGISTER.

Parent function may restore window configuration by using the
function `jump-to-register' with WINDOW-REGISTER as argument."
  (cond ((and (buffer-live-p buffer-left) (buffer-live-p buffer-right))
	 (let ((register (or window-register ?r)))
	   (window-configuration-to-register register)
	   (switch-to-buffer buffer-left)
	   (delete-other-windows)
	   ;; (display-buffer-in-side-window buffer-right '((side . right)))))
	   (switch-to-buffer-other-window buffer-right)))
	(t (user-error "Buffers `%s' and `%s' must be live" buffer-left buffer-right))))


(let ((buffer-left (get-buffer-create "*My Left*"))
      (buffer-right (get-buffer-create "*My Right*")))
  (rcd-two-windows buffer-left buffer-right))

-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



      reply	other threads:[~2023-02-02 19:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02  5:46 How to force display-buffer-in-side-window to open side window on right? Jean Louis
2023-02-02  6:10 ` Bruno Barbier
2023-02-02 19:38   ` Jean Louis [this message]

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=Y9wRGayaUCcQgXUp@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=brubar.cs@gmail.com \
    --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).