[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug report on ps-print-region in ps-print.el

From: Dan Dever
Subject: Bug report on ps-print-region in ps-print.el
Date: Wed, 7 Mar 2001 08:47:17 -0500 (EST)

Found in:

In GNU Emacs 20.7.1 (alphaev56-dec-osf4.0f, X toolkit)
 of Wed Feb 21 2001 on pia002.hlo.dec.com

and in:

In GNU Emacs 20.7.1 (i386-*-nt5.0.2195)
 of Tue Jun 13 2000 on buffy
configured using `configure NT'

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

I would like to use the function ps-print-region from one of my
own functions by calling (ps-print-region from to).  My function
is the one that will define from and to.  However,
ps-print-region will fail if mark is not set.  You can see this
by evaluating (ps-print-region (point-min) (point-max)) in a
buffer where the mark has not been set.

For example, I tried
    % emacs -q
    C-x C-r .login
and then
    ESC : (ps-print-region (point-min) (point-max))
and received this error message:
    There is no region now

I believe the problem is with the function ps-printing-region:
    ps-print-region        calls ps-print-without-faces
    ps-print-without-faces calls ps-spool-without-faces
    ps-spool-without-faces calls ps-printing-region

The function ps-printing-region looks like this:

(defun ps-printing-region (region-p)
    (setq ps-printing-region
          (and region-p
               (cons (ps-count-lines (point-min) (region-beginning))
                     (ps-count-lines (point-min) (point-max))))))

It calls region-beginning, which fails if mark is not set.  I
believe this could be improved by testing for mark within
ps-printing-region like so:

(defun ps-printing-region (region-p)
    (setq ps-printing-region
          (and region-p
               (mark t)   ; This is the only change -- Dan
               (cons (ps-count-lines (point-min) (region-beginning))
                     (ps-count-lines (point-min) (point-max))))))

However, ps-printing-region would just get set to nil in this
case, which wouldn't be what was intended.  It would be better,
I think, if ps-printing-region took a position as a parameter
instead of a flag.  Like so:

(defun ps-printing-region (from)  
    (setq ps-printing-region
          (and from               
               (cons (ps-count-lines (point-min) from)
                     (ps-count-lines (point-min) (point-max))))))

Then, appropriate changes would need to be made to the functions
which call ps-printing-region.  This should not be a problem, as
they all already have the from parameter.

Dan (dever@segsrv.hlo.dec.com)

Recent input:
C-x C-r . l o g i n return ESC : ( p s - p r i n t 
- r e g i o n SPC ( p o i n t - m i n ) SPC ( p o i 
n t - m a x ) ) return ESC x r e p o r t - e m a c 
s - b u g return

Recent messages:
For information about the GNU Project and its goals, type C-h C-p.
Loading sh-script...
Loading sh-script...done
Loading ps-print...
Loading ps-print...done
There is no region now
Loading emacsbug...
Loading emacsbug...done

reply via email to

[Prev in Thread] Current Thread [Next in Thread]