erc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Erc-commit] [commit][emacs22] erc-autoaway: Fix error on startup.


From: mwolson
Subject: [Erc-commit] [commit][emacs22] erc-autoaway: Fix error on startup.
Date: Sun, 14 Oct 2007 00:48:15 -0400

commit 0d03c66bf1dd15c87998b273374b04e8c7d8944a
Author: Michael Olson <address@hidden>
Date:   Sun Jun 4 16:55:18 2006 +0000

    erc-autoaway: Fix error on startup.
    
    * erc-autoaway.el (erc-autoaway-idle-method): Move after the definition
      of the autoaway module.
      (autoaway): Don't do anything if erc-autoaway-idle-method is unbound.
      This prevents an error on startup.
    git-archimport-id: address@hidden/erc--main--0--patch-6

diff --git a/ChangeLog b/ChangeLog
index d63826f..de8539c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-06-04  Michael Olson  <address@hidden>
+
+       * erc-autoaway.el (erc-autoaway-idle-method): Move after the
+       definition of the autoaway module.
+       (autoaway): Don't do anything if erc-autoaway-idle-method is
+       unbound.  This prevents an error on startup.
+
 2006-06-03  Michael Olson  <address@hidden>
 
        * erc-autoaway.el: Thanks to Mark Plaksin for the ideas and patch.
diff --git a/erc-autoaway.el b/erc-autoaway.el
index 1ce9583..aac6549 100644
--- a/erc-autoaway.el
+++ b/erc-autoaway.el
@@ -43,25 +43,6 @@ yourself back when you type something."
   "The Emacs idletimer.
 This is only used when `erc-autoaway-use-emacs-idle' is non-nil.")
 
-(defcustom erc-autoaway-idle-method 'user
-  "*The method used to determine how long you have been idle.
-If 'user, the time of the last command sent to Emacs is used.
-If 'emacs, the idle time in Emacs is used.
-If 'irc, the time of the last IRC command is used.
-
-The time itself is specified by `erc-autoaway-idle-seconds'.
-
-See `erc-autoaway-mode' for more information on the various
-definitions of being idle."
-  :group 'erc-autoaway
-  :type '(choice (const :tag "User idle time" user)
-                (const :tag "Emacs idle time" emacs)
-                (const :tag "Last IRC action" irc))
-  :set (lambda (sym val)
-        (erc-autoaway-disable)
-        (set-default sym val)
-        (erc-autoaway-enable)))
-
 ;;;###autoload (autoload 'erc-autoaway-mode "erc-autoaway")
 (define-erc-module autoaway nil
   "In ERC autoaway mode, you can be set away automatically.
@@ -86,24 +67,47 @@ set you no longer away.
 
 Related variables: `erc-public-away-p' and `erc-away-nickname'."
   ;; Enable:
-  ((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 'post-command-hook 'erc-autoaway-reset-idle-user))
-        ((eq erc-autoaway-idle-method 'emacs)
-         (erc-autoaway-reestablish-idletimer)))
-   (add-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away))
+  ((when (boundp 'erc-autoaway-idle-method)
+     (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 'post-command-hook 'erc-autoaway-reset-idle-user))
+      ((eq erc-autoaway-idle-method 'emacs)
+       (erc-autoaway-reestablish-idletimer)))
+     (add-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away)))
   ;; Disable:
-  ((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))
-        ((eq erc-autoaway-idle-method 'emacs)
-         (erc-cancel-timer erc-autoaway-idletimer)
-         (setq erc-autoaway-idletimer nil)))
-   (remove-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away)))
+  ((when (boundp 'erc-autoaway-idle-method)
+     (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))
+      ((eq erc-autoaway-idle-method 'emacs)
+       (erc-cancel-timer erc-autoaway-idletimer)
+       (setq erc-autoaway-idletimer nil)))
+     (remove-hook 'erc-timer-hook 'erc-autoaway-possibly-set-away))))
+
+(defcustom erc-autoaway-idle-method 'user
+  "*The method used to determine how long you have been idle.
+If 'user, the time of the last command sent to Emacs is used.
+If 'emacs, the idle time in Emacs is used.
+If 'irc, the time of the last IRC command is used.
+
+The time itself is specified by `erc-autoaway-idle-seconds'.
+
+See `erc-autoaway-mode' for more information on the various
+definitions of being idle."
+  :group 'erc-autoaway
+  :type '(choice (const :tag "User idle time" user)
+                (const :tag "Emacs idle time" emacs)
+                (const :tag "Last IRC action" irc))
+  :set (lambda (sym val)
+        (erc-autoaway-disable)
+        (set-default sym val)
+        (erc-autoaway-enable)))
 
 (defcustom erc-auto-set-away t
   "*If non-nil, set away after `erc-autoaway-idle-seconds' seconds of idling.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]