bug#35726: 27.0.50; global-linum-mode doesn't work in emacsclient in several modes

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#35726: 27.0.50; global-linum-mode doesn't work in emacsclient in several modes

ccQ's Gmail


When I in emacsclient, some of modes do not show line-number. I `M-x
global-linum-mode`, emacs shows me `global-linum-mode` disable. Then I
`M-x global-linum-mode` again, then line-nums show.

When I am not in emacsclient, no issues. Only happen in emacsclient.

So far, I find lisp-mode and go-mode has this problem. elpy-mode looks fine.


In GNU Emacs 27.0.50 (build 7, x86_64-apple-darwin18.6.0, NS appkit-1671.50 Version 10.14.5 (Build 18F132))
of 2019-05-13 built on ccQ-rMBP.local
Repository revision: 364d4e156d80bff711d000bdb2e0ac765726c953
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1671
System Description:  Mac OS X 10.14.5

Recent messages:
[yas] Prepared just-in-time loading of snippets (but no snippets found).
ad-handle-definition: ‘er/expand-region’ got redefined
Waiting for git... [2 times]
[yas] Prepared just-in-time loading of snippets successfully.
Turning on magit-auto-revert-mode...done
Starting Emacs daemon.
When done with a buffer, type C-x # [2 times]
previous-line: Beginning of buffer [6 times]
When done with a buffer, type C-x # [2 times]
funcall-interactively: End of buffer

Configured features:
IMAGEMAGICK NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS
THREADS PDUMPER LCMS2 GMP

Important settings:
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp

Minor modes in effect:
  slime-trace-dialog-minor-mode: t
  slime-autodoc-mode: t
  slime-mode: t
  paredit-mode: t
  helm-gtags-mode: t
  pyvenv-mode: t
  TeX-PDF-mode: t
  helm-mode: t
  helm-autoresize-mode: t
  global-magit-file-mode: t
  magit-file-mode: t
  magit-auto-revert-mode: t
  auto-revert-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  google-this-mode: t
  delete-selection-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  global-flycheck-mode: t
  flycheck-mode: t
  global-auto-complete-mode: t
  auto-complete-mode: t
  override-global-mode: t
  show-paren-mode: t
  global-linum-mode: t
  global-hl-line-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/Users/ccQ/.emacs.d/elpa/lsp-rust-20180305.1308/lsp-rust hides /Users/ccQ/.emacs.d/elpa/lsp-mode-20190512.1847/lsp-rust
~/.emacs.d/opam_link/_opam/share/emacs/site-lisp/merlin-iedit hides /Users/ccQ/.emacs.d/elpa/merlin-20190323.930/merlin-iedit
~/.emacs.d/opam_link/_opam/share/emacs/site-lisp/merlin-cap hides /Users/ccQ/.emacs.d/elpa/merlin-20190323.930/merlin-cap
~/.emacs.d/opam_link/_opam/share/emacs/site-lisp/merlin-ac hides /Users/ccQ/.emacs.d/elpa/merlin-20190323.930/merlin-ac
~/.emacs.d/opam_link/_opam/share/emacs/site-lisp/merlin hides /Users/ccQ/.emacs.d/elpa/merlin-20190323.930/merlin
~/.emacs.d/opam_link/_opam/share/emacs/site-lisp/merlin-imenu hides /Users/ccQ/.emacs.d/elpa/merlin-20190323.930/merlin-imenu
~/.emacs.d/opam_link/_opam/share/emacs/site-lisp/merlin-company hides /Users/ccQ/.emacs.d/elpa/merlin-20190323.930/merlin-company
~/.emacs.d/opam_link/_opam/share/emacs/site-lisp/utop hides /Users/ccQ/.emacs.d/elpa/utop-20181010.2155/utop

Features:
(shadow sort mail-extr emacsbug sendmail winner helm-command helm-elisp
helm-eval edebug backtrace helm-info term/xterm xterm vc-git ac-slime
slime-fancy slime-trace-dialog slime-fontifying-fu slime-package-fu
slime-references slime-compiler-notes-tree slime-scratch
slime-presentations bridge slime-macrostep macrostep slime-mdot-fu
slime-enclosing-context slime-fuzzy slime-fancy-trace
slime-fancy-inspector slime-c-p-c slime-editing-commands slime-autodoc
slime-repl slime-parse slime arc-mode archive-mode pp hyperspec
browse-url paredit helm-gtags pulse init-ocaml ocamlformat init-yaml
yaml-mode init-rust racer pos-tip rust-mode init-js init-web-n-php
ac-php ac-php-core xcscope f php-mode php-project mode-local speedbar
sb-image ezimage dframe cc-langs cc-mode-expansions cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
php-face php web-mode-expansions web-mode disp-table init-haskell
init-swift init-golang init-python py-autopep8 highlight-indentation
company-capf company pcase help-fns radix-tree elpy find-file-in-project
ivy colir ivy-overlay ffap windmove elpy-shell pyvenv eshell esh-cmd
esh-ext esh-opt esh-proc esh-io esh-arg esh-module esh-groups esh-util
elpy-profile elpy-django s elpy-refactor python-el-fgallina-expansions
python tramp-sh tramp tramp-loaddefs trampver tramp-integration
tramp-compat parse-time ido grep files-x etags fileloop generator xref
project init-markdown markdown-mode color noutline outline init-org
init-dash init-tex tex-mik tex init-helm helm-swoop helm-mode helm-files
helm-buffers helm-occur helm-tags helm-locate helm-grep helm-regexp
helm-utils helm-help helm-types helm-config helm-easymenu helm
helm-source eieio-compat helm-multi-match helm-lib init-shell init-lisp
init-treemacs cus-edit cus-start cus-load wid-edit magit-submodule
magit-obsolete magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff
smerge-mode diff-mode magit-core magit-autorevert autorevert filenotify
magit-margin magit-transient magit-process magit-mode transient
git-commit magit-git magit-section magit-utils crm log-edit message rmc
puny dired dired-loaddefs format-spec rfc822 mml mml-sec epa derived epg
gnus-util rmail rmail-loaddefs text-property-search time-date mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader
pcvs-util add-log with-editor async-bytecomp async shell pcomplete
server google-this url url-proxy url-privacy url-expand url-methods
url-history url-cookie url-domsuf url-util mailcap delsel expand-region
text-mode-expansions er-basic-expansions expand-region-core
expand-region-custom highlight-symbol multiple-cursors
mc-hide-unmatched-lines-mode mc-separate-operations
rectangular-region-mode mc-mark-pop mc-mark-more mc-cycle-cursors
mc-edit-lines multiple-cursors-core rect yasnippet advice flymake-proc
flymake compile comint ansi-color ring warnings thingatpt elec-pair
flycheck cl-extra find-func help-mode dash auto-complete-config
auto-complete edmacro kmacro popup use-package use-package-ensure
use-package-delight use-package-diminish use-package-bind-key bind-key
easy-mmode use-package-core monokai-theme paren linum hl-line finder-inf
tex-site rx slime-autoloads info package easymenu epg-config
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json subr-x map url-vars seq byte-opt gv
bytecomp byte-compile cconv cl-loaddefs cl-lib tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win
ucs-normalize mule-util term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads kqueue cocoa ns lcms2 multi-tty make-network-process
emacs)

Memory information:
((conses 16 538582 33907)
(symbols 48 42822 3)
(strings 32 178653 4185)
(string-bytes 1 5384947)
(vectors 16 66174)
(vector-slots 8 781274 35298)
(floats 8 373 350)
(intervals 56 473 81)
(buffers 992 16))



Reply | Threaded
Open this post in threaded view
|

bug#35726: Further information of line number bug.

ccQ's Gmail
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. 

If not use emacsclient, no problem.

Thank you
--
written by ccQ
Reply | Threaded
Open this post in threaded view
|

bug#35726: Further information of line number bug.

Eli Zaretskii
> From: changqi chen <[hidden email]>
> 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?



Reply | Threaded
Open this post in threaded view
|

bug#35726: Further information of line number bug.

Noam Postavsky
Eli Zaretskii <[hidden email]> writes:

>  1. Revert the fix for bug#24218 (since it's just an aesthetic issue).

Did you typo the bug number?  I don't see how "server-name,
server-socket-dir and daemon start through systemd socket" relates to
aesthetics.



Reply | Threaded
Open this post in threaded view
|

bug#35726: Further information of line number bug.

Eli Zaretskii
> From: [hidden email]
> Cc: changqi chen <[hidden email]>,  [hidden email],  Aaron Jensen <[hidden email]>
> Date: Wed, 15 May 2019 13:35:46 -0400
>
> Eli Zaretskii <[hidden email]> writes:
>
> >  1. Revert the fix for bug#24218 (since it's just an aesthetic issue).
>
> Did you typo the bug number?

Not me, the commit log message.  The correct bug number is 26995.
Sorry, I trusted the Git log.



Reply | Threaded
Open this post in threaded view
|

bug#35726: Further information of line number bug.

Aaron Jensen
In reply to this post by Eli Zaretskii
On Wed, May 15, 2019 at 8:32 AM Eli Zaretskii <[hidden email]> wrote:

> 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.

For what it's worth, I'd vote for #3 since linum is semi-deprecated
and I rather like the change, so I'd prefer not to revert it.

Aaron



Reply | Threaded
Open this post in threaded view
|

bug#35726: 27.0.50; global-linum-mode doesn't work in emacsclient in several modes

Noam Postavsky
Aaron Jensen <[hidden email]> writes:

>>  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.
>
> For what it's worth, I'd vote for #3 since linum is semi-deprecated
> and I rather like the change, so I'd prefer not to revert it.

I think removing the check from display-line-numbers.el would make
sense, but IMO we should leave it in linum.el because having Emacs
freeze on startup is worse than having to toggle global-linum-mode when
using emacsclient.

Or if we really want to remove it from linum.el, there is my patch at
https://debbugs.gnu.org/27210#28 which can fix that bug without the
above check.