annotate lisp/gnus/messagexmas.el @ 100:4be1180a9e89 r20-1b2

Import from CVS: tag r20-1b2
author cvs
date Mon, 13 Aug 2007 09:15:11 +0200
parents 0d2f883870bc
children 360340f9fd5f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;; messagexmas.el --- XEmacs extensions to message
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
2 ;; Copyright (C) 1996,97 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; Keywords: mail, news
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;; This file is part of GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;; it under the terms of the GNU General Public License as published by
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; GNU Emacs is distributed in the hope that it will be useful,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; GNU General Public License for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;; You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 ;; Boston, MA 02111-1307, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
28 (require 'nnheader)
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
29
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
30 (defvar message-xmas-dont-activate-region t
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 "If t, don't activate region after yanking.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (defvar message-xmas-glyph-directory nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 "*Directory where Message logos and icons are located.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 If this variable is nil, Message will try to locate the directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 automatically.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 (defvar message-use-toolbar (if (featurep 'toolbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 'default-toolbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 "*If nil, do not use a toolbar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 If it is non-nil, it must be a toolbar. The five legal values are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 `default-toolbar', `top-toolbar', `bottom-toolbar',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 `right-toolbar', and `left-toolbar'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents: 32
diff changeset
46 (defvar message-toolbar
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 '([message-spell ispell-message t "Spell"]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 [message-help (Info-goto-node "(Message)Top") t "Message help"])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 "The message buffer toolbar.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (defun message-xmas-find-glyph-directory (&optional package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (setq package (or package "message"))
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
53 (let ((dir (symbol-value
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
54 (intern-soft (concat package "-xmas-glyph-directory")))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 (if (and (stringp dir) (file-directory-p dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 dir
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
57 (nnheader-find-etc-directory package))))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (defun message-xmas-setup-toolbar (bar &optional force package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (let ((dir (message-xmas-find-glyph-directory package))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (xpm (if (featurep 'xpm) "xpm" "xbm"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 icon up down disabled name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (unless package
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (setq message-xmas-glyph-directory dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 (when dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (while bar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (setq icon (aref (car bar) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 name (symbol-name icon)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 bar (cdr bar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 (when (or force
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (not (boundp icon)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (setq up (concat dir name "-up." xpm))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (setq down (concat dir name "-down." xpm))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (setq disabled (concat dir name "-disabled." xpm))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (if (not (file-exists-p up))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (setq bar nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 dir nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (set icon (toolbar-make-button-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 up (and (file-exists-p down) down)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (and (file-exists-p disabled) disabled)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (defun message-setup-toolbar ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (and message-use-toolbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (message-xmas-setup-toolbar message-toolbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (set-specifier (symbol-value message-use-toolbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (cons (current-buffer) message-toolbar))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (defun message-xmas-exchange-point-and-mark ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 "Exchange point and mark, but allow for XEmacs' optional argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (exchange-point-and-mark message-xmas-dont-activate-region))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (fset 'message-exchange-point-and-mark 'message-xmas-exchange-point-and-mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
95 (defun message-xmas-maybe-fontify ()
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
96 (when (and (featurep 'font-lock)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
97 font-lock-auto-fontify)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
98 (turn-on-font-lock)))
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
99
100
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
100 (defun message-xmas-make-caesar-translation-table (n)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
101 "Create a rot table with offset N."
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
102 (let ((i -1)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
103 (table (make-string 256 0))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
104 (a (char-int ?a))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
105 (A (char-int ?A)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
106 (while (< (incf i) 256)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
107 (aset table i i))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
108 (concat
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
109 (substring table 0 A)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
110 (substring table (+ A n) (+ A n (- 26 n)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
111 (substring table A (+ A n))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
112 (substring table (+ A 26) a)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
113 (substring table (+ a n) (+ a n (- 26 n)))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
114 (substring table a (+ a n))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
115 (substring table (+ a 26) 255))))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
116
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
117 (when (>= emacs-major-version 20)
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
118 (fset 'message-make-caesar-translation-table
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
119 'message-xmas-make-caesar-translation-table))
4be1180a9e89 Import from CVS: tag r20-1b2
cvs
parents: 98
diff changeset
120
98
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
121 (add-hook 'message-mode-hook 'message-xmas-maybe-fontify)
0d2f883870bc Import from CVS: tag r20-1b1
cvs
parents: 70
diff changeset
122
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 (provide 'messagexmas)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ;;; messagexmas.el ends here