[Top][All Lists]

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

Re: Customize ‘window-state-get/put’

From: Juri Linkov
Subject: Re: Customize ‘window-state-get/put’
Date: Tue, 08 Oct 2019 01:01:14 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

> I’m adding the ability to store and restore window configuration for
> gdb-mi. To make it work for gdb-mi I need to change what
> ‘window-state-get’ save - now it saves buffers and I need to not save
> buffers. That’s because the buffer names for each window will change
> across gdb sessions debugging different programs. Instead of buffer
> name I need to store a symbol representing the ”buffer type” of the
> window. E.g., register, memory, breakpoint, etc.
> So instead of
>     (buffer "*scratch*"
>               (selected . t)
>               (hscroll . 0)
>               (fringes 8 8 nil)
>               (margins nil)
>               (scroll-bars nil 0 t nil 0 t)
>               (vscroll . 0)
>               (dedicated)
>               (point . #<marker at 193 in *scratch*>)
>               (start . #<marker at 1 in *scratch*>))
> I would store something like
>     (buffer 'register)
> I would just add an optional argument that handles the extraction of
> buffer information and another to restore a buffer from that
> information. Does it sound like a good idea?

Is this needed because of such dynamically generated buffer names?

  (defun gdb-memory-buffer-name ()
    (concat "*memory of " (gdb-get-target-string) "*"))

Not too long ago we discussed an idea of defining a “window layout” -
a data structure similar to the returned by ‘window-state-get’, but
where instead of buffer names there are buffer regexps, so when
‘display-buffer’ needs to display a buffer, it consults a predefined
layout, finds the right window in its window tree, and displays the
buffer in the window whose buffer regexp matches the displayed
buffer name.  A new function like ‘window-state-get’ could generate
a layout from the current window configuration, or even from the
window state.  Then such layout could be exported to anywhere:
saved in the init file, in packages, etc.

BTW, while you are working on gdb-mi, you could also try to replace
the ad-hoc tabs implemented in the header-line, with real tabs in
the tab-line for “Locals”, “Registers”, “Breakpoints”, “Threads”, etc.
Just display these buffers in their dedicated window, and the tab-line
will show them as tabs.

reply via email to

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