diff lisp/erc/erc.el @ 68814:fe9073ac802e

Revision: emacs@sv.gnu.org/emacs--devo--0--patch-73 Creator: Michael Olson <mwolson@gnu.org> Merge from erc--emacs--0
author Miles Bader <miles@gnu.org>
date Sun, 12 Feb 2006 12:02:53 +0000
parents 2de3fcf69715
children 133ba2ee7e43
line wrap: on
line diff
--- a/lisp/erc/erc.el	Sun Feb 12 00:29:59 2006 +0000
+++ b/lisp/erc/erc.el	Sun Feb 12 12:02:53 2006 +0000
@@ -1719,22 +1719,15 @@
 (defun erc-migrate-modules (mods)
   "Migrate old names of ERC modules to new ones."
   ;; modify `transforms' to specify what needs to be changed
-  ;; each item is in the format '(new .old)
-  (let ((transforms '((pcomplete . completion)))
-	(modules (copy-alist mods)))
-    (dolist (transform transforms)
-      (let ((addp nil))
-	(setq modules (erc-delete-if `(lambda (val)
-					(and (eq val ',(car transform))
-					     (setq addition t)))
-				     modules))
-	(when addp
-	  (add-to-list 'modules (cdr transform)))))
-    (erc-delete-dups modules)))
-
-(defcustom erc-modules '(netsplit fill button match track pcomplete readonly
+  ;; each item is in the format '(old . new)
+  (let ((transforms '((pcomplete . completion))))
+    (erc-delete-dups
+     (mapcar (lambda (m) (or (cdr (assoc m transforms)) m))
+	     mods))))
+
+(defcustom erc-modules '(netsplit fill button match track completion readonly
 				  ring autojoin noncommands irccontrols
-				  stamp)
+				  stamp list)
   "A list of modules which erc should enable.
 If you set the value of this without using `customize' remember to call
 \(erc-update-modules) after you change it.  When using `customize', modules
@@ -1755,40 +1748,42 @@
 	 ;; this test is for the case where erc hasn't been loaded yet
 	 (when (fboundp 'erc-update-modules)
 	   (erc-update-modules)))
-  :type '(set :greedy t
-	      (const :tag "Set away status automatically" autoaway)
-	      (const :tag "Join channels automatically" autojoin)
-	      (const :tag "Integrate with Big Brother Database" bbdb)
-	      (const :tag "Buttonize URLs, nicknames, and other text" button)
-	      (const :tag "Wrap long lines" fill)
-	      (const :tag "Highlight or remove IRC control characters"
-		     irccontrols)
-	      (const :tag "Save buffers in logs" log)
-	      (const :tag "Highlight pals, fools, and other keywords" match)
-	      (const :tag "Detect netsplits" netsplit)
-	      (const :tag "Don't display non-IRC commands after evaluation"
-		     noncommands)
-	      (const :tag
-		     "Notify when the online status of certain users changes"
-		     notify)
-	      (const :tag "Complete nicknames and commands (programmable)"
-		     completion)
-	      (const :tag "Complete nicknames and commands (old)" hecomplete)
-	      (const :tag "Make displayed lines read-only" readonly)
-	      (const :tag "Replace text in messages" replace)
-	      (const :tag "Enable an input history" ring)
-	      (const :tag "Scroll to the bottom of the buffer" scrolltobottom)
-	      (const :tag "Identify to Nickserv (IRC Services) automatically"
-		     services)
-	      (const :tag "Convert smileys to pretty icons" smiley)
-	      (const :tag "Play sounds when you receive CTCP SOUND requests"
-		     sound)
-	      (const :tag "Add timestamps to messages" stamp)
-	      (const :tag "Check spelling" spelling)
-	      (const :tag "Track channel activity in the mode-line" track)
-	      (const :tag "Truncate buffers to a certain size" truncate)
-	      (const :tag "Translate morse code in messages" unmorse)
-	      (repeat :tag "Others" :inline t symbol))
+  :type
+  '(set
+    :greedy t
+    (const :tag "Set away status automatically" autoaway)
+    (const :tag "Join channels automatically" autojoin)
+    (const :tag "Integrate with Big Brother Database" bbdb)
+    (const :tag "Buttonize URLs, nicknames, and other text" button)
+    (const :tag "Wrap long lines" fill)
+    (const :tag "Highlight or remove IRC control characters"
+	   irccontrols)
+    (const :tag "Save buffers in logs" log)
+    (const :tag "Highlight pals, fools, and other keywords" match)
+    (const :tag "Detect netsplits" netsplit)
+    (const :tag "Don't display non-IRC commands after evaluation"
+	   noncommands)
+    (const :tag
+	   "Notify when the online status of certain users changes"
+	   notify)
+    (const :tag "Complete nicknames and commands (programmable)"
+	   completion)
+    (const :tag "Complete nicknames and commands (old)" hecomplete)
+    (const :tag "Make displayed lines read-only" readonly)
+    (const :tag "Replace text in messages" replace)
+    (const :tag "Enable an input history" ring)
+    (const :tag "Scroll to the bottom of the buffer" scrolltobottom)
+    (const :tag "Identify to Nickserv (IRC Services) automatically"
+	   services)
+    (const :tag "Convert smileys to pretty icons" smiley)
+    (const :tag "Play sounds when you receive CTCP SOUND requests"
+	   sound)
+    (const :tag "Add timestamps to messages" stamp)
+    (const :tag "Check spelling" spelling)
+    (const :tag "Track channel activity in the mode-line" track)
+    (const :tag "Truncate buffers to a certain size" truncate)
+    (const :tag "Translate morse code in messages" unmorse)
+    (repeat :tag "Others" :inline t symbol))
   :group 'erc)
 
 (defun erc-update-modules ()
@@ -1799,14 +1794,11 @@
       (cond
        ;; yuck. perhaps we should bring the filenames into sync?
        ((string= req "erc-completion")
-	(setq req "erc-pcomplete")
-	(setq mod 'completion))
+	(setq req "erc-pcomplete"))
        ((string= req "erc-pcomplete")
-	(setq req "erc-pcomplete")
 	(setq mod 'completion))
        ((string= req "erc-autojoin")
-	(setq req "erc-join")
-	(setq mod 'autojoin)))
+	(setq req "erc-join")))
       (condition-case nil
 	  (require (intern req))
 	(error nil))
@@ -6143,6 +6135,26 @@
 			       (funcall erc-part-reason nil))
 		       nil tgt))))
 
+;;; Dealing with `erc-parsed'
+
+(defun erc-get-parsed-vector (point)
+  "Return the whole parsed vector on POINT."
+  (get-text-property point 'erc-parsed))
+
+(defun erc-get-parsed-vector-nick (vect)
+  "Return nickname in the parsed vector VECT."
+  (let* ((untreated-nick (and vect (erc-response.sender vect)))
+	 (maybe-nick (when untreated-nick
+		       (car (split-string untreated-nick "!")))))
+    (when (and (not (null maybe-nick))
+	       (erc-is-valid-nick-p maybe-nick))
+      untreated-nick)))
+
+(defun erc-get-parsed-vector-type (vect)
+  "Return message type in the parsed vector VECT."
+  (and vect
+       (erc-response.command vect)))
+
 (provide 'erc)
 
 ;;; Deprecated. We might eventually stop requiring the goodies automatically.