Fix my last change.
[gnus] / lisp / messagexmas.el
index 4a9d28a..6ee575c 100644 (file)
@@ -1,7 +1,7 @@
 ;;; messagexmas.el --- XEmacs extensions to message
-;; Copyright (C) 1996,97 Free Software Foundation, Inc.
+;; Copyright (C) 1996,97,98,99 Free Software Foundation, Inc.
 
-;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;; Keywords: mail, news
 
 ;; This file is part of GNU Emacs.
@@ -39,11 +39,11 @@ automatically.")
                                'default-toolbar
                              nil)
   "*If nil, do not use a toolbar.
-If it is non-nil, it must be a toolbar.  The five legal values are
+If it is non-nil, it must be a toolbar.  The five valid values are
 `default-toolbar', `top-toolbar', `bottom-toolbar',
 `right-toolbar', and `left-toolbar'.")
 
-(defvar message-toolbar 
+(defvar message-toolbar
   '([message-spell ispell-message t "Spell"]
     [message-help (Info-goto-node "(Message)Top") t "Message help"])
   "The message buffer toolbar.")
@@ -90,7 +90,35 @@ If it is non-nil, it must be a toolbar.  The five legal values are
   "Exchange point and mark, but allow for XEmacs' optional argument."
   (exchange-point-and-mark message-xmas-dont-activate-region))
 
-(fset 'message-exchange-point-and-mark 'message-xmas-exchange-point-and-mark)
+(defalias 'message-exchange-point-and-mark 
+  'message-xmas-exchange-point-and-mark)
+
+(defun message-xmas-maybe-fontify ()
+  (when (featurep 'font-lock)
+    (font-lock-set-defaults)))
+
+(defun message-xmas-make-caesar-translation-table (n)
+  "Create a rot table with offset N."
+  (let ((i -1)
+       (table (make-string 256 0))
+       (a (mm-char-int ?a))
+       (A (mm-char-int ?A)))
+    (while (< (incf i) 256)
+      (aset table i i))
+    (concat
+     (substring table 0 A)
+     (substring table (+ A n) (+ A n (- 26 n)))
+     (substring table A (+ A n))
+     (substring table (+ A 26) a)
+     (substring table (+ a n) (+ a n (- 26 n)))
+     (substring table a (+ a n))
+     (substring table (+ a 26) 255))))
+
+(when (>= emacs-major-version 20)
+  (defalias 'message-make-caesar-translation-table
+    'message-xmas-make-caesar-translation-table))
+
+(add-hook 'message-mode-hook 'message-xmas-maybe-fontify)
 
 (provide 'messagexmas)