comparison lisp/x11/x-toolbar.el @ 88:821dec489c24 r20-0

Import from CVS: tag r20-0
author cvs
date Mon, 13 Aug 2007 09:09:59 +0200
parents 1ce6082ce73f
children 0d2f883870bc
comparison
equal deleted inserted replaced
87:7df2982f5c17 88:821dec489c24
19 ;; along with XEmacs; see the file COPYING. If not, write to the 19 ;; along with XEmacs; see the file COPYING. If not, write to the
20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 20 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 ;; Boston, MA 02111-1307, USA. 21 ;; Boston, MA 02111-1307, USA.
22 22
23 ;; 23 ;;
24 ;; Miscellaneous toolbar functions, useful for users to redefine, in
25 ;; order to get different behaviour.
26 ;;
27
28 (defun toolbar-open ()
29 (interactive)
30 (call-interactively 'find-file))
31
32 (defun toolbar-dired ()
33 (interactive)
34 (call-interactively 'dired))
35
36 (defun toolbar-save ()
37 (interactive)
38 (call-interactively 'save-buffer))
39
40 (defun toolbar-print ()
41 (interactive)
42 (call-interactively 'lpr-buffer))
43
44 (defun toolbar-cut ()
45 (interactive)
46 (call-interactively 'x-kill-primary-selection))
47
48 (defun toolbar-copy ()
49 (interactive)
50 (call-interactively 'x-copy-primary-selection))
51
52 (defun toolbar-paste ()
53 (interactive)
54 (call-interactively 'x-yank-clipboard-selection))
55
56 (defun toolbar-undo ()
57 (interactive)
58 (call-interactively 'undo))
59
60 (defun toolbar-replace ()
61 (interactive)
62 (call-interactively 'query-replace))
63
64 ;;
24 ;; toolbar ispell variables and defuns 65 ;; toolbar ispell variables and defuns
25 ;; 66 ;;
26 67
27 (defun toolbar-ispell () 68 (defun toolbar-ispell ()
28 "Intelligently spell the region or buffer." 69 "Intelligently spell the region or buffer."
33 74
34 ;; 75 ;;
35 ;; toolbar mail variables and defuns 76 ;; toolbar mail variables and defuns
36 ;; 77 ;;
37 78
38 (defvar toolbar-use-separate-mail-frame nil 79 (defmacro toolbar-external (process &rest args)
39 "If non-nil run mail in a separate frame.") 80 `(lambda () (interactive) (call-process ,process nil 0 nil ,@args)))
40 81
41 (defvar toolbar-mail-frame nil 82 (defvar toolbar-mail-commands-alist
42 "The frame in which mail is displayed.") 83 `((vm . vm)
43 84 (gnus . gnus-no-server)
44 (defvar toolbar-mail-command 'vm 85 (rmail . rmail)
45 "The mail reader to run.") 86 (mh . mh-rmail)
87 (pine . ,(toolbar-external "xterm" "-e" "pine")) ; *gag*
88 (elm . ,(toolbar-external "xterm" "-e" "elm"))
89 (mutt . ,(toolbar-external "xterm" "-e" "mutt"))
90 (exmh . ,(toolbar-external "exmh"))
91 ;; How to turn on netscape mail, command-line??
92 (netscape . ,(toolbar-external "netscape")))
93 "Alist of mail readers and their commands.
94 The car of the alist is the mail reader, and the cdr is the form
95 used to start it.")
96
97 (defvar toolbar-mail-reader 'vm
98 "Mail reader toolbar will invoke.
99 The legal values are `vm' and `gnus', but you can add your own values
100 by customizing `toolbar-mail-commands-alist'.")
101
46 102
47 (defun toolbar-mail () 103 (defun toolbar-mail ()
48 "Run mail in a separate frame." 104 "Run mail in a separate frame."
49 (interactive) 105 (interactive)
50 (if (not toolbar-use-separate-mail-frame) 106 (let ((command (assq toolbar-mail-reader toolbar-mail-commands-alist)))
51 (funcall toolbar-mail-command) 107 (if (not command)
52 (if (or (not toolbar-mail-frame) 108 (error "Uknown mail reader %s" toolbar-mail-reader))
53 (not (frame-live-p toolbar-mail-frame))) 109 (funcall (cdr command))))
54 (progn
55 (setq toolbar-mail-frame (make-frame))
56 (add-hook 'vm-quit-hook
57 (lambda ()
58 (save-excursion
59 (if (frame-live-p toolbar-mail-frame)
60 (delete-frame toolbar-mail-frame)))))
61 (select-frame toolbar-mail-frame)
62 (raise-frame toolbar-mail-frame)
63 (funcall toolbar-mail-command)))
64 (if (frame-iconified-p toolbar-mail-frame)
65 (deiconify-frame toolbar-mail-frame))
66 (select-frame toolbar-mail-frame)
67 (raise-frame toolbar-mail-frame)))
68 110
69 ;; 111 ;;
70 ;; toolbar info variables and defuns 112 ;; toolbar info variables and defuns
71 ;; 113 ;;
72 114
219 ;;[toolbar-next-win-icon unpop-window-configuration 261 ;;[toolbar-next-win-icon unpop-window-configuration
220 ;;(frame-property (selected-frame) 262 ;;(frame-property (selected-frame)
221 ;; 'window-config-unpop-stack) t "Undo \"Most recent window config\""] 263 ;; 'window-config-unpop-stack) t "Undo \"Most recent window config\""]
222 ;; #### Illicit knowledge? 264 ;; #### Illicit knowledge?
223 265
224 [toolbar-file-icon find-file t "Open a file" ] 266 [toolbar-file-icon toolbar-open t "Open a file" ]
225 [toolbar-folder-icon dired t "View directory"] 267 [toolbar-folder-icon toolbar-dired t "View directory"]
226 [toolbar-disk-icon save-buffer t "Save buffer" ] 268 [toolbar-disk-icon toolbar-save t "Save buffer" ]
227 [toolbar-printer-icon lpr-buffer t "Print buffer" ] 269 [toolbar-printer-icon toolbar-print t "Print buffer" ]
228 [toolbar-cut-icon x-kill-primary-selection t "Kill region"] 270 [toolbar-cut-icon toolbar-cut t "Kill region"]
229 [toolbar-copy-icon x-copy-primary-selection t "Copy region"] 271 [toolbar-copy-icon toolbar-copy t "Copy region"]
230 [toolbar-paste-icon x-yank-clipboard-selection t 272 [toolbar-paste-icon toolbar-paste t "Paste from clipboard"]
231 "Paste from clipboard"] 273 [toolbar-undo-icon toolbar-undo t "Undo edit" ]
232 [toolbar-undo-icon undo t "Undo edit" ]
233 [toolbar-spell-icon toolbar-ispell t "Spellcheck" ] 274 [toolbar-spell-icon toolbar-ispell t "Spellcheck" ]
234 [toolbar-replace-icon query-replace t "Replace text" ] 275 [toolbar-replace-icon toolbar-replace t "Replace text" ]
235 [toolbar-mail-icon toolbar-mail t "Mail" ] 276 [toolbar-mail-icon toolbar-mail t "Mail" ]
236 [toolbar-info-icon toolbar-info t "Information" ] 277 [toolbar-info-icon toolbar-info t "Information" ]
237 [toolbar-compile-icon toolbar-compile t "Compile" ] 278 [toolbar-compile-icon toolbar-compile t "Compile" ]
238 [toolbar-debug-icon toolbar-debug t "Debug" ] 279 [toolbar-debug-icon toolbar-debug t "Debug" ]
239 [toolbar-news-icon toolbar-news t "News" ]) 280 [toolbar-news-icon toolbar-news t "News" ])