Mercurial > hg > xemacs-beta
comparison lisp/x11/x-toolbar.el @ 16:0293115a14e9 r19-15b91
Import from CVS: tag r19-15b91
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:49:20 +0200 |
parents | 9ee227acff29 |
children | 8fc7fe29b841 |
comparison
equal
deleted
inserted
replaced
15:ad457d5f7d04 | 16:0293115a14e9 |
---|---|
18 ;; You should have received a copy of the GNU General Public License | 18 ;; You should have received a copy of the GNU General Public License |
19 ;; along with XEmacs; see the file COPYING. If not, write to the Free | 19 ;; along with XEmacs; see the file COPYING. If not, write to the Free |
20 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | 20 ;; Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | 21 |
22 ;; | 22 ;; |
23 ;; Miscellaneous toolbar functions, useful for users to redefine, in | |
24 ;; order to get different behaviour. | |
25 ;; | |
26 | |
27 (defun toolbar-open () | |
28 (interactive) | |
29 (call-interactively 'find-file)) | |
30 | |
31 (defun toolbar-dired () | |
32 (interactive) | |
33 (call-interactively 'dired)) | |
34 | |
35 (defun toolbar-save () | |
36 (interactive) | |
37 (call-interactively 'save-buffer)) | |
38 | |
39 (defun toolbar-print () | |
40 (interactive) | |
41 (call-interactively 'lpr-buffer)) | |
42 | |
43 (defun toolbar-cut () | |
44 (interactive) | |
45 (call-interactively 'x-kill-primary-selection)) | |
46 | |
47 (defun toolbar-copy () | |
48 (interactive) | |
49 (call-interactively 'x-copy-primary-selection)) | |
50 | |
51 (defun toolbar-paste () | |
52 (interactive) | |
53 (call-interactively 'x-yank-clipboard-selection)) | |
54 | |
55 (defun toolbar-undo () | |
56 (interactive) | |
57 (call-interactively 'undo)) | |
58 | |
59 (defun toolbar-replace () | |
60 (interactive) | |
61 (call-interactively 'query-replace)) | |
62 | |
63 ;; | |
23 ;; toolbar ispell variables and defuns | 64 ;; toolbar ispell variables and defuns |
24 ;; | 65 ;; |
25 | 66 |
26 (defun toolbar-ispell () | 67 (defun toolbar-ispell () |
27 "Intelligently spell the region or buffer." | 68 "Intelligently spell the region or buffer." |
32 | 73 |
33 ;; | 74 ;; |
34 ;; toolbar mail variables and defuns | 75 ;; toolbar mail variables and defuns |
35 ;; | 76 ;; |
36 | 77 |
37 (defvar toolbar-use-separate-mail-frame nil | 78 (defmacro toolbar-external (process &rest args) |
38 "If non-nil run mail in a separate frame.") | 79 `(lambda () (interactive) (call-process ,process nil 0 nil ,@args))) |
39 | 80 |
40 (defvar toolbar-mail-frame nil | 81 (defvar toolbar-mail-commands-alist |
41 "The frame in which mail is displayed.") | 82 `((vm . vm) |
42 | 83 (gnus . gnus-no-server) |
43 (defvar toolbar-mail-command 'vm | 84 (rmail . rmail) |
44 "The mail reader to run.") | 85 (mh . mh-rmail) |
86 (pine . ,(toolbar-external "xterm" "-e" "pine")) ; *gag* | |
87 (elm . ,(toolbar-external "xterm" "-e" "elm")) | |
88 (mutt . ,(toolbar-external "xterm" "-e" "mutt")) | |
89 (exmh . ,(toolbar-external "exmh")) | |
90 ;; How to turn on netscape mail, command-line?? | |
91 (netscape . ,(toolbar-external "netscape"))) | |
92 "Alist of mail readers and their commands. | |
93 The car of the alist is the mail reader, and the cdr is the form | |
94 used to start it.") | |
95 | |
96 (defvar toolbar-mail-reader 'vm | |
97 "Mail reader toolbar will invoke. | |
98 The legal values are `vm' and `gnus', but you can add your own values | |
99 by customizing `toolbar-mail-commands-alist'.") | |
100 | |
45 | 101 |
46 (defun toolbar-mail () | 102 (defun toolbar-mail () |
47 "Run mail in a separate frame." | 103 "Run mail in a separate frame." |
48 (interactive) | 104 (interactive) |
49 (if (not toolbar-use-separate-mail-frame) | 105 (let ((command (assq toolbar-mail-reader toolbar-mail-commands-alist))) |
50 (funcall toolbar-mail-command) | 106 (if (not command) |
51 (if (or (not toolbar-mail-frame) | 107 (error "Uknown mail reader %s" toolbar-mail-reader)) |
52 (not (frame-live-p toolbar-mail-frame))) | 108 (funcall (cdr command)))) |
53 (progn | |
54 (setq toolbar-mail-frame (make-frame)) | |
55 (add-hook 'vm-quit-hook | |
56 (lambda () | |
57 (save-excursion | |
58 (if (frame-live-p toolbar-mail-frame) | |
59 (delete-frame toolbar-mail-frame))))) | |
60 (select-frame toolbar-mail-frame) | |
61 (raise-frame toolbar-mail-frame) | |
62 (funcall toolbar-mail-command))) | |
63 (if (frame-iconified-p toolbar-mail-frame) | |
64 (deiconify-frame toolbar-mail-frame)) | |
65 (select-frame toolbar-mail-frame) | |
66 (raise-frame toolbar-mail-frame))) | |
67 | 109 |
68 ;; | 110 ;; |
69 ;; toolbar info variables and defuns | 111 ;; toolbar info variables and defuns |
70 ;; | 112 ;; |
71 | 113 |
252 ;;; #### illicit knowledge? | 294 ;;; #### illicit knowledge? |
253 ;(frame-property (selected-frame) | 295 ;(frame-property (selected-frame) |
254 ; 'window-config-unpop-stack) | 296 ; 'window-config-unpop-stack) |
255 ; t | 297 ; t |
256 ; "Undo \"Most recent window config\""] | 298 ; "Undo \"Most recent window config\""] |
257 [toolbar-file-icon find-file t "Open a file" ] | 299 [toolbar-file-icon toolbar-open t "Open a file" ] |
258 [toolbar-folder-icon dired t "View directory"] | 300 [toolbar-folder-icon toolbar-dired t "View directory"] |
259 [toolbar-disk-icon save-buffer t "Save buffer" ] | 301 [toolbar-disk-icon toolbar-save t "Save buffer" ] |
260 [toolbar-printer-icon toolbar-print t "Print buffer" ] | 302 [toolbar-printer-icon toolbar-print t "Print buffer" ] |
261 [toolbar-cut-icon x-kill-primary-selection t "Kill region"] | 303 [toolbar-cut-icon toolbar-cut t "Kill region"] |
262 [toolbar-copy-icon x-copy-primary-selection t "Copy region"] | 304 [toolbar-copy-icon toolbar-copy t "Copy region"] |
263 [toolbar-paste-icon x-yank-clipboard-selection t | 305 [toolbar-paste-icon toolbar-paste t "Paste from clipboard"] |
264 "Paste from clipboard"] | 306 [toolbar-undo-icon toolbar-undo t "Undo edit" ] |
265 [toolbar-undo-icon undo t "Undo edit" ] | |
266 [toolbar-spell-icon toolbar-ispell t "Spellcheck" ] | 307 [toolbar-spell-icon toolbar-ispell t "Spellcheck" ] |
267 [toolbar-replace-icon toolbar-replace t "Replace text" ] | 308 [toolbar-replace-icon toolbar-replace t "Replace text" ] |
268 [toolbar-mail-icon toolbar-mail t "Mail" ] | 309 [toolbar-mail-icon toolbar-mail t "Mail" ] |
269 [toolbar-info-icon toolbar-info t "Information" ] | 310 [toolbar-info-icon toolbar-info t "Information" ] |
270 [toolbar-compile-icon toolbar-compile t "Compile" ] | 311 [toolbar-compile-icon toolbar-compile t "Compile" ] |