1 ;;; messagexmas.el --- XEmacs extensions to message
2 ;; Copyright (C) 1996,97,98 Free Software Foundation, Inc.
4 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5 ;; Keywords: mail, news
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
30 (defvar message-xmas-dont-activate-region t
31 "If t, don't activate region after yanking.")
33 (defvar message-xmas-glyph-directory nil
34 "*Directory where Message logos and icons are located.
35 If this variable is nil, Message will try to locate the directory
38 (defvar message-use-toolbar (if (featurep 'toolbar)
41 "*If nil, do not use a toolbar.
42 If it is non-nil, it must be a toolbar. The five legal values are
43 `default-toolbar', `top-toolbar', `bottom-toolbar',
44 `right-toolbar', and `left-toolbar'.")
46 (defvar message-toolbar
47 '([message-spell ispell-message t "Spell"]
48 [message-help (Info-goto-node "(Message)Top") t "Message help"])
49 "The message buffer toolbar.")
51 (defun message-xmas-find-glyph-directory (&optional package)
52 (setq package (or package "message"))
53 (let ((dir (symbol-value
54 (intern-soft (concat package "-xmas-glyph-directory")))))
55 (if (and (stringp dir) (file-directory-p dir))
57 (nnheader-find-etc-directory package))))
59 (defun message-xmas-setup-toolbar (bar &optional force package)
60 (let ((dir (message-xmas-find-glyph-directory package))
61 (xpm (if (featurep 'xpm) "xpm" "xbm"))
62 icon up down disabled name)
64 (setq message-xmas-glyph-directory dir))
67 (setq icon (aref (car bar) 0)
68 name (symbol-name icon)
72 (setq up (concat dir name "-up." xpm))
73 (setq down (concat dir name "-down." xpm))
74 (setq disabled (concat dir name "-disabled." xpm))
75 (if (not (file-exists-p up))
78 (set icon (toolbar-make-button-list
79 up (and (file-exists-p down) down)
80 (and (file-exists-p disabled) disabled)))))))
83 (defun message-setup-toolbar ()
84 (and message-use-toolbar
85 (message-xmas-setup-toolbar message-toolbar)
86 (set-specifier (symbol-value message-use-toolbar)
87 (cons (current-buffer) message-toolbar))))
89 (defun message-xmas-exchange-point-and-mark ()
90 "Exchange point and mark, but allow for XEmacs' optional argument."
91 (exchange-point-and-mark message-xmas-dont-activate-region))
93 (fset 'message-exchange-point-and-mark 'message-xmas-exchange-point-and-mark)
95 (defun message-xmas-maybe-fontify ()
96 (when (featurep 'font-lock)
97 (font-lock-set-defaults)))
99 (defun message-xmas-make-caesar-translation-table (n)
100 "Create a rot table with offset N."
102 (table (make-string 256 0))
105 (while (< (incf i) 256)
108 (substring table 0 A)
109 (substring table (+ A n) (+ A n (- 26 n)))
110 (substring table A (+ A n))
111 (substring table (+ A 26) a)
112 (substring table (+ a n) (+ a n (- 26 n)))
113 (substring table a (+ a n))
114 (substring table (+ a 26) 255))))
116 (when (>= emacs-major-version 20)
117 (fset 'message-make-caesar-translation-table
118 'message-xmas-make-caesar-translation-table))
120 (add-hook 'message-mode-hook 'message-xmas-maybe-fontify)
122 (provide 'messagexmas)
124 ;;; messagexmas.el ends here