[Top][All Lists]

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

Re: Window configurations

From: Ken Hori
Subject: Re: Window configurations
Date: Sun, 2 May 2010 20:31:56 -0700


My point was that you wound't be able to open a file without
knowing buffer-file-name once emacs gets closed. In particular,
if a window-configuration-sexp doesn't contain such a thing as
buffer-file-name, you wound't be able to reconstruct

> (setq buffer1 (find-file-noselect "<file-path>"))

since <file-path> gets lost upon exit. Of course you can
store <file-path> for each file buffer "somewhere", but I
thought the point of having window-configuration-sexp's is to
save that kind of extra work and provide a canonical way of
restoring frame states.

I was hoping that ideally emacs would hold buffer-file-name's in
the sexp and let the user specify a "buffer-recovery-function" to
recover a frame state as well as buffers, so that, hypothetically,

  a-window-configuration-sexp 'live-p  #'find-file-noselect)

would restore buffers as well as a window configuration.

On Sun, May 2, 2010 at 1:28 PM, Juri Linkov <address@hidden> wrote:
>> Could we add as an extra `buffer-file-name' alist element in the sexp
>> of a window-configuration or is that a bad idea? (I was just tring to
>> reconstruct a window-configuration after an emacs reboot but quickly
>> found out filenames weren't just there.)
> I think that information about file names is redundant.
> To restore file buffers in windows of the saved window configuration,
> you can prepare buffers (open files, call packages that create special
> buffers, etc.), keep their buffer objects and use them later during
> restoring the saved window configuration.  For instance,
> (setq buffer1 (find-file-noselect "file1.txt"))
> (setq buffer2 (find-file-noselect "file2.txt"))
> (set-window-configuration-from-list
>  '(window-configuration
>     (frame-cols . 80)
>     (frame-lines . 41)
>     (window
>       (buffer . buffer1)
>       (left-col . 0)
>       (top-line . 5)
>       (total-cols . 86)
>       (total-lines . 35)
>       ...)
>     (window
>       (buffer . buffer2)
>       (left-col . 0)
>       (top-line . 5)
>       (total-cols . 86)
>       (total-lines . 35)
>       ...)))
> This is basically what desktop.el does: it restores buffers, and later
> it can restore window configurations using restored buffer names.
> --
> Juri Linkov
> http://www.jurta.org/emacs/

reply via email to

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