annotate lisp/gnus/messagexmas.el @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children ac2d302a0011
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;; Copyright (C) 1996 Free Software Foundation, Inc.
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 (defvar message-xmas-dont-activate-region nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 "If t, don't activate region after yanking.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 (defvar message-xmas-glyph-directory nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 "*Directory where Message logos and icons are located.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 If this variable is nil, Message will try to locate the directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 automatically.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 (defvar message-use-toolbar (if (featurep 'toolbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 'default-toolbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 "*If nil, do not use a toolbar.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 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
41 `default-toolbar', `top-toolbar', `bottom-toolbar',
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 `right-toolbar', and `left-toolbar'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 (defvar message-toolbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 '([message-spell ispell-message t "Spell"]
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 [message-help (Info-goto-node "(Message)Top") t "Message help"])
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 "The message buffer toolbar.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (defun message-xmas-find-glyph-directory (&optional package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (setq package (or package "message"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (let ((path load-path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (dir (symbol-value
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (intern-soft (concat package "-xmas-glyph-directory"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 result)
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 ;; We try to find the dir by looking at the load path,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 ;; stripping away the last component and adding "etc/".
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 (while path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 (if (and (car path)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 (file-exists-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 (setq dir (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 (file-name-directory
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 (directory-file-name (car path)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 "etc/" (or package "message") "/")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 (file-directory-p dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 (setq result dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 path nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 (setq path (cdr path))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 result)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 (defun message-xmas-setup-toolbar (bar &optional force package)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (let ((dir (message-xmas-find-glyph-directory package))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 (xpm (if (featurep 'xpm) "xpm" "xbm"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 icon up down disabled name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (unless package
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 (setq message-xmas-glyph-directory dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 (when dir
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (while bar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 (setq icon (aref (car bar) 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 name (symbol-name icon)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 bar (cdr bar))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 (when (or force
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (not (boundp icon)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (setq up (concat dir name "-up." xpm))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 (setq down (concat dir name "-down." xpm))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (setq disabled (concat dir name "-disabled." xpm))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (if (not (file-exists-p up))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 (setq bar nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 dir nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (set icon (toolbar-make-button-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 up (and (file-exists-p down) down)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (and (file-exists-p disabled) disabled)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 (defun message-setup-toolbar ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (and message-use-toolbar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 (message-xmas-setup-toolbar message-toolbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 (set-specifier (symbol-value message-use-toolbar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (cons (current-buffer) message-toolbar))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (defun message-xmas-exchange-point-and-mark ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 "Exchange point and mark, but allow for XEmacs' optional argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 (exchange-point-and-mark message-xmas-dont-activate-region))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (fset 'message-exchange-point-and-mark 'message-xmas-exchange-point-and-mark)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 (provide 'messagexmas)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 ;;; messagexmas.el ends here