Log annoying FLAP errors instead of interupting with #'error
[emchat] / emchat-buddy.el
index 4ac4bf0..9246dc3 100644 (file)
@@ -1,6 +1,6 @@
 ;;; emchat-buddy.el --- "Buddy" code for EMchat
 
-;; Copyright (C) 2007 Steve Youngs
+;; Copyright (C) 2007 - 2011 Steve Youngs
 
 ;; Author:        Steve Youngs <steve@emchat.org>
 ;; Maintainer:    Steve Youngs <steve@emchat.org>
@@ -56,7 +56,7 @@
   "*Width of window for `emchat-buddy-buffer'."
   :group 'emchat-interface)
 
-(defcustom emchat-buddy-view 
+(defcustom emchat-buddy-view
   'emchat-connected-aliases
   "*View of buddy buffer.
 It determines what aliases to be display in buddy buffer.  For example,
@@ -66,8 +66,8 @@ See `emchat-buddy-view-all', `emchat-buddy-view-connected', and
 `emchat-buddy-view-active'."
   :group 'emchat-buddy
   :type '(choice (item emchat-all-aliases)
-                 (item emchat-connected-aliases)
-                 (item emchat-active-aliases))
+                (item emchat-connected-aliases)
+                (item emchat-active-aliases))
   :initialize 'custom-initialize-default)
 
 (defcustom emchat-buddy-show-xface nil
@@ -162,7 +162,7 @@ Returns a string."
              (when (and face
                         (or (not emchat-buddy-prefer-cface-to-xface)
                             (not cface)))
-               (set-extent-begin-glyph 
+               (set-extent-begin-glyph
                 ext
                 (make-glyph (list (vector 'xface
                                           :data (concat "X-Face: " face)
@@ -187,7 +187,7 @@ Don't select buddy window if NO-SELECT is non-nil.
 See `emchat-buddy-view' and `emchat-buddy-status-color-hint-flag'."
   (interactive)
   (when (or (not (buffer-live-p emchat-buddy-buffer))
-            new)
+           new)
     (setq emchat-buddy-buffer (get-buffer-create "*emchat buddy*"))
     (set-buffer emchat-buddy-buffer)
     (erase-buffer)
@@ -245,7 +245,7 @@ See `emchat-buddy-view' and `emchat-active-aliases'."
          (when (and face
                     (or (not emchat-buddy-prefer-cface-to-xface)
                         (not cface)))
-           (set-extent-begin-glyph 
+           (set-extent-begin-glyph
             ext
             (make-glyph (list (vector 'xface
                                       :data (concat "X-Face: " face)
@@ -267,7 +267,7 @@ See `emchat-buddy-view' and `emchat-active-aliases'."
     (let ((alias (progn
                   (set-buffer balloon-help-buffer)
                   (goto-char (point-min))
-                  (when (re-search-forward "\\(^.*\\) (" (eolp) t)
+                  (when (re-search-forward "\\(^.*\\) (" (point-at-eol) t)
                     (substring (match-string 1) 1)))))
       (when alias
        (emchat-buddy-show-xface-in-balloon alias)))))
@@ -281,26 +281,26 @@ Non-nil DELETE means delete alias from buffer."
       (goto-char (point-min))
 
       (if (search-forward-regexp
-           ;; use "^" alias "$" so searching "foo" will not get "foobar"
-           (concat "^"
-                   ;; to allow funny characters in alias
-                   (regexp-quote alias)
-                   "$")
-           nil t)
-          ;; old alias
-          (if delete
-              (delete-region
-               (point-at-bol)
-               ;; take care of last line
-               (min (1+ (point-at-eol)) (point-max))))
-        ;; new alias
-        (unless delete
-          (insert alias "\n")
-          (forward-line -1)))
+          ;; use "^" alias "$" so searching "foo" will not get "foobar"
+          (concat "^"
+                  ;; to allow funny characters in alias
+                  (regexp-quote alias)
+                  "$")
+          nil t)
+         ;; old alias
+         (if delete
+             (delete-region
+              (point-at-bol)
+              ;; take care of last line
+              (min (1+ (point-at-eol)) (point-max))))
+       ;; new alias
+       (unless delete
+         (insert alias "\n")
+         (forward-line -1)))
 
       (unless delete
        (let* ((ext (extent-at (point)))
-              (bhelp (format 
+              (bhelp (format
                       "%s (%s)\n Status: %s\n Groups: %s\nHistory: %s\n\n\n"
                       alias
                       (emchat-alias-uin alias)
@@ -328,7 +328,7 @@ PREDICATE accepts an alias as an argument and limits the application.
 Current view is `emchat-buddy-view'."
   (loop for x in (symbol-value emchat-buddy-view)
     if (or (null predicate)
-           (funcall predicate x))
+          (funcall predicate x))
     do (emchat-group-select-aliases state x)))
 
 (defun emchat-buddy-select-all-in-view-by-status (status)
@@ -360,4 +360,3 @@ Current view is `emchat-buddy-view'."
 (provide 'emchat-buddy)
 
 ;;; emchat-buddy.el ends here
-