Function: erc-autoaway-enable

erc-autoaway-enable is an interactive and byte-compiled function defined in erc-autoaway.el.gz.

Signature

(erc-autoaway-enable)

Documentation

Enable ERC autoaway mode.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/erc/erc-autoaway.el.gz
;;;###autoload(autoload 'erc-autoaway-mode "erc-autoaway")
(define-erc-module autoaway nil
  "In ERC autoaway mode, you can be set away automatically.
If `erc-auto-set-away' is set, then you will be set away after
the number of seconds specified in `erc-autoaway-idle-seconds'.

There are several kinds of being idle:

User idle time measures how long you have not been sending any
commands to Emacs.  This is the default.

Emacs idle time measures how long Emacs has been idle.  This is
currently not useful, since Emacs is non-idle when it handles
ping-pong with IRC servers.  See `erc-autoaway-idle-method'
for more information.

IRC idle time measures how long since you last sent something (see
`erc-autoaway-last-sent-time').

If `erc-auto-discard-away' is set, then typing anything, will
set you no longer away.

Related variables: `erc-public-away-p' and `erc-away-nickname'."
  ;; Enable:
  ((when (boundp 'erc-autoaway-idle-method)
     (add-hook 'erc-connect-pre-hook #'erc-autoaway-reset-indicators)
     (setq erc-autoaway-last-sent-time (erc-current-time))
     (cond
      ((eq erc-autoaway-idle-method 'irc)
       (add-hook 'erc-send-completed-hook #'erc-autoaway-reset-idle-irc)
       (add-hook 'erc-server-001-functions #'erc-autoaway-reset-idle-irc))
      ((eq erc-autoaway-idle-method 'user)
       (add-hook 'erc-after-connect #'erc-autoaway-insinuate-maybe)
       (add-hook 'erc-disconnected-hook #'erc-autoaway-remove-maybe)
       (erc-autoaway-insinuate-maybe))
      ((eq erc-autoaway-idle-method 'emacs)
       (erc-autoaway-reestablish-idletimer)))
     (add-hook 'erc-timer-hook #'erc-autoaway-possibly-set-away)
     (add-hook 'erc-server-305-functions #'erc-autoaway-reset-indicators)))
  ;; Disable:
  ((when (boundp 'erc-autoaway-idle-method)
     (remove-hook 'erc-connect-pre-hook #'erc-autoaway-reset-indicators)
     (cond
      ((eq erc-autoaway-idle-method 'irc)
       (remove-hook 'erc-send-completed-hook #'erc-autoaway-reset-idle-irc)
       (remove-hook 'erc-server-001-functions #'erc-autoaway-reset-idle-irc))
      ((eq erc-autoaway-idle-method 'user)
       (remove-hook 'post-command-hook #'erc-autoaway-reset-idle-user)
       (remove-hook 'erc-after-connect #'erc-autoaway-insinuate-maybe)
       (remove-hook 'erc-disconnected-hook #'erc-autoaway-remove-maybe))
      ((eq erc-autoaway-idle-method 'emacs)
       (cancel-timer erc-autoaway-idletimer)
       (setq erc-autoaway-idletimer nil)))
     (remove-hook 'erc-timer-hook #'erc-autoaway-possibly-set-away)
     (remove-hook 'erc-server-305-functions #'erc-autoaway-reset-indicators))))