unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kaushal Modi <kaushal.modi@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 27647@debbugs.gnu.org
Subject: bug#27647: 26.0.50; Line numbers implemented natively disappear momentarily when frame out of focus
Date: Tue, 11 Jul 2017 20:08:47 +0000	[thread overview]
Message-ID: <CAFyQvY3B6MGrOx0+iqdTrJ0C1B6ym8xSdT_OZHgVLWPht=qYEw@mail.gmail.com> (raw)
In-Reply-To: <CAFyQvY0oGkYQgcdRgh_z67EGNBHY-G1i2ZU2ZWerTa9sJaCoDw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4758 bytes --]

On Tue, Jul 11, 2017 at 10:38 AM Kaushal Modi <kaushal.modi@gmail.com>
wrote:

>
> I will set up the Lisp watchpoints and debug more, thanks.
>
> I have one more data point. Apparently I do not need to "click" on the
> emacs frame to make the line numbers reappear. They reappeared seemingly
> randomly or just as I was just hovering the mouse over the emacs frame..
> odd.  This happened just as I was preparing to record "line num
> reappearance on click" effect, but the line numbers reappeared by
> themselves even before I clicked.
>

This is what I see (I was able to record the moment when the lines
reappeared on clicking anywhere in the window):
http://i.imgur.com/5C5FmGS.gifv

When the above happened, the point was in a Fundamental Mode buffer window
and the other window had this file in emacs-lisp-mode. I do not have
display-line-numbers set to t globally; so fundamental-mode has that value
at nil and the elisp window had that set to t. Again the line num
disappearance happened when the emacs frame was out of focus.

Interestingly the variable watcher did not get triggered.

This is how I set the watcher:

=====
(defvar modi/variables-to-be-watched '(display-line-numbers)
  "List of variables to be watched.
Used by `modi/set-variable-watchers' and
`modi/unset-variable-watchers'")

(defun modi/variable-watcher-fn (symbol newval operation where)
  "Print message when the value of variable SYMBOL changes.
The message shows the NEWVAL it changed to, the OPERATION that
caused that, and the buffer WHERE that happened if the value
change was buffer-local."
  (message (format "[Watcher: %s] Now set to %S, by `%S'%s"
                   (symbol-name symbol)
                   newval
                   operation
                   (if where
                       (format " in %S" where)
                     ""))))

(defun modi/set-variable-watchers ()
  "Enable printing messages when any watched variable changes.
The variables to be watched should be added to
`modi/variables-to-be-watched'."
  (interactive)
  (dolist (var modi/variables-to-be-watched)
    (add-variable-watcher var #'modi/variable-watcher-fn)))

(modi/set-variable-watchers)
=====

When I revert-buffer in an emacs-lisp-mode file, I see these:

[Watcher: display-line-numbers] Now set to nil, by ‘makunbound’ in #<buffer
setup-linum.el>
[Watcher: display-line-numbers] Now set to nil, by ‘set’ in #<buffer
setup-linum.el>
[Watcher: display-line-numbers] Now set to t, by ‘set’ in #<buffer
setup-linum.el>

But none of those [Watcher:..] messages showed up when the line numbers
auto-disappeared and also when re-appeared on the click in the buffer.

Not sure if this would help, but here is how I enable the line numbers
(modified compared to the version I posted earlier in this thread):

=====
(defvar modi/native-linum-default t
  "Value set for `display-line-numbers' when enabled.
Valid values are t, `visual', `relative' and nil. See
`display-line-numbers' for more information.")

(defun modi/native-linum--on (&optional global)
  "Enable native line number display in the current buffer.
If GLOBAL is non-nil, enable this globally."
  (interactive "P")
  (if global
      (setq-default display-line-numbers modi/native-linum-default)
    (setq-local display-line-numbers modi/native-linum-default)))

(defun modi/native-linum--off (&optional global)
  "Disable native line number display in the current buffer.
If GLOBAL is non-nil, disable this globally."
  (interactive "P")
  (if global
      (setq-default display-line-numbers nil)
    (setq-local display-line-numbers nil)))

(defun modi/turn-on-native-linum ()
  "Turn on native line numbers in specific modes.
In enabled state, `display-line-numbers' is set to
`modi/native-linum-default'."
  (interactive)
  (if modi/linum-mode-enable-global
      (progn
        (dolist (hook modi/linum-mode-hooks)
          (remove-hook hook #'modi/native-linum--on))
        (modi/native-linum--on :global))
    (progn
      (modi/native-linum--off :global)
      (dolist (hook modi/linum-mode-hooks)
        (add-hook hook #'modi/native-linum--on)))))

(defun modi/linum--enable (&optional frame)
  "Set “linum” using the default package set by the user in
`modi/linum-fn-default'.

The optional FRAME argument is added as it is needed if this
function is added to the `after-make-frame-functions' hook."
  (modi/turn-on-native-linum))

(if (daemonp)
    (add-hook 'after-make-frame-functions #'modi/linum--enable)
  (add-hook 'after-init-hook #'modi/linum--enable))
=====

Does anything look problematic in the above code from a quick glance.


-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 6726 bytes --]

  reply	other threads:[~2017-07-11 20:08 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-10 20:52 bug#27647: 26.0.50; Line numbers implemented natively disappear momentarily when frame out of focus Kaushal Modi
2017-07-11  2:38 ` Eli Zaretskii
2017-07-11  3:43   ` Kaushal Modi
2017-07-11 14:31     ` Eli Zaretskii
2017-07-11 14:38       ` Kaushal Modi
2017-07-11 20:08         ` Kaushal Modi [this message]
2017-07-12 14:44           ` Eli Zaretskii
2017-07-19 15:13             ` Kaushal Modi
2017-07-19 17:34               ` Eli Zaretskii
2017-07-19 17:52             ` Noam Postavsky
2017-07-19 18:09               ` Eli Zaretskii
2017-10-05 12:40                 ` Kaushal Modi
2017-10-05 13:03                   ` jonas
2017-10-05 13:10                   ` Eli Zaretskii
2017-10-05 13:39                     ` Eli Zaretskii
2017-10-05 22:17                       ` Romanos Skiadas
2017-10-06  8:57                         ` Eli Zaretskii
2017-10-11 20:32                     ` Romanos Skiadas
2017-10-12  8:29                       ` Eli Zaretskii
2017-10-12 19:30                         ` Romanos Skiadas
2017-10-13  8:33                           ` Eli Zaretskii
2017-10-13 18:14                             ` Romanos Skiadas
2017-10-14  7:47                               ` Eli Zaretskii
2017-10-15 15:05                                 ` Romanos Skiadas
2017-10-14  8:36                             ` martin rudalics
2017-10-14 10:12                               ` Eli Zaretskii
2017-10-15  9:39                                 ` martin rudalics
2017-10-15 13:25                                   ` Kaushal Modi
2017-10-16 21:46                                     ` Kaushal Modi
2017-10-17  8:59                                       ` martin rudalics
2017-10-17 14:47                                         ` Eli Zaretskii
2017-10-17 15:07                                           ` Kaushal Modi
2017-10-17 15:13                                         ` Kaushal Modi
2017-10-17 16:48                                           ` Eli Zaretskii
2017-10-15 14:29                                   ` Eli Zaretskii
2017-11-08 20:08   ` Alex
2017-11-08 20:14     ` Alex
2017-11-09  2:49       ` Noam Postavsky
2017-11-09  7:28         ` martin rudalics
2017-11-09 15:57           ` Eli Zaretskii
2017-11-09 18:10             ` martin rudalics
2017-11-09 20:53               ` Eli Zaretskii
2017-11-12 10:08                 ` martin rudalics
2017-11-12 11:36                   ` Eli Zaretskii
2017-11-13 18:45                     ` martin rudalics
2017-11-13 19:12                       ` Eli Zaretskii
2017-11-14  9:52                         ` martin rudalics
2017-11-14 15:47                           ` Eli Zaretskii
2017-11-14 18:29                             ` martin rudalics
2017-11-14 19:02                               ` Eli Zaretskii
2017-11-15  9:22                                 ` martin rudalics
2017-11-15 10:05                                   ` martin rudalics
2017-11-18 11:42                                     ` Eli Zaretskii
2017-11-18 18:25                                       ` martin rudalics
2017-11-09 13:34         ` Kaushal Modi
2017-11-10  0:38           ` Noam Postavsky
2017-11-09 16:12         ` Eli Zaretskii
2017-11-09 18:14           ` Romanos Skiadas
2017-11-09 20:27             ` Eli Zaretskii
2017-11-10  0:11           ` Noam Postavsky
2017-11-10  8:37             ` Eli Zaretskii
2017-07-21 17:49 ` bug#27647: 26.0.50; Line numbers implemented natively disappear momentarily when, " jonas
2017-07-21 18:57   ` Eli Zaretskii

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='CAFyQvY3B6MGrOx0+iqdTrJ0C1B6ym8xSdT_OZHgVLWPht=qYEw@mail.gmail.com' \
    --to=kaushal.modi@gmail.com \
    --cc=27647@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /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).