Mercurial > hg > xemacs-beta
comparison lisp/x11/x-toolbar.el @ 120:cca96a509cfe r20-1b12
Import from CVS: tag r20-1b12
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:25:29 +0200 |
parents | 0d2f883870bc |
children | 5a88923fcbfe |
comparison
equal
deleted
inserted
replaced
119:d101af7320b8 | 120:cca96a509cfe |
---|---|
23 ;; | 23 ;; |
24 ;; Miscellaneous toolbar functions, useful for users to redefine, in | 24 ;; Miscellaneous toolbar functions, useful for users to redefine, in |
25 ;; order to get different behaviour. | 25 ;; order to get different behaviour. |
26 ;; | 26 ;; |
27 | 27 |
28 (defvar toolbar-open-function 'find-file | 28 (defgroup toolbar nil |
29 "*Function to call when the open icon is selected.") | 29 "Configure XEmacs Toolbar functions and properties" |
30 :group 'environment) | |
31 | |
32 (defcustom toolbar-open-function 'find-file | |
33 "*Function to call when the open icon is selected." | |
34 :type '(radio (function-item find-file) | |
35 (function :tag "Other")) | |
36 :group 'toolbar) | |
30 | 37 |
31 (defun toolbar-open () | 38 (defun toolbar-open () |
32 (interactive) | 39 (interactive) |
33 (call-interactively toolbar-open-function)) | 40 (call-interactively toolbar-open-function)) |
34 | 41 |
35 (defvar toolbar-dired-function 'dired | 42 (defcustom toolbar-dired-function 'dired |
36 "*Function to call when the dired icon is selected.") | 43 "*Function to call when the dired icon is selected." |
44 :type '(radio (function-item dired) | |
45 (function :tag "Other")) | |
46 :group 'toolbar) | |
37 | 47 |
38 (defun toolbar-dired () | 48 (defun toolbar-dired () |
39 (interactive) | 49 (interactive) |
40 (call-interactively toolbar-dired-function)) | 50 (call-interactively toolbar-dired-function)) |
41 | 51 |
42 (defvar toolbar-save-function 'save-buffer | 52 (defcustom toolbar-save-function 'save-buffer |
43 "*Function to call when the save icon is selected.") | 53 "*Function to call when the save icon is selected." |
54 :type '(radio (function-item save-buffer) | |
55 (function :tag "Other")) | |
56 :group 'toolbar) | |
44 | 57 |
45 (defun toolbar-save () | 58 (defun toolbar-save () |
46 (interactive) | 59 (interactive) |
47 (call-interactively toolbar-save-function)) | 60 (call-interactively toolbar-save-function)) |
48 | 61 |
49 (defvar toolbar-print-function 'lpr-buffer | 62 (defcustom toolbar-print-function 'lpr-buffer |
50 "*Function to call when the print icon is selected.") | 63 "*Function to call when the print icon is selected." |
64 :type '(radio (function-item lpr-buffer) | |
65 (function :tag "Other")) | |
66 :group 'toolbar) | |
51 | 67 |
52 (defun toolbar-print () | 68 (defun toolbar-print () |
53 (interactive) | 69 (interactive) |
54 (call-interactively toolbar-print-function)) | 70 (call-interactively toolbar-print-function)) |
55 | 71 |
56 (defvar toolbar-cut-function 'x-kill-primary-selection | 72 (defcustom toolbar-cut-function 'x-kill-primary-selection |
57 "*Function to call when the cut icon is selected.") | 73 "*Function to call when the cut icon is selected." |
74 :type '(radio (function-item x-kill-primary-selection) | |
75 (function :tag "Other")) | |
76 :group 'toolbar) | |
58 | 77 |
59 (defun toolbar-cut () | 78 (defun toolbar-cut () |
60 (interactive) | 79 (interactive) |
61 (call-interactively toolbar-cut-function)) | 80 (call-interactively toolbar-cut-function)) |
62 | 81 |
63 (defvar toolbar-copy-function 'x-copy-primary-selection | 82 (defcustom toolbar-copy-function 'x-copy-primary-selection |
64 "*Function to call when the copy icon is selected.") | 83 "*Function to call when the copy icon is selected." |
84 :type '(radio (function-item x-copy-primary-selection) | |
85 (function :tag "Other")) | |
86 :group 'toolbar) | |
65 | 87 |
66 (defun toolbar-copy () | 88 (defun toolbar-copy () |
67 (interactive) | 89 (interactive) |
68 (call-interactively toolbar-copy-function)) | 90 (call-interactively toolbar-copy-function)) |
69 | 91 |
70 (defvar toolbar-paste-function 'x-yank-clipboard-selection | 92 (defcustom toolbar-paste-function 'x-yank-clipboard-selection |
71 "*Function to call when the paste icon is selected.") | 93 "*Function to call when the paste icon is selected." |
94 :type '(radio (function-item x-yank-primary-selection) | |
95 (function :tag "Other")) | |
96 :group 'toolbar) | |
72 | 97 |
73 (defun toolbar-paste () | 98 (defun toolbar-paste () |
74 (interactive) | 99 (interactive) |
75 (call-interactively toolbar-paste-function)) | 100 (call-interactively toolbar-paste-function)) |
76 | 101 |
77 (defvar toolbar-undo-function 'undo | 102 (defcustom toolbar-undo-function 'undo |
78 "*Function to call when the undo icon is selected.") | 103 "*Function to call when the undo icon is selected." |
104 :type '(radio (function-item undo) | |
105 (function :tag "Other")) | |
106 :group 'toolbar) | |
79 | 107 |
80 (defun toolbar-undo () | 108 (defun toolbar-undo () |
81 (interactive) | 109 (interactive) |
82 (call-interactively toolbar-undo-function)) | 110 (call-interactively toolbar-undo-function)) |
83 | 111 |
84 (defvar toolbar-replace-function 'query-replace | 112 (defcustom toolbar-replace-function 'query-replace |
85 "*Function to call when the replace icon is selected.") | 113 "*Function to call when the replace icon is selected." |
114 :type '(radio (function-item query-replace) | |
115 (function :tag "Other")) | |
116 :group 'toolbar) | |
86 | 117 |
87 (defun toolbar-replace () | 118 (defun toolbar-replace () |
88 (interactive) | 119 (interactive) |
89 (call-interactively toolbar-replace-function)) | 120 (call-interactively toolbar-replace-function)) |
90 | 121 |
91 ;; | 122 ;; |
92 ;; toolbar ispell variables and defuns | 123 ;; toolbar ispell variables and defuns |
93 ;; | 124 ;; |
94 | 125 |
95 (defvar toolbar-ispell-function | 126 (defun toolbar-ispell-internal () |
96 (lambda () | 127 (interactive) |
97 (interactive) | 128 (if (region-active-p) |
98 (if (region-active-p) | 129 (ispell-region (region-beginning) (region-end)) |
99 (ispell-region (region-beginning) (region-end)) | 130 (ispell-buffer))) |
100 (ispell-buffer))) | 131 |
101 "*Function to call when the ispell icon is selected.") | 132 (defcustom toolbar-ispell-function 'toolbar-ispell-internal |
133 "*Function to call when the ispell icon is selected." | |
134 :type '(radio (function-item toolbar-ispell-internal) | |
135 (function :tag "Other")) | |
136 :group 'toolbar) | |
102 | 137 |
103 (defun toolbar-ispell () | 138 (defun toolbar-ispell () |
104 "Intelligently spell the region or buffer." | 139 "Intelligently spell the region or buffer." |
105 (interactive) | 140 (interactive) |
106 (call-interactively toolbar-ispell-function)) | 141 (call-interactively toolbar-ispell-function)) |
107 | 142 |
108 ;; | 143 ;; |
109 ;; toolbar mail variables and defuns | 144 ;; toolbar mail variables and defuns |
110 ;; | 145 ;; |
111 | 146 |
112 (defmacro toolbar-external (process &rest args) | 147 ;; This used to be a macro that expanded its arguments to a form that |
113 `(lambda () (interactive) (call-process ,process nil 0 nil ,@args))) | 148 ;; called `call-process'. With the advent of customize, it's better |
114 | 149 ;; to have it as a defun, to make customization easier. |
115 (defvar toolbar-mail-commands-alist | 150 (defun toolbar-external (process &rest args) |
151 (interactive) | |
152 (apply 'call-process process nil 0 nil args)) | |
153 | |
154 (defcustom toolbar-mail-commands-alist | |
116 `((vm . vm) | 155 `((vm . vm) |
117 (gnus . gnus-no-server) | 156 (gnus . gnus-no-server) |
118 (rmail . rmail) | 157 (rmail . rmail) |
119 (mh . mh-rmail) | 158 (mh . mh-rmail) |
120 (pine . ,(toolbar-external "xterm" "-e" "pine")) ; *gag* | 159 (pine . (toolbar-external "xterm" "-e" "pine")) ; *gag* |
121 (elm . ,(toolbar-external "xterm" "-e" "elm")) | 160 (elm . (toolbar-external "xterm" "-e" "elm")) |
122 (mutt . ,(toolbar-external "xterm" "-e" "mutt")) | 161 (mutt . (toolbar-external "xterm" "-e" "mutt")) |
123 (exmh . ,(toolbar-external "exmh")) | 162 (exmh . (toolbar-external "exmh")) |
124 ;; How to turn on netscape mail, command-line?? | 163 ;; How to turn on netscape mail, command-line?? |
125 (netscape . ,(toolbar-external "netscape"))) | 164 (netscape . (toolbar-external "netscape"))) |
126 "Alist of mail readers and their commands. | 165 "*Alist of mail readers and their commands. |
127 The car of the alist is the mail reader, and the cdr is the form | 166 The car of each alist element is the mail reader, and the cdr is the form |
128 used to start it.") | 167 used to start it." |
129 | 168 :type '(repeat (cons (symbol :tag "Mailer") (function :tag "Start with"))) |
130 (defvar toolbar-mail-reader 'vm | 169 :group 'toolbar) |
170 | |
171 (defcustom toolbar-mail-reader 'vm | |
131 "*Mail reader toolbar will invoke. | 172 "*Mail reader toolbar will invoke. |
132 The legal values are `vm' and `gnus', but you can add your own values | 173 The legal values are the keys from `toolbar-mail-command-alist', which should |
133 by customizing `toolbar-mail-commands-alist'.") | 174 be used to add new mail readers. |
175 | |
176 Mail readers known by default are vm, gnus, rmail, mh, pine, elm, mutt, | |
177 exmh and netscape." | |
178 :type '(symbol :validate (lambda (wid) | |
179 (if (assq (widget-value wid) toolbar-mail-commands-alist) | |
180 nil | |
181 (widget-put wid :error "Unknown mail reader.") | |
182 wid))) | |
183 :group 'toolbar) | |
134 | 184 |
135 | 185 |
136 (defun toolbar-mail () | 186 (defun toolbar-mail () |
137 "Run mail in a separate frame." | 187 "Run mail in a separate frame." |
138 (interactive) | 188 (interactive) |
190 | 240 |
191 ;; | 241 ;; |
192 ;; toolbar news variables and defuns | 242 ;; toolbar news variables and defuns |
193 ;; | 243 ;; |
194 | 244 |
195 (defvar toolbar-news-commands-alist | 245 (defcustom toolbar-news-commands-alist |
196 `((gnus . gnus) ; M-x all-hail-gnus | 246 `((gnus . gnus) ; M-x all-hail-gnus |
197 (rn . ,(toolbar-external "xterm" "-e" "rn")) | 247 (rn . (toolbar-external "xterm" "-e" "rn")) |
198 (nn . ,(toolbar-external "xterm" "-e" "nn")) | 248 (nn . (toolbar-external "xterm" "-e" "nn")) |
199 (trn . ,(toolbar-external "xterm" "-e" "trn")) | 249 (trn . (toolbar-external "xterm" "-e" "trn")) |
200 (xrn . ,(toolbar-external "xrn")) | 250 (xrn . (toolbar-external "xrn")) |
201 (slrn . ,(toolbar-external "xterm" "-e" "slrn")) | 251 (slrn . (toolbar-external "xterm" "-e" "slrn")) |
202 (pine . ,(toolbar-external "xterm" "-e" "pine")) ; *gag* | 252 (pine . (toolbar-external "xterm" "-e" "pine")) ; *gag* |
203 (tin . ,(toolbar-external "xterm" "-e" "tin")) ; *gag* | 253 (tin . (toolbar-external "xterm" "-e" "tin")) ; *gag* |
204 (netscape . ,(toolbar-external "netscape" "news:"))) | 254 (netscape . (toolbar-external "netscape" "news:"))) |
205 "Alist of news readers and their commands. | 255 "*Alist of news readers and their commands. |
206 Each list element is a pair. The car of the pair is the mail | 256 The car of each alist element the pair is the news reader, and the cdr |
207 reader, and the cdr is the form used to start it.") | 257 is the form used to start it." |
208 | 258 :type '(repeat (cons (symbol :tag "Reader") (sexp :tag "Start with"))) |
209 (defvar toolbar-news-reader 'gnus | 259 :group 'toolbar) |
260 | |
261 (defcustom toolbar-news-reader 'gnus | |
210 "*News reader toolbar will invoke. | 262 "*News reader toolbar will invoke. |
211 The legal values are gnus, rn, nn, trn, xrn, slrn, pine and netscape. | 263 The legal values are the keys from `toolbar-news-command-alist', which should |
212 You can add your own values by customizing `toolbar-news-commands-alist'.") | 264 be used to add new news readers. |
213 | 265 |
214 (defvar toolbar-news-use-separate-frame t | 266 Newsreaders known by default are gnus, rn, nn, trn, xrn, slrn, pine and |
215 "*Whether Gnus is invoked in a separate frame.") | 267 netscape." |
268 :type '(symbol :validate (lambda (wid) | |
269 (if (assq (widget-value wid) toolbar-news-commands-alist) | |
270 nil | |
271 (widget-put wid :error "Unknown newsreader.") | |
272 wid))) | |
273 :group 'toolbar) | |
274 | |
275 (defcustom toolbar-news-use-separate-frame t | |
276 "*Whether Gnus is invoked in a separate frame." | |
277 :type 'boolean | |
278 :group 'toolbar) | |
216 | 279 |
217 (defvar toolbar-news-frame nil | 280 (defvar toolbar-news-frame nil |
218 "The frame in which news is displayed.") | 281 "The frame in which news is displayed.") |
219 | 282 |
220 (defvar toolbar-news-frame-properties nil | 283 (defvar toolbar-news-frame-properties nil |