Mercurial > hg > xemacs-beta
comparison lisp/device.el @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | 74fd4e045ea6 |
children |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
29 | 29 |
30 ;; This file is dumped with XEmacs. | 30 ;; This file is dumped with XEmacs. |
31 | 31 |
32 ;;; Code: | 32 ;;; Code: |
33 | 33 |
34 ;;; Initialization | |
35 | |
36 ; Specifier tag 'printer which matches printers | |
37 (define-specifier-tag 'printer (function device-printer-p)) | |
38 | |
39 ; Specifier tag 'display which matches displays | |
40 (define-specifier-tag 'display (function | |
41 (lambda (device) | |
42 (not (device-printer-p device))))) | |
43 | |
44 ;;; Functions | |
45 | |
46 (defun device-list () | 34 (defun device-list () |
47 "Return a list of all devices." | 35 "Return a list of all devices." |
48 (apply 'nconc (mapcar 'console-device-list (console-list)))) | 36 (apply 'nconc (mapcar 'console-device-list (console-list)))) |
49 | 37 |
50 (defun device-type (&optional device) | 38 (defun device-type (&optional device) |
51 "Return the type of the specified device (e.g. `x' or `tty'). | 39 "Return the type of the specified device (e.g. `x' or `tty'). |
52 This is equivalent to the type of the device's console. | 40 This is equivalent to the type of the device's console. |
53 Value is `tty' for a tty device (a character-only terminal), | 41 Value is `tty' for a tty device (a character-only terminal), |
54 `x' for a device that is a screen on an X display, | 42 `x' for a device that is a screen on an X display, |
55 `ns' for a device that is a NeXTstep connection (not yet implemented), | 43 `ns' for a device that is a NeXTstep connection (not yet implemented), |
56 `mswindows' for a device that is a MS Windows workstation, | 44 `mswindows' for a device that is a Windows or Windows NT connection, |
57 `msprinter' for a device that is a MS Windows printer connection, | 45 `pc' for a device that is a direct-write MS-DOS screen (not yet implemented), |
58 `stream' for a stream device (which acts like a stdio stream), and | 46 `stream' for a stream device (which acts like a stdio stream), and |
59 `dead' for a deleted device." | 47 `dead' for a deleted device." |
60 (or device (setq device (selected-device))) | 48 (or device (setq device (selected-device))) |
61 (if (not (device-live-p device)) 'dead | 49 (if (not (device-live-p device)) 'dead |
62 (console-type (device-console device)))) | 50 (console-type (device-console device)))) |
118 (or device (setq device (selected-device))) | 106 (or device (setq device (selected-device))) |
119 (console-on-window-system-p (device-console device))) | 107 (console-on-window-system-p (device-console device))) |
120 | 108 |
121 (defun call-device-method (name device &rest args) | 109 (defun call-device-method (name device &rest args) |
122 "Call a DEVICE-specific function with the generic name NAME. | 110 "Call a DEVICE-specific function with the generic name NAME. |
123 If DEVICE is not provided then the selected device is used." | 111 If DEVICE is not provide the selected device is used." |
124 (or device (setq device (selected-device))) | 112 (or device (setq device (selected-device))) |
125 (or (symbolp name) (error "function name must be a symbol")) | 113 (or (symbolp name) (error "function name must be a symbol")) |
126 (let ((devmeth (intern (concat (symbol-name | 114 (let ((devmeth (intern (concat (symbol-name |
127 (device-type device)) "-" (symbol-name name))))) | 115 (device-type device)) "-" (symbol-name name))))) |
128 (if (functionp devmeth) | 116 (if (functionp devmeth) |