- (t ; emacs
- (defun ps-color-device ()
- t)
- ))
-
- (defun ps-mapper (extent list)
- (nconc list
- (list (list (ps-x-extent-start-position extent) 'push extent)
- (list (ps-x-extent-end-position extent) 'pull extent)))
- nil)
-
- (defun ps-extent-sorter (a b)
- (< (ps-x-extent-priority a) (ps-x-extent-priority b)))
-
- (defun ps-xemacs-face-kind-p (face kind kind-regex)
- (let* ((frame-font (or (ps-x-face-font-instance face)
- (ps-x-face-font-instance 'default)))
- (kind-cons
- (and frame-font
- (assq kind
- (ps-x-font-instance-properties frame-font))))
- (kind-spec (cdr-safe kind-cons))
- (case-fold-search t))
- (and kind-spec (string-match kind-regex kind-spec))))
-
- (defun ps-xemacs-color-name (color)
- (if (ps-x-color-specifier-p color)
- (ps-x-color-name color)
- color))
-
- (cond ((eq ps-print-emacs-type 'emacs) ; emacs
-
- (defun ps-color-values (x-color)
- (if (fboundp 'x-color-values)
- (x-color-values x-color)
- (error "No available function to determine X color values.")))
-
- (defalias 'ps-face-foreground-name 'face-foreground)
- (defalias 'ps-face-background-name 'face-background)
-
- (defun ps-face-bold-p (face)
- (or (face-bold-p face)
- (memq face ps-bold-faces)))
-
- (defun ps-face-italic-p (face)
- (or (face-italic-p face)
- (memq face ps-italic-faces)))
- )
- ; xemacs
- ; lucid
- (t ; epoch
-
- (or (ps-x-find-coding-system 'raw-text-unix)
- (ps-x-copy-coding-system 'no-conversion-unix 'raw-text-unix))
-
- (defun ps-color-values (x-color)
- (let ((color (ps-xemacs-color-name x-color)))
- (cond
- ((fboundp 'x-color-values)
- (x-color-values color))
- ((and (fboundp 'color-instance-rgb-components)
- (ps-color-device))
- (ps-x-color-instance-rgb-components
- (if (ps-x-color-instance-p x-color)
- x-color
- (ps-x-make-color-instance color))))
- (t
- (error "No available function to determine X color values.")))))
-
- (defun ps-face-foreground-name (face)
- (ps-xemacs-color-name (face-foreground face)))
-
- (defun ps-face-background-name (face)
- (ps-xemacs-color-name (face-background face)))
-
- (defun ps-face-bold-p (face)
- (or (ps-xemacs-face-kind-p face 'WEIGHT_NAME "bold\\|demibold")
- (memq face ps-bold-faces))) ; Kludge-compatible
-
- (defun ps-face-italic-p (face)
- (or (ps-xemacs-face-kind-p face 'ANGLE_NAME "i\\|o")
- (ps-xemacs-face-kind-p face 'SLANT "i\\|o")
- (memq face ps-italic-faces))) ; Kludge-compatible
- )))
-
-
-(defvar ps-print-color-scale nil)
+
+(defun ps-del (alist-sym key)
+ "Delete by side effect element KEY from association list ALIST-SYM."
+ (let ((a:list: (symbol-value alist-sym)) ; to avoid name conflict
+ old)
+ (while a:list:
+ (if (eq key (car (car a:list:)))
+ (progn
+ (if old
+ (setcdr old (cdr a:list:))
+ (set alist-sym (cdr a:list:)))
+ (setq a:list: nil))
+ (setq old a:list:
+ a:list: (cdr a:list:)))))
+ (symbol-value alist-sym))
+
+
+(defun ps-time-stamp-locale-default ()
+ "Return the locale's \"preferred\" date as, for example, \"06/18/01\"."
+ (format-time-string "%x"))
+
+
+(defun ps-time-stamp-mon-dd-yyyy ()
+ "Return date as \"Jun 18 2001\"."
+ (format-time-string "%b %d %Y"))
+
+
+(defun ps-time-stamp-yyyy-mm-dd ()
+ "Return date as \"2001-06-18\" (ISO date)."
+ (format-time-string "%Y-%m-%d"))
+
+
+;; Alias for `ps-time-stamp-yyyy-mm-dd' (which see).
+(defalias 'ps-time-stamp-iso8601 'ps-time-stamp-yyyy-mm-dd)
+
+
+(defun ps-time-stamp-hh:mm:ss ()
+ "Return time as \"17:28:31\"."
+ (format-time-string "%T"))
+
+
+(and (featurep 'xemacs)
+ ;; XEmacs change: Need to check for emacs-major-version too.
+ (or (< emacs-major-version 19)
+ (and (= emacs-major-version 19) (< emacs-minor-version 12)))
+ (setq ps-print-color-p nil))
+
+
+;; Return t if the device (which can be changed during an emacs session)
+;; can handle colors.
+;; This function is not yet implemented for GNU emacs.
+(cond ((and (featurep 'xemacs)
+ ;; XEmacs change: Need to check for emacs-major-version too.
+ (or (> emacs-major-version 19)
+ (and (= emacs-major-version 19)
+ (>= emacs-minor-version 12)))) ; xemacs >= 19.12
+ (defun ps-color-device ()
+ (eq (ps-x-device-class) 'color)))
+
+ (t ; emacs
+ (defun ps-color-device ()
+ (if (fboundp 'color-values)
+ (ps-e-color-values "Green")
+ t))))
+
+
+(defun ps-mapper (extent list)
+ (nconc list
+ (list (list (ps-x-extent-start-position extent) 'push extent)
+ (list (ps-x-extent-end-position extent) 'pull extent)))
+ nil)
+
+(defun ps-extent-sorter (a b)
+ (< (ps-x-extent-priority a) (ps-x-extent-priority b)))
+
+(defun ps-xemacs-face-kind-p (face kind kind-regex)
+ (let* ((frame-font (or (ps-x-face-font-instance face)
+ (ps-x-face-font-instance 'default)))
+ (kind-cons
+ (and frame-font
+ (assq kind
+ (ps-x-font-instance-properties frame-font))))
+ (kind-spec (cdr-safe kind-cons))
+ (case-fold-search t))
+ (and kind-spec (string-match kind-regex kind-spec))))
+
+(cond ((featurep 'xemacs) ; xemacs
+
+ ;; to avoid XEmacs compilation gripes
+ (defvar coding-system-for-write nil)
+ (defvar coding-system-for-read nil)
+ (defvar buffer-file-coding-system nil)
+
+ (and (fboundp 'find-coding-system)
+ (or (ps-x-find-coding-system 'raw-text-unix)
+ (ps-x-copy-coding-system 'no-conversion-unix 'raw-text-unix)))
+
+ (defun ps-color-values (x-color)
+ (let ((color (ps-xemacs-color-name x-color)))
+ (cond
+ ((fboundp 'x-color-values)
+ (ps-e-x-color-values color))
+ ((and (fboundp 'color-instance-rgb-components)
+ (ps-color-device))
+ (ps-x-color-instance-rgb-components
+ (if (ps-x-color-instance-p x-color)
+ x-color
+ (ps-x-make-color-instance color))))
+ (t
+ (error "No available function to determine X color values")))))
+
+ (defun ps-face-bold-p (face)
+ (or (ps-xemacs-face-kind-p face 'WEIGHT_NAME "bold\\|demibold")
+ (memq face ps-bold-faces))) ; Kludge-compatible
+
+ (defun ps-face-italic-p (face)
+ (or (ps-xemacs-face-kind-p face 'ANGLE_NAME "i\\|o")
+ (ps-xemacs-face-kind-p face 'SLANT "i\\|o")
+ (memq face ps-italic-faces))) ; Kludge-compatible
+ )
+
+ (t ; emacs
+
+ (defun ps-color-values (x-color)
+ (cond
+ ((fboundp 'color-values)
+ (ps-e-color-values x-color))
+ ((fboundp 'x-color-values)
+ (ps-e-x-color-values x-color))
+ (t
+ (error "No available function to determine X color values"))))
+
+ (defun ps-face-bold-p (face)
+ (or (ps-e-face-bold-p face)
+ (memq face ps-bold-faces)))
+
+ (defun ps-face-italic-p (face)
+ (or (ps-e-face-italic-p face)
+ (memq face ps-italic-faces)))
+ ))
+
+
+(defvar ps-print-color-scale 1.0)