X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=emchat.el;fp=emchat.el;h=89df916a0ddecd78a9c0e554600fc925bf29a073;hb=0520fb3168d9dac7ec5a00b8a5bbbadb3c17b3c0;hp=06352d3785445c38787c738eb78a49869062d9c6;hpb=a9daee5a142d080d3984a90f49a81a8c28e8029d;p=emchat diff --git a/emchat.el b/emchat.el index 06352d3..89df916 100644 --- a/emchat.el +++ b/emchat.el @@ -1807,7 +1807,7 @@ Need to relogin afterwards." nil password))) -(defun emchat-auto-away-timeout-set (&optional symbol value) +(defun emchat-auto-away-timeout-set (symbol value) "Set timer for auto-away. See `emchat-auto-away-timeout'." ;; delete the previous itimers (when (itimerp (get-itimer "emchat auto-away")) @@ -1815,28 +1815,25 @@ Need to relogin afterwards." (when (itimerp (get-itimer "emchat auto-na")) (delete-itimer (get-itimer "emchat auto-na"))) (unless (zerop value) - (start-itimer - "emchat auto-away" - (lambda () - ;; auto away for first idle - (when (member emchat-user-status '("online" "ffc")) - (emchat-log-system "Auto away.") - (emchat-change-status "away") - (setq emchat-user-auto-away-p t))) - value value - 'is-idle) - (start-itimer - "emchat auto-na" - (lambda () - ;; auto na for second idle - (when (and emchat-user-auto-away-p - (equal emchat-user-status "away")) - (emchat-log-system "Auto na.") - (emchat-change-status "na") - ;; emchat-change-status resets this flag - (setq emchat-user-auto-away-p t))) - (* 2 value) (* 2 value) - nil))) + (start-itimer "emchat auto-away" + #'(lambda () + ;; auto away for first idle + (when (member emchat-user-status '("online" "ffc")) + (emchat-log-system "Auto away.") + (emchat-change-status "away") + (setq emchat-user-auto-away-p t))) + value value 'idle) + (start-itimer "emchat auto-na" + #'(lambda () + ;; auto na for second idle + (when (and emchat-user-auto-away-p + (equal emchat-user-status "away")) + (emchat-log-system "Auto na.") + (emchat-change-status "na") + ;; emchat-change-status resets this flag + (setq emchat-user-auto-away-p t))) + (* 2 value) (* 2 value))) + (set (intern (symbol-name symbol)) value)) (defcustom emchat-auto-away-timeout 300 "*Seconds of inactivity in Emacs before auto-away. @@ -1847,7 +1844,7 @@ See `emchat-auto-away'. Setting this to zero disables the timeout. If you set this outside of the custom buffer you _MUST_ use -`customize-set-value' and _NOT_ `setq'." +`customize-set-variable' and _NOT_ `setq'." :type 'number :set 'emchat-auto-away-timeout-set :initialize 'custom-initialize-default @@ -1864,7 +1861,7 @@ To do that, customise the variable, `emchat-auto-away-timeout'." (interactive (list (read-number "Idle timeout in seconds (0 to disable): " nil (number-to-string emchat-auto-away-timeout)))) - (emchat-auto-away-timeout-set nil seconds) + (emchat-auto-away-timeout-set 'emchat-auto-away-timeout seconds) (if (zerop seconds) (emchat-log-system "Auto-away disabled.") (emchat-log-system "Auto-away timeout set to: %d seconds." seconds))) @@ -2529,7 +2526,8 @@ See `emchat-buddy-select-all-in-view'." (byte-compile 'emchat-pack-contact-list) ;; Start the idle timer -(emchat-auto-away-timeout-set nil emchat-auto-away-timeout) +(emchat-auto-away-timeout-set + 'emchat-auto-away-timeout emchat-auto-away-timeout) ;; Install bindings (emchat-install-bindings 'emchat-prefix-key emchat-prefix-key) ;; Add our button to the default toolbar