]> code.delx.au - gnu-emacs/blobdiff - lisp/erc/erc.el
* term/ns-win.el (ns-alternatives-map, ns-insert-working-text)
[gnu-emacs] / lisp / erc / erc.el
index e98c9d29baa84cb8d595da31bb2d2035dfcc9548..5066efa3bedd29d7b5b3285511469cdccbaa8293 100644 (file)
@@ -1,7 +1,7 @@
 ;; erc.el --- An Emacs Internet Relay Chat client
 
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-;;   2006, 2007, 2008 Free Software Foundation, Inc.
+;;   2006, 2007, 2008, 2009 Free Software Foundation, Inc.
 
 ;; Author: Alexander L. Belikoff (alexander@belikoff.net)
 ;; Contributors: Sergey Berezin (sergey.berezin@cs.cmu.edu),
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,9 +26,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -1110,6 +1108,7 @@ which the local user typed."
     (define-key map "\C-c\C-r" 'erc-remove-text-properties-region)
     (define-key map "\C-c\C-t" 'erc-set-topic)
     (define-key map "\C-c\C-u" 'erc-kill-input)
+    (define-key map "\C-c\C-x" 'erc-quit-server)
     (define-key map "\M-\t" 'ispell-complete-word)
     (define-key map "\t" 'erc-complete-word)
 
@@ -1168,7 +1167,8 @@ See the variable `erc-command-indicator'."
   :group 'erc-faces)
 
 (defface erc-notice-face
-  (if (featurep 'xemacs)
+  (if (or (featurep 'xemacs)
+         (< emacs-major-version 22))
       '((t (:bold t :foreground "blue")))
     '((((class color) (min-colors 88))
        (:bold t :foreground "SlateBlue"))
@@ -2368,8 +2368,8 @@ If STRING is nil, the function does nothing."
          (unless (string-match "\n$" string)
            (setq string (concat string "\n"))
            (when (erc-string-invisible-p string)
-             (erc-put-text-properties 0 (length string) string
-                                      '(invisible intangible))))
+             (erc-put-text-properties 0 (length string)
+                                      '(invisible intangible) string)))
          (erc-log (concat "erc-display-line: " string
                           (format "(%S)" string) " in buffer "
                           (format "%s" buffer)))
@@ -2426,7 +2426,7 @@ If STRING is nil, the function does nothing."
        (setq list (cdr list))))))
 
 (defvar erc-valid-nick-regexp "[]a-zA-Z^[;\\`_{}|][]^[;\\`_{}|a-zA-Z0-9-]*"
-  "Regexp which matches all legal characters in a IRC nickname.")
+  "Regexp which matches all valid characters in a IRC nickname.")
 
 (defun erc-is-valid-nick-p (nick)
   "Check if NICK is a valid IRC nickname."
@@ -3367,9 +3367,8 @@ the message given by REASON."
   t)
 (put 'erc-cmd-SERVER 'process-not-needed t)
 
-(eval-when-compile
-  (defvar motif-version-string)
-  (defvar gtk-version-string))
+(defvar motif-version-string)
+(defvar gtk-version-string)
 
 (defun erc-cmd-SV ()
   "Say the current ERC and Emacs version into channel."
@@ -3385,7 +3384,6 @@ the message given by REASON."
                                   ((featurep 'gtk)
                                    (concat ", GTK+ Version "
                                            gtk-version-string))
-                                  ((featurep 'mac-carbon) ", Mac Carbon")
                                   ((featurep 'x-toolkit) ", X toolkit")
                                   (t ""))
                             (if (and (boundp 'x-toolkit-scroll-bars)
@@ -3710,7 +3708,9 @@ If FACE is non-nil, it will be used to propertize the prompt.  If it is nil,
   (let ((minibuffer-allow-text-properties t)
        (read-map minibuffer-local-map))
     (insert (read-from-minibuffer "Message: "
-                                 (string last-command-char) read-map))
+                                 (string (if (featurep 'xemacs)
+                                             last-command-char
+                                           last-command-event)) read-map))
     (erc-send-current-line)))
 
 (defvar erc-action-history-list ()
@@ -4026,7 +4026,7 @@ and as second argument the event parsed as a vector."
               (string= target (erc-current-nick)))
           (not (erc-get-buffer query proc))
           (not (erc-is-message-ctcp-and-not-action-p msg))
-          (let ((erc-join-buffer erc-auto-query))
+          (let ((erc-query-display erc-auto-query))
             (erc-cmd-QUERY query))
           nil))))
 
@@ -4185,7 +4185,7 @@ See also: `erc-echo-notice-in-user-buffers',
 (defun erc-banlist-store (proc parsed)
   "Record ban entries for a channel."
   (multiple-value-bind (channel mask whoset)
-      (cdr (erc-response.command-args parsed))
+      (values-list (cdr (erc-response.command-args parsed)))
     ;; Determine to which buffer the message corresponds
     (let ((buffer (erc-get-buffer channel proc)))
       (with-current-buffer buffer
@@ -5041,9 +5041,9 @@ each property to the corresponding value in VALUE-LIST."
     (setq value-list (mapcar (lambda (x)
                               t)
                             properties)))
-  (mapcar* (lambda (prop value)
-            (erc-put-text-property start end prop value object))
-          properties value-list))
+  (while (and properties value-list)
+    (erc-put-text-property
+     start end (pop properties) (pop value-list) object)))
 
 ;;; Input area handling:
 
@@ -5099,7 +5099,7 @@ Specifically, return the position of `erc-insert-marker'."
 
 (defun erc-user-input ()
   "Return the input of the user in the current buffer."
-  (buffer-substring
+  (buffer-substring-no-properties
    erc-input-marker
    (erc-end-of-input-line)))
 
@@ -5475,6 +5475,7 @@ If CHANNEL is non-nil, toggle MODE for that channel, otherwise use
   (save-excursion
     (let ((inhibit-read-only t))
       (set-text-properties start end nil object))))
+(put 'erc-remove-text-properties-region 'disabled t)
 
 ;; script execution and startup
 
@@ -5915,6 +5916,11 @@ See `erc-mode-line-format' for which characters are can be used."
   :type '(choice (const :tag "Disabled" nil)
                 string))
 
+(defcustom erc-header-line-uses-tabbar-p nil
+  "Use tabbar mode instead of the header line to display the header."
+  :group 'erc-mode-line-and-header
+  :type 'boolean)
+
 (defcustom erc-header-line-uses-help-echo-p t
   "Show the contents of the header line in the echo area or as a tooltip
 when you move point into the header line."
@@ -6047,6 +6053,8 @@ if `erc-away' is non-nil."
 ;; erc-goodies is required at end of this file.
 (declare-function erc-controls-strip "erc-goodies" (str))
 
+(defvar tabbar--local-hlf)
+
 (defun erc-update-mode-line-buffer (buffer)
   "Update the mode line in a single ERC buffer BUFFER."
   (with-current-buffer buffer
@@ -6086,7 +6094,11 @@ if `erc-away' is non-nil."
        (let ((header (if erc-header-line-format
                          (format-spec erc-header-line-format spec)
                        nil)))
-         (cond ((null header)
+         (cond (erc-header-line-uses-tabbar-p
+                (set (make-local-variable 'tabbar--local-hlf)
+                     header-line-format)
+                (kill-local-variable 'header-line-format))
+               ((null header)
                 (setq header-line-format nil))
                (erc-header-line-uses-help-echo-p
                 (let ((help-echo (with-temp-buffer
@@ -6312,6 +6324,7 @@ All windows are opened in the current frame."
    (s321   . "Channel  Users  Topic")
    (s322   . "%c [%u] %t")
    (s324   . "%c modes: %m")
+   (s328   . "%c URL: %u")
    (s329   . "%c was created on %t")
    (s330   . "%n %a %i")
    (s331   . "No topic is set for %c")