Subject: Re: bug#35726: Further information of line number bug.

From: Eli Zaretskii <[email-masked]>
Date: Wed, 15 May 2019 18:32:30 +0300

> From: changqi chen <[email-masked]>
> Date: Tue, 14 May 2019 00:21:33 -0400
> 
> I use global-display-line-number-mode in my init.el. When I use emacsclient open first buffer, no matter which
> mode it is, line number does not show.
> I can manually enable it by M-x display-line-number-mode. If I open other file during my first buffer, different
> buffer mode, line number shows. 

Thanks.  This is a regression in Emacs 27; the problem doesn't exist
in Emacs 26.

The reason for this is the fix for bug#24218.  It changed the order in
which we visit the file and create a new frame: where previously we
created the frame first, and only then visited the file, we now visit
the file in the original frame, and after that create a new frame with
the visiting buffer being the current buffer.

Since define-globalized-minor-mode invokes the turn-on function in
find-file-hook, both display-line-numbers-mode and linum-mode now see
a frame whose 'client' parameter is nil, and refuse to turn themselves
on to avoid bug#27210.

Thinking about this, I see several possible solutions:

 1. Revert the fix for bug#24218 (since it's just an aesthetic issue).
    Or maybe someone sees how to fix that bug in a way that doesn't
    change the order of visiting the file and creating the client
    frame.

 2. Modify define-globalized-minor-mode to also use some other hook,
    like maybe server-after-make-frame-hook.  This has a downside that
    we will need to scan all the buffers on the frame, which might
    slow down client frame creation.

 3. Remove from linum.el and display-line-numbers.el the condition
    that causes this:

       (and (daemonp) (null (frame-parameter nil 'client)))

    I don't think that bug#27210 will affect display-line-numbers, and
    linum is semi-deprecated.

Any other ideas?