+ (when (featurep 'toolbar)
+ (if (and message-use-toolbar
+ (message-xmas-setup-toolbar message-toolbar))
+ (let ((bar (or (intern-soft (format "%s-toolbar" message-use-toolbar))
+ 'default-toolbar))
+ (height (car message-toolbar-thickness))
+ (width (cdr message-toolbar-thickness))
+ (cur (current-buffer))
+ bars)
+ (set-specifier (symbol-value bar) message-toolbar cur)
+ (set-specifier default-toolbar-height height cur)
+ (set-specifier default-toolbar-width width cur)
+ (set-specifier top-toolbar-height height cur)
+ (set-specifier bottom-toolbar-height height cur)
+ (set-specifier right-toolbar-width width cur)
+ (set-specifier left-toolbar-width width cur)
+ (if (eq bar 'default-toolbar)
+ (progn
+ (remove-specifier default-toolbar-visible-p cur)
+ (remove-specifier top-toolbar cur)
+ (remove-specifier top-toolbar-visible-p cur)
+ (remove-specifier bottom-toolbar cur)
+ (remove-specifier bottom-toolbar-visible-p cur)
+ (remove-specifier right-toolbar cur)
+ (remove-specifier right-toolbar-visible-p cur)
+ (remove-specifier left-toolbar cur)
+ (remove-specifier left-toolbar-visible-p cur))
+ (set-specifier (symbol-value (intern (format "%s-visible-p" bar)))
+ t cur)
+ (setq bars (delq bar (list 'default-toolbar
+ 'bottom-toolbar 'top-toolbar
+ 'right-toolbar 'left-toolbar)))
+ (while bars
+ (set-specifier (symbol-value (intern (format "%s-visible-p"
+ (pop bars))))
+ nil cur))))
+ (let ((cur (current-buffer)))
+ (set-specifier default-toolbar-visible-p nil cur)
+ (set-specifier top-toolbar-visible-p nil cur)
+ (set-specifier bottom-toolbar-visible-p nil cur)
+ (set-specifier right-toolbar-visible-p nil cur)
+ (set-specifier left-toolbar-visible-p nil cur)))))
+
+(defun message-xmas-exchange-point-and-mark ()
+ "Exchange point and mark, but allow for XEmacs' optional argument."
+ (exchange-point-and-mark message-xmas-dont-activate-region))
+
+(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))))
+
+(defun message-xmas-make-date (&optional now)
+ "Make a valid data header.
+If NOW, use that time instead."
+ (let ((zone (car (current-time-zone)))
+ sign)
+ (if (>= zone 0)
+ (setq sign "+")
+ (setq sign "-"
+ zone (- zone)))
+ (format "%s %s%02d%02d"
+ (format-time-string "%a, %d %b %Y %T" now)
+ sign
+ (/ zone 3600)
+ (/ (% zone 3600) 60))))
+
+(add-hook 'message-mode-hook 'message-xmas-maybe-fontify)
+
+(defun message-xmas-redefine ()
+ "Redefine message functions for XEmacs."
+ (defalias 'message-exchange-point-and-mark
+ 'message-xmas-exchange-point-and-mark)
+ (defalias 'message-mark-active-p
+ 'region-exists-p)
+ (defalias 'message-make-caesar-translation-table
+ 'message-xmas-make-caesar-translation-table)
+ (defalias 'message-make-overlay 'make-extent)
+ (defalias 'message-delete-overlay 'delete-extent)
+ (defalias 'message-overlay-put 'set-extent-property)
+ (defalias 'message-make-date 'message-xmas-make-date))
+
+(message-xmas-redefine)