all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* desktop.el and frame parameters when -nw
@ 2018-07-25  2:03 Jay Kamat
  2018-07-25 14:30 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Jay Kamat @ 2018-07-25  2:03 UTC (permalink / raw)
  To: Help GNU Emacs

Hi!

I'm running into an odd issue, and I'd like to see if anyone else has seen it
before (or knows any way to solve it).

When desktop.el saves/loads a session, it normally saves and loads the 'frame
parameters' (set with `set-frame-parameter' and `frame-parameter'). However,
when starting emacs with -nw (in a terminal, with no gui), these frame
parameters don't seem to be restored.

Steps I took to reproduce:

1. Start emacs -q
2. Eval (set-frame-parameter nil 'test 44)
3. M-x desktop-save to an unused directory.
4. emacs -q -nw
5. M-x desktop-change-dir to the directory from before
6. (frame-parameter nil 'test) returns nil.

However, running steps 4->6 without -nw returns the frame parameter as
expected.

Does this have anything to do with the special ways that frames are handled in
a terminal? If so, what can I do to work around that?

-Jay



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: desktop.el and frame parameters when -nw
@ 2018-07-25  6:33 martin rudalics
  2018-07-25 14:29 ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: martin rudalics @ 2018-07-25  6:33 UTC (permalink / raw)
  To: jaygkamat; +Cc: help-gnu-emacs

 > When desktop.el saves/loads a session, it normally saves and loads the 'frame
 > parameters' (set with `set-frame-parameter' and `frame-parameter'). However,
 > when starting emacs with -nw (in a terminal, with no gui), these frame
 > parameters don't seem to be restored.

I suppose this is due to desktop.el's

(defun desktop-restoring-frameset-p ()
   "True if calling `desktop-restore-frameset' will actually restore it."
   (and desktop-restore-frames desktop-saved-frameset (display-graphic-p) t))

Try removing the (display-graphic-p).  But I'm quite confident that
this will get you into lots of other troubles.

martin



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: desktop.el and frame parameters when -nw
  2018-07-25  6:33 martin rudalics
@ 2018-07-25 14:29 ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2018-07-25 14:29 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Wed, 25 Jul 2018 08:33:40 +0200
> From: martin rudalics <rudalics@gmx.at>
> Cc: help-gnu-emacs@gnu.org
> 
> (defun desktop-restoring-frameset-p ()
>    "True if calling `desktop-restore-frameset' will actually restore it."
>    (and desktop-restore-frames desktop-saved-frameset (display-graphic-p) t))
> 
> Try removing the (display-graphic-p).  But I'm quite confident that
> this will get you into lots of other troubles.

Neither do I.  I think we need to look into this more carefully, as
that test wasn't added there by chance.  And there _are_ frame
parameters which we do NOT want to restore in TTY frames.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: desktop.el and frame parameters when -nw
  2018-07-25  2:03 desktop.el and frame parameters when -nw Jay Kamat
@ 2018-07-25 14:30 ` Eli Zaretskii
  2018-07-26  3:02   ` Jay Kamat
  0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2018-07-25 14:30 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Jay Kamat <jaygkamat@gmail.com>
> Date: Tue, 24 Jul 2018 19:03:44 -0700
> 
> When desktop.el saves/loads a session, it normally saves and loads the 'frame
> parameters' (set with `set-frame-parameter' and `frame-parameter'). However,
> when starting emacs with -nw (in a terminal, with no gui), these frame
> parameters don't seem to be restored.
> 
> Steps I took to reproduce:
> 
> 1. Start emacs -q
> 2. Eval (set-frame-parameter nil 'test 44)
> 3. M-x desktop-save to an unused directory.
> 4. emacs -q -nw
> 5. M-x desktop-change-dir to the directory from before
> 6. (frame-parameter nil 'test) returns nil.
> 
> However, running steps 4->6 without -nw returns the frame parameter as
> expected.

Why do you need such frame parameters restored when you start Emacs
with -nw?  IOW, what is your real-life use case, and why cannot you
start Emacs without -nw, and then create a TTY frame in that session?



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: desktop.el and frame parameters when -nw
  2018-07-25 14:30 ` Eli Zaretskii
@ 2018-07-26  3:02   ` Jay Kamat
  2018-07-27  9:11     ` Eli Zaretskii
  0 siblings, 1 reply; 6+ messages in thread
From: Jay Kamat @ 2018-07-26  3:02 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs


Hi Eli, Martin,

Eli Zaretskii writes:

> Why do you need such frame parameters restored when you start Emacs
> with -nw?  IOW, what is your real-life use case, and why cannot you
> start Emacs without -nw, and then create a TTY frame in that session?

I use a package called 'eyebrowse' which stores information about workspaces
in the frame parameters. Because this data is not saved and restored, my
eyebrowse workspaces get lost in tty frames after an Emacs quit. I'm trying to
run Emacs on a remote server with no graphical interface at all, so I don't
think I'll be able to run the gui version and open a frame (without installing
all of X).

I'm not sure why eyebrowse stores it's information in the frame parameters...

> I suppose this is due to desktop.el's
>
> (defun desktop-restoring-frameset-p ()
>    "True if calling `desktop-restore-frameset' will actually restore it."
>    (and desktop-restore-frames desktop-saved-frameset (display-graphic-p) t))
>
> Try removing the (display-graphic-p). But I'm quite confident that this will
> get you into lots of other troubles.

Thanks for the pointer! I was able to come up with this:

(unless (display-graphic-p)
  (setq desktop-restore-forces-onscreen nil)
  (defun desktop-restoring-frameset-p ()
    "True if calling `desktop-restore-frameset' will actually restore it.

Removes graphical from the list of required parameters."
    (and desktop-restore-frames desktop-saved-frameset t)))

I'm not sure why I needed to set `desktop-restore-forces-onscreen' to nil, but
I was getting errors without it. With this though, I'm getting the expected
behavior. I'll remember to disable this if I run into any odd issues or
breakages though. Hopefully the gui frame parameters that I shouldn't be
restoring isn't a problem since the desktop sessions I'm loading from are
terminal-only (for now at least).

-Jay



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: desktop.el and frame parameters when -nw
  2018-07-26  3:02   ` Jay Kamat
@ 2018-07-27  9:11     ` Eli Zaretskii
  0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2018-07-27  9:11 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Jay Kamat <jaygkamat@gmail.com>
> Cc: help-gnu-emacs@gnu.org
> Date: Wed, 25 Jul 2018 20:02:57 -0700
> 
> > Try removing the (display-graphic-p). But I'm quite confident that this will
> > get you into lots of other troubles.
> 
> Thanks for the pointer! I was able to come up with this:
> 
> (unless (display-graphic-p)
>   (setq desktop-restore-forces-onscreen nil)
>   (defun desktop-restoring-frameset-p ()
>     "True if calling `desktop-restore-frameset' will actually restore it.
> 
> Removes graphical from the list of required parameters."
>     (and desktop-restore-frames desktop-saved-frameset t)))
> 
> I'm not sure why I needed to set `desktop-restore-forces-onscreen' to nil, but
> I was getting errors without it. With this though, I'm getting the expected
> behavior. I'll remember to disable this if I run into any odd issues or
> breakages though. Hopefully the gui frame parameters that I shouldn't be
> restoring isn't a problem since the desktop sessions I'm loading from are
> terminal-only (for now at least).

The reason for the condition you removed is that restoring the
frameset on TTYs which were saved in a GUI session triggers bugs.  If
you don't care about those bugs, fine.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-07-27  9:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-25  2:03 desktop.el and frame parameters when -nw Jay Kamat
2018-07-25 14:30 ` Eli Zaretskii
2018-07-26  3:02   ` Jay Kamat
2018-07-27  9:11     ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2018-07-25  6:33 martin rudalics
2018-07-25 14:29 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.