GNU bug report logs - #30421
25.3; desktop.el: Steal lock when no living "emacs" process owns it

Previous Next

Package: emacs;

Reported by: Pierre Neidhardt <ambrevar <at> gmail.com>

Date: Sun, 11 Feb 2018 09:55:02 UTC

Severity: wishlist

Found in version 25.3

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #53 received at 30421 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Pierre Neidhardt <ambrevar <at> gmail.com>
Cc: 30421 <at> debbugs.gnu.org, npostavs <at> users.sourceforge.net
Subject: Re: bug#30421: 25.3;
 desktop.el: Steal lock when no living "emacs" process owns it
Date: Sat, 17 Feb 2018 09:43:41 +0200
> From: Pierre Neidhardt <ambrevar <at> gmail.com>
> Cc: npostavs <at> users.sourceforge.net, 30421 <at> debbugs.gnu.org
> Date: Fri, 16 Feb 2018 23:58:52 +0100
> 
> I tried patching with
> 
>                        -(daemonp)
>                        +(and (daemonp) (= (length (visible-frame-list)) 1))
> 
> Then I killed the daemon, leaving a .lock behind.
> On restart:
> 
> - In a tty, I get a black screen with a blinking cursor on the bottom left
> corner.
> If I press 'y', it proceeds with loading the desktop file.  I can verify
> that from the *Messages* buffer.
> 
> - With EXWM, I get a black screen, but 'y' does not work.  So it's
> effectively stuck.
> 
> I'm thinking that maybe `after-make-frame-functions' are run too early,
> before the frame is fully ready.
> 
> Then I re-considered Eli's last remark: the daemon already has a frame, so I
> thought maybe we should also guard the hook with a check on the frames count:
> 
> 	(defun ambrevar/desktop-init (_frame)
> 	    (when (> (length (visible-frame-list)) 1)
> 	      (desktop-save-mode)
> 	      (desktop-read)
> 	      (remove-hook 'after-make-frame-functions 'ambrevar/desktop-init)))
> 
> That did not change anything.
> 
> Any clue?

Instead of counting frames, I'd suggest using

  (frame-parameter FRAME 'client)

where FRAME is the argument with which your after-make-frame-functions
hook was called.  If this returns non-nil, FRAME is a frame created by
serving a request from emacsclient.

If this still doesn't work, please show the code of entire hook and
the complete recipe you used to test it, maybe there's something else
at work here.




This bug report was last modified 7 years and 150 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.