comparison lisp/w3/w3-sysdp.el @ 2:ac2d302a0011 r19-15b2

Import from CVS: tag r19-15b2
author cvs
date Mon, 13 Aug 2007 08:46:35 +0200
parents 376386a54a3c
children 9ee227acff29
comparison
equal deleted inserted replaced
1:c0c6a60d29db 2:ac2d302a0011
146 146
147 (sysdep-defconst window-system nil) 147 (sysdep-defconst window-system nil)
148 (sysdep-defconst window-system-version 0) 148 (sysdep-defconst window-system-version 0)
149 149
150 (sysdep-defvar list-buffers-directory nil) 150 (sysdep-defvar list-buffers-directory nil)
151 (sysdep-defvar x-library-search-path '("/usr/X11R6/lib/X11/" 151 (sysdep-defvar x-library-search-path (`
152 ("/usr/X11R6/lib/X11/"
152 "/usr/X11R5/lib/X11/" 153 "/usr/X11R5/lib/X11/"
153 "/usr/lib/X11R6/X11/" 154 "/usr/lib/X11R6/X11/"
154 "/usr/lib/X11R5/X11/" 155 "/usr/lib/X11R5/X11/"
155 "/usr/local/X11R6/lib/X11/" 156 "/usr/local/X11R6/lib/X11/"
156 "/usr/local/X11R5/lib/X11/" 157 "/usr/local/X11R5/lib/X11/"
165 "/usr/unsupported/lib/X11/" 166 "/usr/unsupported/lib/X11/"
166 "/usr/athena/lib/X11/" 167 "/usr/athena/lib/X11/"
167 "/usr/local/x11r5/lib/X11/" 168 "/usr/local/x11r5/lib/X11/"
168 "/usr/lpp/Xamples/lib/X11/" 169 "/usr/lpp/Xamples/lib/X11/"
169 "/usr/openwin/lib/X11/" 170 "/usr/openwin/lib/X11/"
170 "/usr/openwin/share/lib/X11/") 171 "/usr/openwin/share/lib/X11/"
172 (, data-directory)
173 )
174 )
171 "Search path used for X11 libraries.") 175 "Search path used for X11 libraries.")
172 176
173 ;; frame-related stuff. 177 ;; frame-related stuff.
174 178
175 (sysdep-defalias 'buffer-dedicated-frame 'buffer-dedicated-screen) 179 (sysdep-defalias 'buffer-dedicated-frame 'buffer-dedicated-screen)
289 (if (and spec-list (cdr-safe (assq 'x spec-list))) 293 (if (and spec-list (cdr-safe (assq 'x spec-list)))
290 (make-pixmap (cdr-safe (assq 'x spec-list))))) 294 (make-pixmap (cdr-safe (assq 'x spec-list)))))
291 295
292 (sysdep-defalias 'face-list 'list-faces) 296 (sysdep-defalias 'face-list 'list-faces)
293 297
298 (sysdep-defun facep (face)
299 "Return t if X is a face name or an internal face vector."
300 ;; CAUTION!!! This is Emacs 19.x, for x <= 28, specific
301 ;; I know of no version of Lucid Emacs or XEmacs that did not have
302 ;; facep. Even if they did, they are unsupported, so big deal.
303 (and (or (internal-facep face)
304 (and (symbolp face) (assq face global-face-data)))
305 t))
306
294 (sysdep-defun set-face-property (face property value &optional locale 307 (sysdep-defun set-face-property (face property value &optional locale
295 tag-set how-to-add) 308 tag-set how-to-add)
296 "Change a property of FACE." 309 "Change a property of FACE."
297 (and (symbolp face) 310 (and (symbolp face)
298 (put face property value))) 311 (put face property value)))
299 312
300 (sysdep-defun face-property (face property &optional locale tag-set exact-p) 313 (sysdep-defun face-property (face property &optional locale tag-set exact-p)
301 "Return FACE's value of the given PROPERTY." 314 "Return FACE's value of the given PROPERTY."
302 (and (symbolp face) (get face property))) 315 (and (symbolp face) (get face property)))
303 316
317 ;; Property list functions
318 ;;
319 (sysdep-defun plist-put (plist prop val)
320 "Change value in PLIST of PROP to VAL.
321 PLIST is a property list, which is a list of the form
322 (PROP1 VALUE1 PROP2 VALUE2 ...). PROP is a symbol and VAL is any object.
323 If PROP is already a property on the list, its value is set to VAL,
324 otherwise the new PROP VAL pair is added. The new plist is returned;
325 use `(setq x (plist-put x prop val))' to be sure to use the new value.
326 The PLIST is modified by side effects."
327 (let ((node (memq prop plist)))
328 (if node
329 (setcar (cdr node) val)
330 (setq plist (cons prop (cons val plist))))
331 plist))
332
333 (sysdep-defun plist-get (plist prop)
334 "Extract a value from a property list.
335 PLIST is a property list, which is a list of the form
336 (PROP1 VALUE1 PROP2 VALUE2...). This function returns the value
337 corresponding to the given PROP, or nil if PROP is not
338 one of the properties on the list."
339 (car-safe (cdr-safe (memq prop plist))))
340
304 ;; Device functions 341 ;; Device functions
305 ;; By wmperry@spry.com 342 ;; By wmperry@cs.indiana.edu
306 ;; This is a complete implementation of all the device-* functions found in 343 ;; This is a complete implementation of all the device-* functions found in
307 ;; XEmacs 19.14. A 'device' for Emacs 19 is just a frame, from which we can 344 ;; XEmacs 19.14. A 'device' for Emacs 19 is just a frame, from which we can
308 ;; determine the connection to an X display, etc. 345 ;; determine the connection to an X display, etc.
309 346
310 (sysdep-defalias 'selected-device 'ignore) 347 (sysdep-defalias 'selected-device 'ignore)
454 (= (aref str y) ?.)) 491 (= (aref str y) ?.))
455 (aset str y ?-)) 492 (aset str y ?-))
456 (setq y (1+ y))) 493 (setq y (1+ y)))
457 str)) 494 str))
458 (t "stdio"))) 495 (t "stdio")))
459
460 496
461 (sysdep-defun device-connection (&optional device) 497 (sysdep-defun device-connection (&optional device)
462 "Return the connection of the specified device. 498 "Return the connection of the specified device.
463 DEVICE defaults to the selected device if omitted" 499 DEVICE defaults to the selected device if omitted"
464 (or (cdr-safe (assq 'display (frame-parameters device))) "stdio")) 500 (or (cdr-safe (assq 'display (frame-parameters device))) "stdio"))
553 'ns-display-planes) 589 'ns-display-planes)
554 (t 'ignore))) 590 (t 'ignore)))
555 591
556 (sysdep-defalias 'device-class 592 (sysdep-defalias 'device-class
557 (cond 593 (cond
594 ;; First, Xwindows
558 ((and (eq window-system 'x) (fboundp 'x-display-visual-class)) 595 ((and (eq window-system 'x) (fboundp 'x-display-visual-class))
559 (function 596 (function
560 (lambda (&optional device) 597 (lambda (&optional device)
561 (let ((val (symbol-name (x-display-visual-class device)))) 598 (let ((val (symbol-name (x-display-visual-class device))))
562 (cond 599 (cond
563 ((string-match "color" val) 'color) 600 ((string-match "color" val) 'color)
564 ((string-match "gray-scale" val) 'grayscale) 601 ((string-match "gray-scale" val) 'grayscale)
565 (t 'mono)))))) 602 (t 'mono))))))
603 ;; Now, Presentation-Manager under OS/2
604 ((and (eq window-system 'pm) (fboundp 'pm-display-visual-class))
605 (function
606 (lambda (&optional device)
607 (let ((val (symbol-name (pm-display-visual-class device))))
608 (cond
609 ((string-match "color" val) 'color)
610 ((string-match "gray-scale" val) 'grayscale)
611 (t 'mono))))))
612 ;; A slightly different way of doing it under OS/2
613 ((and (eq window-system 'pm) (fboundp 'pm-display-color-p))
614 (function
615 (lambda (&optional device)
616 (if (pm-display-color-p)
617 'color
618 'mono))))
566 ((fboundp 'number-of-colors) 619 ((fboundp 'number-of-colors)
567 (function 620 (function
568 (lambda (&optional device) 621 (lambda (&optional device)
569 (if (= 2 (number-of-colors)) 622 (if (= 2 (number-of-colors))
570 'mono 623 'mono
596 649
597 (sysdep-defun device-or-frame-type (device-or-frame) 650 (sysdep-defun device-or-frame-type (device-or-frame)
598 "Return the type (e.g. `x' or `tty') of DEVICE-OR-FRAME. 651 "Return the type (e.g. `x' or `tty') of DEVICE-OR-FRAME.
599 DEVICE-OR-FRAME should be a device or a frame object. See `device-type' 652 DEVICE-OR-FRAME should be a device or a frame object. See `device-type'
600 for a description of the possible types." 653 for a description of the possible types."
601 (if (cdr-safe (assq 'display (frame-parameters device-or-frame))) 654 (if (or (cdr-safe (assq 'display (frame-parameters device-or-frame)))
655 (cdr-safe (assq 'window-id (frame-parameters device-or-frame))))
602 window-system 656 window-system
603 'tty)) 657 'tty))
604 658
605 (sysdep-defun device-type (&optional device) 659 (sysdep-defun device-type (&optional device)
606 "Return the type of the specified device (e.g. `x' or `tty'). 660 "Return the type of the specified device (e.g. `x' or `tty').
626 ;; Extent stuff 680 ;; Extent stuff
627 (sysdep-fset 'delete-extent 'delete-overlay) 681 (sysdep-fset 'delete-extent 'delete-overlay)
628 (sysdep-fset 'extent-end-position 'overlay-end) 682 (sysdep-fset 'extent-end-position 'overlay-end)
629 (sysdep-fset 'extent-start-position 'overlay-start) 683 (sysdep-fset 'extent-start-position 'overlay-start)
630 (sysdep-fset 'set-extent-endpoints 'move-overlay) 684 (sysdep-fset 'set-extent-endpoints 'move-overlay)
685 (sysdep-fset 'set-extent-property 'overlay-put)
686 (sysdep-fset 'make-extent 'make-overlay)
631 687
632 (sysdep-defun extent-property (extent property &optional default) 688 (sysdep-defun extent-property (extent property &optional default)
633 (or (overlay-get extent property) default)) 689 (or (overlay-get extent property) default))
634 690
635 (sysdep-defun extent-at (pos &optional object property before at-flag) 691 (sysdep-defun extent-at (pos &optional object property before at-flag)
646 (sort ovls 702 (sort ovls
647 (function 703 (function
648 (lambda (a b) 704 (lambda (a b)
649 (< (- (extent-end-position a) (extent-start-position a)) 705 (< (- (extent-end-position a) (extent-start-position a))
650 (- (extent-end-position b) (extent-start-position b))))))))) 706 (- (extent-end-position b) (extent-start-position b)))))))))
651
652 707
653 (sysdep-defun overlays-in (beg end) 708 (sysdep-defun overlays-in (beg end)
654 "Return a list of the overlays that overlap the region BEG ... END. 709 "Return a list of the overlays that overlap the region BEG ... END.
655 Overlap means that at least one character is contained within the overlay 710 Overlap means that at least one character is contained within the overlay
656 and also contained within the specified region. 711 and also contained within the specified region.
691 ovls (cdr ovls)) 746 ovls (cdr ovls))
692 (if tmp 747 (if tmp
693 (throw 'done tmp)))))) 748 (throw 'done tmp))))))
694 749
695 ;; misc 750 ;; misc
751 (sysdep-fset 'make-local-hook 'make-local-variable)
752
753 (sysdep-defun buffer-substring-no-properties (beg end)
754 "Return the text from BEG to END, without text properties, as a string."
755 (format "%s" (buffer-substring beg end)))
756
696 (sysdep-defun symbol-value-in-buffer (symbol buffer &optional unbound-value) 757 (sysdep-defun symbol-value-in-buffer (symbol buffer &optional unbound-value)
697 "Return the value of SYMBOL in BUFFER, or UNBOUND-VALUE if it is unbound." 758 "Return the value of SYMBOL in BUFFER, or UNBOUND-VALUE if it is unbound."
698 (save-excursion 759 (save-excursion
699 (set-buffer buffer) 760 (set-buffer buffer)
700 (if (not (boundp symbol)) 761 (if (not (boundp symbol))
793 ((fboundp 'x-valid-color-name-p) ; XEmacs/Lucid 854 ((fboundp 'x-valid-color-name-p) ; XEmacs/Lucid
794 'x-valid-color-name-p) 855 'x-valid-color-name-p)
795 ((and window-system 856 ((and window-system
796 (fboundp 'color-defined-p)) ; NS/Emacs 19 857 (fboundp 'color-defined-p)) ; NS/Emacs 19
797 'color-defined-p) 858 'color-defined-p)
859 ((and window-system
860 (fboundp 'pm-color-defined-p))
861 'pm-color-defined-p)
798 ((and window-system 862 ((and window-system
799 (fboundp 'x-color-defined-p)) ; Emacs 19 863 (fboundp 'x-color-defined-p)) ; Emacs 19
800 'x-color-defined-p) 864 'x-color-defined-p)
801 ((fboundp 'get-color) ; Epoch 865 ((fboundp 'get-color) ; Epoch
802 (function (lambda (color) 866 (function (lambda (color)
880 error-object stream)) 944 error-object stream))
881 945
882 (sysdep-defun find-face (face) 946 (sysdep-defun find-face (face)
883 (car-safe (memq face (face-list)))) 947 (car-safe (memq face (face-list))))
884 948
949 (sysdep-defun set-marker-insertion-type (marker type)
950 "Set the insertion-type of MARKER to TYPE.
951 If TYPE is t, it means the marker advances when you insert text at it.
952 If TYPE is nil, it means the marker stays behind when you insert text at it."
953 nil)
954
885 ;; window functions 955 ;; window functions
886 956
887 ;; not defined in v18 957 ;; not defined in v18
888 (sysdep-defun eval-buffer (bufname &optional printflag) 958 (sysdep-defun eval-buffer (bufname &optional printflag)
889 (save-excursion 959 (save-excursion
892 962
893 (sysdep-defun window-minibuffer-p (window) 963 (sysdep-defun window-minibuffer-p (window)
894 "Returns non-nil if WINDOW is a minibuffer window." 964 "Returns non-nil if WINDOW is a minibuffer window."
895 (eq window (minibuffer-window))) 965 (eq window (minibuffer-window)))
896 966
897 ;; not defined in v18
898 (sysdep-defun window-live-p (window) 967 (sysdep-defun window-live-p (window)
899 "Returns t if OBJ is a window which is currently visible." 968 "Returns t if OBJ is a window which is currently visible."
900 (and (windowp window) 969 (and (windowp window)
901 (window-point window))) 970 (window-point window)))
902 971