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"))
(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.
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
(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)))
(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