Open Sbozzolo opened 7 years ago
I think I have to check the source of desktop-save-mode first. Please wait a few days.
I have the following configuration for desktop-mode, which is working as expected for me.
(require 'desktop)
(setq desktop-save 1
desktop-load-locked-desktop t
desktop-dirname user-emacs-directory
desktop-restore-frames nil
;; Don't save remote files and/or *gpg files.
desktop-files-not-to-save "\\(^/[^/:]*:\\|(ftp)$\\)\\|\\(\\.gpg$\\)")
(desktop-save-mode 1)
With desktop-restore-frames nil
most of the problems vanish, but the window configuration isn't restored between sessions.. which is a pity I've notices these variables introduced in emacs 24.4: desktop-restore-reuses-frames' and
desktop-restore-in-current-display`, maybe they can do the work? In my tests the only working workaround is the one reported by @bvk and changing the value of those variable doesn't fix the issue, but maybe I'm missing something.
Thanks @bvk, your method is quite inspiring. However to restore window layouts the frames must be restored altogether, that is, desktop-restore-frames
has to be enabled.
I suppose there is a bug in Emacs that prevents some frame parameters from getting updated. I don't have enough time to investigate this problem yet but the changes I made in 4c043471c5e2b3c45e94bd98a3a5b6f83283fc39 should resolve the problems here.
With @ch11ng latest commit things got better (the frame doesn't resize anymore) but I am still having the problem of the increasing number of workspaces every time I start emacs if exwm-workspaces-number
is set.
@Sbozzolo The problem seems to be that the restoring process of frames is a bit disordered. When EXWM is initializing not all the frames are created. One solution is to detect desktop-saved-frameset
to decide how many frames will be created but it's dirty, besides there is one input focus problem. It'd be better if we can make sure EXWM is only initialized after all frames are restored.
When using desktop-mode-save on the latest master branch it does restore the buffers and frames but only if they are standard emacs buffers, ie: Not EXWM GUI applications. It also flickers for about 30seconds whilst loading and takes a while to restore, but if does restore even pdftools buffers load.
It would be nice if it doesn't flicker and if it could remember which GUI application I have loaded in which buffer and start them up again. Like terminator in this buffer and google-chrome in that one. That would save a lot of time every time I start up my machine.
I guess we have to support XSMP. See XSM(1) if it works.
I encountered a similar problem regarded desktop mode and frame restoring. I found a way to solve the issue. The desktop is restored with after-init-hook. So if we enable exwm after that, we can avoid the problem. For example as follow,
(add-hook 'after-init-hook
(lambda ()
(exwm-randr-enable)
(exwm-cm-enable)
;(exwm-systemtray-enable)
(exwm-config-default))
t)
I suggest to change the recommended/example configuration with something like this.
@hying-caritas Which problem were you addressing? EXWM is initialized in window-setup-hook
and after-make-frame-functions
. The former is run after after-init-hook
so the problem might be after-make-frame-functions
which is only intended for sessions initiated by emacsclient and can be triggered before after-init-hook
. You may try if removing the line in exwm.el reading (add-hook 'after-make-frame-functions #'exwm-init t)
works for you.
I use exwm in mate desktop environment with mate panel. If I created several frames, then after restart emacs, some frames will not fill the screen. That is, there is space between panel and frame with the same size of panel. After delaying exwm-init in my way or in your way (change exwm.el), the problem disappears.
@hying-caritas I've pushed 21351f6be32d6867edbf887cfb12c5c9d73873c6 to address your issue.
Thanks a lot! That resolved my issue.
I can't get EXWM to work with desktop-save-mode, I've searched for known incompatibility but i found none. I am using version 0.12 of EXWM (almost default configuration) with Emacs 25.1.1 on top a Fedora 25 system, when I start a new emacs session I want it to load buffers, points, registers, histories, ecc, I had before quitting the previous time. I used to accomplish this task with desktop-save-mode and savehist, but this had become impossible with EXWM. I am experiencing these problems when I set
(desktop-save-mode 1)
desktop-read
adds new workspaces, resizes the frame, and disableM-x
. On the other side, Emacs + EXWM works like a charm when I am not using dekstop-save-mode.