emacs-devel
[Top][All Lists]
Advanced

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

Re: Tabs are ready?


From: martin rudalics
Subject: Re: Tabs are ready?
Date: Fri, 03 Feb 2012 19:24:20 +0100

> Could you please provide examples of using side windows and atomic windows?

To make an atomic window use

(defun display-buffer-in-atom-window (buffer alist)
  "Display BUFFER in an atomic window.
This function displays BUFFER in a new window that will be
combined with an existing window to form an atomic window.  If
the existing window is already part of an atomic window, add the
new window to that atomic window.  Operations like `split-window'
or `delete-window', when applied to a constituent of an atomic
window, are applied atomically to the root of that atomic window.

ALIST is an association list of symbols and values.  The
following symbols can be used.

`window' specifies the existing window the new window shall be
  combined with.  Use `window-atom-root' to make the new window a
  sibling of an atomic window's root.  If an internal window is
  specified here, all children of that window become part of the
  atomic window too.  If no window is specified, the new window
  becomes a sibling of the selected window.

`side' denotes the side of the existing window where the new
  window shall be located.  Valid values are `below', `right',
  `above' and `left'.  The default is `below'.

The return value is the new window, nil when creating that window
failed."
  (let ((ignore-window-parameters t)
        (window-combination-limit t)
        (window (cdr (assq 'window alist)))
        (side (cdr (assq 'side alist)))
        new)
    (setq window (window-normalize-window window))
    ;; Split off new window
    (when (setq new (split-window window nil side))
      ;; Make sure we have a valid atomic window.
      (window-make-atom (window-parent window))
      ;; Display BUFFER in NEW.
      (display-buffer-record-window 'window new buffer)
      (window--display-buffer-2 buffer new display-buffer-mark-dedicated)
      (set-window-prev-buffers new nil)
      ;; Return NEW.
      new)))

To see the effect try

(display-buffer-in-atom-window (current-buffer) '((side . above)))

and afterwards do C-x 3 and then C-x 0.

I'm currently simplifying the side windows code so I would have to send
you the new functions.  But I don't have any good documentation ready
for them yet.

martin



reply via email to

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