]> code.delx.au - gnu-emacs/blobdiff - lisp/erc/erc-track.el
Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[gnu-emacs] / lisp / erc / erc-track.el
index e4a4108953912abc4bf37bfaaf1938376712653d..054c135fa67ba7e0034822f4eccf88f1d23f1b03 100644 (file)
@@ -1,8 +1,9 @@
 ;;; erc-track.el --- Track modified channel buffers
 
-;; Copyright (C) 2002-2012 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2013 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <mlang@delysid.org>
+;; Maintainer: FSF
 ;; Keywords: comm, faces
 ;; URL: http://www.emacswiki.org/cgi-bin/wiki.pl?ErcChannelTracking
 
@@ -24,7 +25,7 @@
 ;;; Commentary:
 
 ;; Highlights keywords and pals (friends), and hides or highlights fools
-;; (using a dark color).  Add to your ~/.emacs:
+;; (using a dark color).  Add to your init file:
 
 ;; (require 'erc-track)
 ;; (erc-track-mode 1)
@@ -33,7 +34,7 @@
 ;; * Add extensibility so that custom functions can track
 ;;   custom modification types.
 
-(eval-when-compile (require 'cl))
+(eval-when-compile (require 'cl-lib))
 (require 'erc)
 (require 'erc-compat)
 (require 'erc-match)
@@ -41,7 +42,7 @@
 ;;; Code:
 
 (defgroup erc-track nil
-  "Track active buffers and show activity in the modeline."
+  "Track active buffers and show activity in the mode line."
   :group 'erc)
 
 (defcustom erc-track-enable-keybindings 'ask
@@ -196,7 +197,7 @@ The faces used are the same as used for text in the buffers.
     erc-notice-face
     erc-input-face
     erc-prompt-face)
-  "A list of faces used to highlight active buffer names in the modeline.
+  "A list of faces used to highlight active buffer names in the mode line.
 If a message contains one of the faces in this list, the buffer name will
 be highlighted using that face.  The first matching face is used."
   :group 'erc-track
@@ -228,10 +229,10 @@ setting this variable might not be very useful."
     erc-default-face
     erc-action-face)
   "A list of faces considered to be part of normal conversations.
-This list is used to highlight active buffer names in the modeline.
+This list is used to highlight active buffer names in the mode line.
 
 If a message contains one of the faces in this list, and the
-previous modeline face for this buffer is also in this list, then
+previous mode line face for this buffer is also in this list, then
 the buffer name will be highlighted using the face from the
 message.  This gives a rough indication that active conversations
 are occurring in these channels.
@@ -483,7 +484,7 @@ START is the minimum length of the name used."
 
 ;;; Test:
 
-(assert
+(cl-assert
  (and
   ;; verify examples from the doc strings
   (equal (let ((erc-track-shorten-aggressively nil))
@@ -868,11 +869,11 @@ Use `erc-make-mode-line-buffer-name' to create buttons."
   (setq erc-modified-channels-alist
        (delete (assq buffer erc-modified-channels-alist)
                erc-modified-channels-alist))
-  (when (interactive-p)
+  (when (called-interactively-p 'interactive)
     (erc-modified-channels-display)))
 
 (defun erc-track-find-face (faces)
-  "Return the face to use in the modeline from the faces in FACES.
+  "Return the face to use in the mode line from the faces in FACES.
 If `erc-track-faces-priority-list' is set, the one from FACES who
 is first in that list will be used.  If nothing matches or if
 `erc-track-faces-priority-list' is not set, the default mode-line
@@ -906,7 +907,7 @@ element."
 
 (defun erc-track-modified-channels ()
   "Hook function for `erc-insert-post-hook' to check if the current
-buffer should be added to the modeline as a hidden, modified
+buffer should be added to the mode line as a hidden, modified
 channel.  Assumes it will only be called when current-buffer
 is in `erc-mode'."
   (let ((this-channel (or (erc-default-target)
@@ -979,7 +980,7 @@ is in `erc-mode'."
        (add-to-list 'faces cur)))
     faces))
 
-(assert
+(cl-assert
  (let ((str "is bold"))
    (put-text-property 3 (length str)
                      'face '(bold erc-current-nick-face)
@@ -1029,17 +1030,17 @@ relative to `erc-track-switch-direction'"
   (let ((dir erc-track-switch-direction)
        offset)
     (when (< arg 0)
-      (setq dir (case dir
-                 (oldest      'newest)
-                 (newest      'oldest)
-                 (mostactive  'leastactive)
-                 (leastactive 'mostactive)
-                 (importance  'oldest)))
+      (setq dir (pcase dir
+                 (`oldest      'newest)
+                 (`newest      'oldest)
+                 (`mostactive  'leastactive)
+                 (`leastactive 'mostactive)
+                 (`importance  'oldest)))
       (setq arg (- arg)))
-    (setq offset (case dir
-                  ((oldest leastactive)
+    (setq offset (pcase dir
+                  ((or `oldest `leastactive)
                    (- (length erc-modified-channels-alist) arg))
-                  (t (1- arg))))
+                  (_ (1- arg))))
     ;; normalize out of range user input
     (cond ((>= offset (length erc-modified-channels-alist))
           (setq offset (1- (length erc-modified-channels-alist))))