Mercurial > emacs
changeset 37967:758fe02d489d
Handle before-string and after-string overlay properties
in ps-print-*-with-faces commands. Doc fix.
(ps-print-version): New version number (6.5.2).
(ps-e-overlay-end): Alias for overlay-end to avoid compilation gripes
for XEmacs.
(ps-prefix-quote): Doc fix.
(ps-setup, ps-print-quote, ps-generate-postscript-with-faces): Code
fix.
(ps-basic-plot-str, ps-plot-string): New funs.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 01 Jun 2001 09:21:45 +0000 |
parents | d6089a8e8243 |
children | 3724056d2cb1 |
files | lisp/ps-print.el |
diffstat | 1 files changed, 78 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ps-print.el Thu May 31 19:02:56 2001 +0000 +++ b/lisp/ps-print.el Fri Jun 01 09:21:45 2001 +0000 @@ -10,12 +10,12 @@ ;; Maintainer: Kenichi Handa <handa@etl.go.jp> (multi-byte characters) ;; Maintainer: Vinicius Jose Latorre <vinicius@cpqd.com.br> ;; Keywords: wp, print, PostScript -;; Time-stamp: <2001/04/24 15:31:37 vinicius> -;; Version: 6.5.1.1 +;; Time-stamp: <2001/05/30 17:44:36 vinicius> +;; Version: 6.5.2 ;; X-URL: http://www.cpqd.com.br/~vinicius/emacs/ -(defconst ps-print-version "6.5.1.1" - "ps-print.el, v 6.5.1.1 <2001/04/24 vinicius> +(defconst ps-print-version "6.5.2" + "ps-print.el, v 6.5.2 <2001/05/30 vinicius> Vinicius's last change version -- this file may have been edited as part of Emacs without changes to the version number. When reporting bugs, please also @@ -1484,6 +1484,7 @@ (defalias 'ps-e-next-overlay-change 'next-overlay-change) (defalias 'ps-e-overlays-at 'overlays-at) (defalias 'ps-e-overlay-get 'overlay-get) + (defalias 'ps-e-overlay-end 'overlay-end) (defalias 'ps-e-x-color-values 'x-color-values) (defalias 'ps-e-color-values 'color-values) (if (fboundp 'find-composition) @@ -3274,7 +3275,8 @@ (interactive (list (count-lines (mark) (point)))) (ps-nb-pages nb-lines)) -(defvar ps-prefix-quote nil) +(defvar ps-prefix-quote nil + "Used for `ps-print-quote' (which see).") ;;;###autoload (defun ps-setup () @@ -3387,7 +3389,7 @@ '(20 . ps-bold-faces) '(20 . ps-italic-faces) '(20 . ps-underlined-faces) - ")\n + " )\n ;; The following customized variables have long lists and are seldom modified: ;; ps-page-dimensions-database ;; ps-font-info-database @@ -3401,6 +3403,27 @@ (defun ps-print-quote (elt) + "Quote ELT for printing (used for showing settings). + +If ELT is nil, return an empty string. +If ELT is string, return it. +Otherwise, ELT should be a cons (LEN . SYM) where SYM is a variable symbol and +LEN is the field length where SYM name will be inserted. The variable +`ps-prefix-quote' is used to form the string, if `ps-prefix-quote' is nil, it's +used \"(setq \" as prefix; otherwise, it's used \" \". So, the string +generated is: + + * If `ps-prefix-quote' is nil: + \"(setq SYM-NAME SYM-VALUE\" + |<------->| + LEN + + * If `ps-prefix-quote' is non-nil: + \" SYM-NAME SYM-VALUE\" + |<------->| + LEN + +If `ps-prefix-quote' is nil, it's set to t after generating string." (cond ((null elt) "") ((stringp elt) elt) @@ -3411,8 +3434,8 @@ (len (length key)) (val (symbol-value sym))) (concat (if ps-prefix-quote - ps-prefix-quote - (setq ps-prefix-quote " ") + " " + (setq ps-prefix-quote t) "(setq ") key (if (> col len) @@ -5585,6 +5608,16 @@ (cons to (* todo char-width)) (cons (+ from avail) ps-width-remaining)))) +(defun ps-basic-plot-str (from to string) + (let* ((wrappoint (ps-find-wrappoint from to + (ps-avg-char-width 'ps-font-for-text))) + (to (car wrappoint)) + (str (substring string from to))) + (ps-mule-prepare-ascii-font str) + (ps-output-string str) + (ps-output " S\n") + wrappoint)) + (defun ps-basic-plot-string (from to &optional bg-color) (let* ((wrappoint (ps-find-wrappoint from to (ps-avg-char-width 'ps-font-for-text))) @@ -5646,6 +5679,10 @@ " FG\n")) +(defsubst ps-plot-string (string) + (ps-plot 'ps-basic-plot-str 0 (length string) string)) + + (defvar ps-current-effect 0) @@ -6020,7 +6057,8 @@ (let ((property-change from) (overlay-change from) (save-buffer-invisibility-spec buffer-invisibility-spec) - (buffer-invisibility-spec nil)) + (buffer-invisibility-spec nil) + before-string after-string) (while (< from to) (and (< property-change to) ; Don't search for property change ; unless previous search succeeded. @@ -6029,7 +6067,9 @@ ; unless previous search succeeded. (setq overlay-change (min (ps-e-next-overlay-change from) to))) - (setq position (min property-change overlay-change)) + (setq position (min property-change overlay-change) + before-string nil + after-string nil) ;; The code below is not quite correct, ;; because a non-nil overlay invisible property ;; which is inactive according to the current value @@ -6051,24 +6091,38 @@ (while (and overlays (not (eq face 'emacs--invisible--face))) (let* ((overlay (car overlays)) - (overlay-invisible (ps-e-overlay-get overlay 'invisible)) - (overlay-priority (or (ps-e-overlay-get overlay 'priority) - 0))) + (overlay-invisible + (ps-e-overlay-get overlay 'invisible)) + (overlay-priority + (or (ps-e-overlay-get overlay 'priority) 0))) (and (> overlay-priority face-priority) - (setq face - (cond ((if (eq save-buffer-invisibility-spec t) - (not (null overlay-invisible)) - (or (memq overlay-invisible - save-buffer-invisibility-spec) - (assq overlay-invisible - save-buffer-invisibility-spec))) - 'emacs--invisible--face) - ((ps-e-overlay-get overlay 'face)) - (t face)) - face-priority overlay-priority))) + (setq before-string + (or (ps-e-overlay-get overlay 'before-string) + before-string) + after-string + (or (and (<= (ps-e-overlay-end overlay) position) + (ps-e-overlay-get overlay 'after-string)) + after-string) + face-priority overlay-priority + face + (cond + ((if (eq save-buffer-invisibility-spec t) + (not (null overlay-invisible)) + (or (memq overlay-invisible + save-buffer-invisibility-spec) + (assq overlay-invisible + save-buffer-invisibility-spec))) + 'emacs--invisible--face) + ((ps-e-overlay-get overlay 'face)) + (t face) + )))) (setq overlays (cdr overlays)))) ;; Plot up to this record. + (and before-string + (ps-plot-string before-string)) (ps-plot-with-face from position face) + (and after-string + (ps-plot-string after-string)) (setq from position))))) (ps-plot-with-face from to face))))