Subject: 24.5; write-region can reset idle time

From: Cecil Westerhof <[email-masked]>
Date: Thu, 11 Jan 2018 22:00:51 +0100

It is possible that write-region resets idle time. As soon as I use
one or both of the following in my .emacs:
    (desktop-save-mode 1)
    (global-auto-revert-mode 1)

The idle time is reset when calling write-region.

To reproduce put one or both into .emacs.
Define the following function:
    (defun write-region-problem ()
      (message (format "Before: %s %s" (current-time) (current-idle-time)))
      (write-region "Just a test\n" nil "~/problem.log" t 0)
      (message (format "After:  %s %s" (current-time) (current-idle-time)))
      )

And execute:
    (setq timer-object (run-with-timer 30 30 'write-region-problem))

You then get output like the following:
    Before: (23127 39977 941713 503000) (0 29 994274 462000)
    After:  (23127 39977 982179 647000) (0 30 34741 483000)
    Before: (23127 40007 940217 421000) (0 29 946739 305000)
    After:  (23127 40007 981669 405000) (0 29 988192 219000)
    Before: (23127 40037 941670 105000) (0 29 944688 557000)
    After:  (23127 40037 991646 30000) (0 29 994665 603000)
    Before: (23127 40067 941685 17000) (0 29 938036 13000)
    After:  (23127 40067 992876 336000) (0 29 989228 329000)
    Before: (23127 40097 939595 311000) (0 29 936576 788000)
    After:  (23127 40097 977542 689000) (0 29 974525 333000)

If both are not defined, you get output like:
    Before: (23127 47206 936031 250000) (0 24 841129 146000)
    After:  (23127 47206 937987 23000) (0 24 843085 910000)
    Before: (23127 47236 936555 313000) (0 54 841653 459000)
    After:  (23127 47236 938648 51000) (0 54 843747 333000)
    Before: (23127 47266 935235 63000) (0 84 840333 256000)
    After:  (23127 47266 937094 166000) (0 84 842192 826000)
    Before: (23127 47296 936545 234000) (0 114 841643 122000)
    After:  (23127 47296 938517 313000) (0 114 843616 494000)

Before 19 December I did not have this problem. So it is recently
introduced.

My version of Emacs:
    GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.11) of 2017-09-12 on hullmann, modified by Debian

-- 
Cecil Westerhof
Senior Software Engineer
M [email-masked]

LinkedIn: http://www.linkedin.com/in/cecilwesterhof