unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Pierre Neidhardt <ambrevar@gmail.com>
Cc: 30421@debbugs.gnu.org, npostavs@users.sourceforge.net
Subject: bug#30421: 25.3; desktop.el: Steal lock when no living "emacs" process owns it
Date: Sat, 17 Feb 2018 09:43:41 +0200	[thread overview]
Message-ID: <83fu60cb82.fsf@gnu.org> (raw)
In-Reply-To: <87r2pkilsj.fsf@gmail.com> (message from Pierre Neidhardt on Fri,  16 Feb 2018 23:58:52 +0100)

> From: Pierre Neidhardt <ambrevar@gmail.com>
> Cc: npostavs@users.sourceforge.net, 30421@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.





  reply	other threads:[~2018-02-17  7:43 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-11  9:54 bug#30421: 25.3; desktop.el: Steal lock when no living "emacs" process owns it Pierre Neidhardt
2018-02-11 15:50 ` Eli Zaretskii
2018-02-11 16:08   ` Pierre Neidhardt
2018-02-11 16:15     ` Noam Postavsky
2018-02-11 16:32       ` Eli Zaretskii
2018-02-11 16:57         ` Pierre Neidhardt
2018-02-11 17:18           ` Eli Zaretskii
2018-02-11 17:23             ` Pierre Neidhardt
2018-02-11 18:00               ` Eli Zaretskii
2018-02-11 18:41                 ` Pierre Neidhardt
2018-02-11 18:54                   ` Eli Zaretskii
2018-02-11 19:01                     ` Pierre Neidhardt
2018-02-15 22:56                       ` Pierre Neidhardt
2018-02-16  8:11                         ` Eli Zaretskii
2018-02-16 22:58                           ` Pierre Neidhardt
2018-02-17  7:43                             ` Eli Zaretskii [this message]
2018-02-18 11:26                               ` Pierre Neidhardt
2018-02-18 16:37                                 ` Eli Zaretskii
2018-02-24 10:39                                   ` Eli Zaretskii
2018-02-24 19:44                                     ` Pierre Neidhardt
2018-02-24 20:09                                       ` Eli Zaretskii
2018-03-03 11:33                                         ` Eli Zaretskii
2018-03-03 18:05                                           ` Pierre Neidhardt
2018-03-10 11:52                                             ` Eli Zaretskii
2018-03-19 11:06                                               ` Pierre Neidhardt
2018-03-19 12:47                                                 ` Eli Zaretskii
2018-03-19 13:09                                                   ` Pierre Neidhardt
2018-02-11 20:40 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83fu60cb82.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=30421@debbugs.gnu.org \
    --cc=ambrevar@gmail.com \
    --cc=npostavs@users.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).