all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Function write-region resets idle time
@ 2018-01-11 17:43 Cecil Westerhof
  2018-01-11 18:05 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Cecil Westerhof @ 2018-01-11 17:43 UTC (permalink / raw)
  To: help-gnu-emacs

I found a strange problem: write-region resets idle-time. But only
after the calling function has returned.

I defined the following functions:
    (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)))
        )

    (defun write-region-problem-loop ()
      (dotimes (i 5)
        (sleep-for 15)
        (write-region-problem)))


When using:
    (run-with-idle-timer 30   nil   'write-region-problem-loop)

I get:
    Before: (23127 39556 376787 939000) (0 45 6316 747000)
    After:  (23127 39556 426254 575000) (0 45 55783 245000)
    Before: (23127 39571 427804 974000) (0 60 57334 626000)
    After:  (23127 39571 469158 56000) (0 60 98686 884000)
    Before: (23127 39586 472115 145000) (0 75 101644 158000)
    After:  (23127 39586 519021 983000) (0 75 148550 571000)
    Before: (23127 39601 522126 756000) (0 90 151656 293000)
    After:  (23127 39601 570429 201000) (0 90 199958 257000)
    Before: (23127 39616 573897 68000) (0 105 203426 556000)
    After:  (23127 39616 620647 371000) (0 105 250175 854000)

So everything seems to be OK.


But when using:
    (setq timer-object (run-with-timer 30 30 'write-region-problem))

I get:
    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)


So clearly write-region resets idle time.

In the past it was no problem at all. But at a certain point the
functionality changed. I do not know when, because I had for some time
problems with my gnus idle daemon, but I only now found out what the
problem is.


The version of Emacs I am using:
    "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
LinkedIn: http://www.linkedin.com/in/cecilwesterhof


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-01-12 23:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-11 17:43 Function write-region resets idle time Cecil Westerhof
2018-01-11 18:05 ` Eli Zaretskii
     [not found] ` <mailman.7219.1515693952.27995.help-gnu-emacs@gnu.org>
2018-01-11 19:14   ` Cecil Westerhof
2018-01-11 19:38     ` Cecil Westerhof
2018-01-11 20:48       ` Eli Zaretskii
     [not found]       ` <mailman.7229.1515703701.27995.help-gnu-emacs@gnu.org>
2018-01-11 21:24         ` Cecil Westerhof
2018-01-11 19:40     ` Stefan Monnier
     [not found]     ` <mailman.7223.1515699746.27995.help-gnu-emacs@gnu.org>
2018-01-11 20:45       ` Cecil Westerhof
2018-01-12 23:08 ` Cecil Westerhof

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.