comparison lisp/x11/x-toolbar.el @ 22:8fc7fe29b841 r19-15b94

Import from CVS: tag r19-15b94
author cvs
date Mon, 13 Aug 2007 08:50:29 +0200
parents 0293115a14e9
children 131b0175ea99
comparison
equal deleted inserted replaced
21:b88636d63495 22:8fc7fe29b841
22 ;; 22 ;;
23 ;; Miscellaneous toolbar functions, useful for users to redefine, in 23 ;; Miscellaneous toolbar functions, useful for users to redefine, in
24 ;; order to get different behaviour. 24 ;; order to get different behaviour.
25 ;; 25 ;;
26 26
27 (defvar toolbar-open-function 'find-file
28 "*Function to call when the open icon is selected.")
29
27 (defun toolbar-open () 30 (defun toolbar-open ()
28 (interactive) 31 (interactive)
29 (call-interactively 'find-file)) 32 (call-interactively toolbar-open-function))
33
34 (defvar toolbar-dired-function 'dired
35 "*Function to call when the dired icon is selected.")
30 36
31 (defun toolbar-dired () 37 (defun toolbar-dired ()
32 (interactive) 38 (interactive)
33 (call-interactively 'dired)) 39 (call-interactively toolbar-dired-function))
40
41 (defvar toolbar-save-function 'save-buffer
42 "*Function to call when the save icon is selected.")
34 43
35 (defun toolbar-save () 44 (defun toolbar-save ()
36 (interactive) 45 (interactive)
37 (call-interactively 'save-buffer)) 46 (call-interactively toolbar-save-function))
47
48 (defvar toolbar-print-function 'lpr-buffer
49 "*Function to call when the print icon is selected.")
38 50
39 (defun toolbar-print () 51 (defun toolbar-print ()
40 (interactive) 52 (interactive)
41 (call-interactively 'lpr-buffer)) 53 (call-interactively toolbar-print-function))
54
55 (defvar toolbar-cut-function 'x-kill-primary-selection
56 "*Function to call when the cut icon is selected.")
42 57
43 (defun toolbar-cut () 58 (defun toolbar-cut ()
44 (interactive) 59 (interactive)
45 (call-interactively 'x-kill-primary-selection)) 60 (call-interactively toolbar-cut-function))
61
62 (defvar toolbar-copy-function 'x-copy-primary-selection
63 "*Function to call when the copy icon is selected.")
46 64
47 (defun toolbar-copy () 65 (defun toolbar-copy ()
48 (interactive) 66 (interactive)
49 (call-interactively 'x-copy-primary-selection)) 67 (call-interactively toolbar-copy-function))
68
69 (defvar toolbar-paste-function 'x-yank-clipboard-selection
70 "*Function to call when the paste icon is selected.")
50 71
51 (defun toolbar-paste () 72 (defun toolbar-paste ()
52 (interactive) 73 (interactive)
53 (call-interactively 'x-yank-clipboard-selection)) 74 (call-interactively toolbar-paste-function))
75
76 (defvar toolbar-undo-function 'undo
77 "*Function to call when the undo icon is selected.")
54 78
55 (defun toolbar-undo () 79 (defun toolbar-undo ()
56 (interactive) 80 (interactive)
57 (call-interactively 'undo)) 81 (call-interactively toolbar-undo-function))
82
83 (defvar toolbar-replace-function 'query-replace
84 "*Function to call when the replace icon is selected.")
58 85
59 (defun toolbar-replace () 86 (defun toolbar-replace ()
60 (interactive) 87 (interactive)
61 (call-interactively 'query-replace)) 88 (call-interactively toolbar-replace-function))
62 89
63 ;; 90 ;;
64 ;; toolbar ispell variables and defuns 91 ;; toolbar ispell variables and defuns
65 ;; 92 ;;
93
94 (defvar toolbar-ispell-function
95 (lambda ()
96 (interactive)
97 (if (region-active-p)
98 (ispell-region (region-beginning) (region-end))
99 (ispell-buffer)))
100 "*Function to call when the ispell icon is selected.")
66 101
67 (defun toolbar-ispell () 102 (defun toolbar-ispell ()
68 "Intelligently spell the region or buffer." 103 "Intelligently spell the region or buffer."
69 (interactive) 104 (interactive)
70 (if (region-active-p) 105 (call-interactively toolbar-ispell-function))
71 (ispell-region (region-beginning) (region-end))
72 (ispell-buffer)))
73 106
74 ;; 107 ;;
75 ;; toolbar mail variables and defuns 108 ;; toolbar mail variables and defuns
76 ;; 109 ;;
77 110
92 "Alist of mail readers and their commands. 125 "Alist of mail readers and their commands.
93 The car of the alist is the mail reader, and the cdr is the form 126 The car of the alist is the mail reader, and the cdr is the form
94 used to start it.") 127 used to start it.")
95 128
96 (defvar toolbar-mail-reader 'vm 129 (defvar toolbar-mail-reader 'vm
97 "Mail reader toolbar will invoke. 130 "*Mail reader toolbar will invoke.
98 The legal values are `vm' and `gnus', but you can add your own values 131 The legal values are `vm' and `gnus', but you can add your own values
99 by customizing `toolbar-mail-commands-alist'.") 132 by customizing `toolbar-mail-commands-alist'.")
100 133
101 134
102 (defun toolbar-mail () 135 (defun toolbar-mail ()
159 ["Cancel" (message "Quit") t])))) 192 ["Cancel" (message "Quit") t]))))
160 193
161 ;; 194 ;;
162 ;; toolbar news variables and defuns 195 ;; toolbar news variables and defuns
163 ;; 196 ;;
197
198 (defvar toolbar-news-commands-alist
199 `((gnus . gnus) ; M-x all-hail-gnus
200 (rn . ,(toolbar-external "xterm" "-e" "rn"))
201 (nn . ,(toolbar-external "xterm" "-e" "nn"))
202 (trn . ,(toolbar-external "xterm" "-e" "trn"))
203 (xrn . ,(toolbar-external "xrn"))
204 (slrn . ,(toolbar-external "xterm" "-e" "slrn"))
205 (pine . ,(toolbar-external "xterm" "-e" "pine")) ; *gag*
206 (tin . ,(toolbar-external "xterm" "-e" "tin")) ; *gag*
207 (netscape . ,(toolbar-external "netscape" "news:")))
208 "Alist of news readers and their commands.
209 Each list element is a pair. The car of the pair is the mail
210 reader, and the cdr is the form used to start it.")
211
212 (defvar toolbar-news-reader 'gnus
213 "*News reader toolbar will invoke.
214 The legal values are gnus, rn, nn, trn, xrn, slrn, pine and netscape.
215 You can add your own values by customizing `toolbar-news-commands-alist'.")
216
217 (defvar toolbar-news-use-separate-frame t
218 "*Whether Gnus is invoked in a separate frame.")
164 219
165 (defvar toolbar-news-frame nil 220 (defvar toolbar-news-frame nil
166 "The frame in which news is displayed.") 221 "The frame in which news is displayed.")
167 222
168 (defvar toolbar-news-frame-properties nil 223 (defvar toolbar-news-frame-properties nil
185 (gnus)) 240 (gnus))
186 (if (frame-iconified-p toolbar-news-frame) 241 (if (frame-iconified-p toolbar-news-frame)
187 (deiconify-frame toolbar-news-frame)) 242 (deiconify-frame toolbar-news-frame))
188 (select-frame toolbar-news-frame) 243 (select-frame toolbar-news-frame)
189 (raise-frame toolbar-news-frame)) 244 (raise-frame toolbar-news-frame))
190
191 ;;
192 ;; toolbar printing variable and defun
193 ;;
194 (defvar toolbar-print-command 'lpr-buffer
195 "Command to run when the Print Icon is selected from the toolbar.
196 Set this to `ps-print-buffer-with-faces' if you primarily print with
197 a postscript printer.")
198
199 (defun toolbar-print ()
200 "Print current buffer."
201 (funcall toolbar-print-command))
202
203 ;;
204 ;; toolbar replacement variable and defun
205 ;;
206 (defvar toolbar-replace-command 'query-replace
207 "Command to run when the Replace Icon is selected from the toolbar.
208 One possibility for a different value would be `query-replace-regexp'.")
209
210 (defun toolbar-replace ()
211 "Run a query-replace -type function on the current buffer."
212 (funcall toolbar-replace-command))
213 245
214 (defvar toolbar-last-win-icon nil "A `last-win' icon set.") 246 (defvar toolbar-last-win-icon nil "A `last-win' icon set.")
215 (defvar toolbar-next-win-icon nil "A `next-win' icon set.") 247 (defvar toolbar-next-win-icon nil "A `next-win' icon set.")
216 (defvar toolbar-file-icon nil "A `file' icon set.") 248 (defvar toolbar-file-icon nil "A `file' icon set.")
217 (defvar toolbar-folder-icon nil "A `folder' icon set") 249 (defvar toolbar-folder-icon nil "A `folder' icon set")
325 left-toolbar-width 'natnum locale 357 left-toolbar-width 'natnum locale
326 '("leftToolBarWidth" . "LeftToolBarWidth")) 358 '("leftToolBarWidth" . "LeftToolBarWidth"))
327 (x-init-specifier-from-resources 359 (x-init-specifier-from-resources
328 right-toolbar-width 'natnum locale 360 right-toolbar-width 'natnum locale
329 '("rightToolBarWidth" . "RightToolBarWidth"))) 361 '("rightToolBarWidth" . "RightToolBarWidth")))
362
363 ;;; x-toolbar.el ends here