unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16866: 24.3.50; printing region gives non colorized output
@ 2014-02-24 16:45 Stefan-W. Hahn
  2014-02-24 17:33 ` Eli Zaretskii
  2014-02-25 16:40 ` Stefan-W. Hahn
  0 siblings, 2 replies; 8+ messages in thread
From: Stefan-W. Hahn @ 2014-02-24 16:45 UTC (permalink / raw)
  To: 16866

[-- Attachment #1: Type: text/plain, Size: 2477 bytes --]

Good evening,

if printing a buffer with postscript the out is colorized. If printing
a region of the same buffer the output is bw.

To test it I tried to print the *scratch* buffer with it's initial text.
If I print the whole buffer the output is colorized, if mark the whole
buffer and print that marked region I got a bw output.

I diffed the to ps spool files and got:

First file is the region printing, second the complete.
I attached the both files.

The difference is in third hunk, where the FG (foreground) color when
printing a region is "0 0 0" compared to the colors in the other case.

,----
| --- prspool-5368vp.ps	2014-02-24 07:11:08.000000000 +0100
| +++ prspool-536J6v.ps	2014-02-24 07:11:32.000000000 +0100
| @@ -2,7 +2,7 @@
|  %%Title: *scratch*
|  %%Creator: ps-print v7.3.5
|  %%For: Stefan-W. Hahn
| -%%CreationDate: 07:11:07 Feb 24 2014
| +%%CreationDate: 07:11:31 Feb 24 2014
|  %%Orientation: Landscape
|  %%DocumentNeededResources: font Times-Roman Times-Italic
|  %%+ font Courier
| @@ -1267,7 +1267,7 @@
|  /LineNumber 1 def
|  /PageNumber 1 def
|  /HeaderLinesLeft[
| - [/h0 (Subset of: *scratch* \(unsaved\))]
| + [/h0 (*scratch* \(unsaved\))]
|   [/h1 ()]
|  ]def
|  /HeaderLinesRight[
| @@ -1279,6 +1279,7 @@
|  /f0 F
|  false BG
|  0.000 0.000 0.000 FG
| +0.698 0.133 0.133 FG
|  (;; ) S
|  (This buffer is for notes you don't want to save, and for Lisp evaluation.) S
|  LHL
| @@ -1288,6 +1289,7 @@
|  (;; ) S
|  (then enter the text in that file's own buffer.) S
|  PHL
| +0.000 0.000 0.000 FG
|  PHL
|  EndPage
|  EndDSCPage
`----

I'm running on Windows 7:

In GNU Emacs 24.3.50.1 (i686-pc-mingw32)
 of 2014-02-17 on ODIEONE
Repository revision: 116465 eggert@cs.ucla.edu-20140217212044-yvn8tmrl0c3p8=
jf2
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=3D/c/Devel/emacs/binary --enable-checking=3Dyes,glyphs
 'CFLAGS=3D-O0 -g3' LDFLAGS=3D-Lc:/Devel/emacs/lib
 CPPFLAGS=3D-Ic:/Devel/emacs/include'

Important settings:
  value of $LANG: DEU
  locale-coding-system: cp1252

Major mode: Lisp Interaction

Minor modes in effect:

Recent messages:
Mark set [2 times]
Formatting...done
Saving...
Wrote d:/tmp/prspool-5368vp.ps [2 times]
Formatting...done
Saving...
Wrote d:/tmp/prspool-536J6v.ps [2 times]
Mark set

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.

[-- Attachment #2: prspool.tar.gz --]
[-- Type: application/octet-stream, Size: 20061 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#16866: 24.3.50; printing region gives non colorized output
  2014-02-24 16:45 bug#16866: 24.3.50; printing region gives non colorized output Stefan-W. Hahn
@ 2014-02-24 17:33 ` Eli Zaretskii
  2014-02-24 20:09   ` Stefan-W. Hahn
  2014-02-25 16:40 ` Stefan-W. Hahn
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2014-02-24 17:33 UTC (permalink / raw)
  To: Stefan-W. Hahn; +Cc: 16866

> Date: Mon, 24 Feb 2014 17:45:17 +0100
> From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
> 
> if printing a buffer with postscript the out is colorized. If printing
> a region of the same buffer the output is bw.
> 
> To test it I tried to print the *scratch* buffer with it's initial text.
> If I print the whole buffer the output is colorized, if mark the whole
> buffer and print that marked region I got a bw output.

The former uses text properties, the latter uses overlays.  If you put
an overlay on a portion of text, I don't think you will get it in
print, since overlays are not considered part of the buffer text.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#16866: 24.3.50; printing region gives non colorized output
  2014-02-24 17:33 ` Eli Zaretskii
@ 2014-02-24 20:09   ` Stefan-W. Hahn
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan-W. Hahn @ 2014-02-24 20:09 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 16866

Mail von Eli Zaretskii, Mon, 24 Feb 2014 at 19:33:35 +0200:

Hello,

> > Date: Mon, 24 Feb 2014 17:45:17 +0100
> > From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
> > 
> > if printing a buffer with postscript the out is colorized. If printing
> > a region of the same buffer the output is bw.
> > 
> > To test it I tried to print the *scratch* buffer with it's initial text.
> > If I print the whole buffer the output is colorized, if mark the whole
> > buffer and print that marked region I got a bw output.
> 
> The former uses text properties, the latter uses overlays.  If you put
> an overlay on a portion of text, I don't think you will get it in
> print, since overlays are not considered part of the buffer text.

Ok. But this is a change compared to an older emacs version.
Here on linux it's the same. With 24.3.50.1 it is like I described,
with 23.4.1 (an emacs23, the only older version I have installed too)
also the region is printed colorized.

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#16866: 24.3.50; printing region gives non colorized output
  2014-02-24 16:45 bug#16866: 24.3.50; printing region gives non colorized output Stefan-W. Hahn
  2014-02-24 17:33 ` Eli Zaretskii
@ 2014-02-25 16:40 ` Stefan-W. Hahn
  2014-03-16 14:22   ` Stefan-W. Hahn
  1 sibling, 1 reply; 8+ messages in thread
From: Stefan-W. Hahn @ 2014-02-25 16:40 UTC (permalink / raw)
  To: 16866

Mail von Stefan-W. Hahn, Mon, 24 Feb 2014 at 17:45:17 +0100:

Good evening,

> if printing a buffer with postscript the out is colorized. If printing
> a region of the same buffer the output is bw.
> 
> To test it I tried to print the *scratch* buffer with it's initial text.
> If I print the whole buffer the output is colorized, if mark the whole
> buffer and print that marked region I got a bw output.

I traced it down a little bit. The problematic function is
ps-generate-postscript-with-faces1 which extracts the face calls
ps-plot-with-face together with the face.

If I mark a region (say in buffer *scratch*) on the first lines I get
following information with describe-text-properties:

24.3.50:
--------
Text content at position 1:
There is an overlay here:
 From 1 to 191
  face                 region
  window               #<window 746 on *scratch*>

There are text properties here:
  face                 font-lock-comment-delimiter-face
  fontified            t

23.4.1:
-------
Text content at position 1:
There are text properties here:
  face                 font-lock-comment-delimiter-face
  fontified            t

And therefore ps-plot-with-face is called with 'region as face in 24.3.50
and 'font-lock-comment-delimiter-face (as expected!) in 23.4.1.

The difference seems to be that in the newer version of emacs the region
defines an overlay with the face 'region.

In my unterstanding of ps-print-region-with-faces I will expect the old
behaviour.

(I have no clue how to repair till yet.)

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#16866: 24.3.50; printing region gives non colorized output
  2014-02-25 16:40 ` Stefan-W. Hahn
@ 2014-03-16 14:22   ` Stefan-W. Hahn
  2014-03-18 20:04     ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan-W. Hahn @ 2014-03-16 14:22 UTC (permalink / raw)
  To: 16866

Mail von Stefan-W. Hahn, Tue, 25 Feb 2014 at 17:40:16 +0100:
> Mail von Stefan-W. Hahn, Mon, 24 Feb 2014 at 17:45:17 +0100:

Good day,

> > if printing a buffer with postscript the out is colorized. If printing
> > a region of the same buffer the output is bw.

I think the reason for changing this compared to emacs 23.4 is the change in
simple.el when defining an overlay for displaying a region.

(See
commit c95b9f291924ec20eb7bd3ac7ad8995b409aa4ad
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Date:   Tue Oct 29 12:11:50 2013 -0400
)

With this change the function ps-generate-postscript-with-faces1 gets the
wrong face for printing, the face of the region and not the face of the
underlying text.

The following change to lisp/ps-def.el tries to corrects this:

From 3f683fbd43e604af2a20303f84b82fe6e031bf1f Mon Sep 17 00:00:00 2001
From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
Date: Sun, 16 Mar 2014 15:11:26 +0100
Subject: [PATCH] Postscript print region colorized again (bug#16866)

After changing the region handling the region itself is defined by an
overlay with a face.

When print a region the code for assembling the postscript data now gets the
face of the overlay instead of the face of the text to print. This results
in an BW printing instead of a colored printing.

This patch changes this by testing if the handled overlay is the region
overlay and ignoring the face of it. The region overlay is detected by
reading the window parameter 'internal-region-overlay of the selected window.

TINY CHANGE.

Signed-off-by: Stefan-W. Hahn <stefan.hahn@s-hahn.de>
---
 lisp/ps-def.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ps-def.el b/lisp/ps-def.el
index 06cef75..d9d8eaa 100644
--- a/lisp/ps-def.el
+++ b/lisp/ps-def.el
@@ -323,6 +323,7 @@ (defvar ps-italic-faces)
     (let ((face 'default)
 	  (position to)
 	  ;; Emacs
+          (rol (window-parameter (selected-window) 'internal-region-overlay))
 	  (property-change from)
 	  (overlay-change from)
 	  (save-buffer-invisibility-spec buffer-invisibility-spec)
@@ -364,7 +365,8 @@ (defvar ps-italic-faces)
 		    (overlay-get overlay 'invisible))
 		   (overlay-priority
 		    (or (overlay-get overlay 'priority) 0)))
-	      (and (> overlay-priority face-priority)
+	      (and (not (and rol (eq rol overlay)))
+                   (> overlay-priority face-priority)
 		   (setq before-string
 			 (or (overlay-get overlay 'before-string)
 			     before-string)
-- 
1.8.3.2.733.gf8abaeb

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#16866: 24.3.50; printing region gives non colorized output
  2014-03-16 14:22   ` Stefan-W. Hahn
@ 2014-03-18 20:04     ` Stefan Monnier
  2014-03-19 16:24       ` Stefan-W. Hahn
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2014-03-18 20:04 UTC (permalink / raw)
  To: Stefan-W. Hahn; +Cc: 16866

>> > if printing a buffer with postscript the out is colorized. If printing
>> > a region of the same buffer the output is bw.
> I think the reason for changing this compared to emacs 23.4 is the change in
> simple.el when defining an overlay for displaying a region.

Indeed.  Maybe we should call deactivate-mark explicitly from ps-print,
and change deactivate-mark to call redisplay--update-region-highlight?


        Stefan





^ permalink raw reply	[flat|nested] 8+ messages in thread

* bug#16866: 24.3.50; printing region gives non colorized output
  2014-03-18 20:04     ` Stefan Monnier
@ 2014-03-19 16:24       ` Stefan-W. Hahn
  2014-03-19 19:13         ` Stefan
  0 siblings, 1 reply; 8+ messages in thread
From: Stefan-W. Hahn @ 2014-03-19 16:24 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 16866

Mail von Stefan Monnier, Tue, 18 Mar 2014 at 16:04:17 -0400:

Good day,

> >> > if printing a buffer with postscript the out is colorized. If printing
> >> > a region of the same buffer the output is bw.
> > I think the reason for changing this compared to emacs 23.4 is the change in
> > simple.el when defining an overlay for displaying a region.
> 
> Indeed.  Maybe we should call deactivate-mark explicitly from ps-print,
> and change deactivate-mark to call redisplay--update-region-highlight?

I tried following patch. It looks like it works. (I'm not so deep in code
to see if this has other side effects.)

From d38260efdc20ae4964a7768099d38d423c0510a2 Mon Sep 17 00:00:00 2001
From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
Date: Wed, 19 Mar 2014 17:05:20 +0100
Subject: [PATCH] Postscript print region colorized again (bug#16866)

After changing the region handling the region itself is defined by an
overlay with a face.

When print a region the code for assembling the postscript data now gets the
face of the overlay instead of the face of the text to print. This results
in an BW printing instead of a colored printing.

As suggested by Stefan Monnier this patch changes deactivate-mark to
unhighlight an activated region and then calling deactivate-mark
before printing.

TINY CHANGE.

Signed-off-by: Stefan-W. Hahn <stefan.hahn@s-hahn.de>
---
 lisp/ps-print.el | 1 +
 lisp/simple.el   | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index 6251a6c..3959c28 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -6429,6 +6429,7 @@ (defun ps-generate-postscript-with-faces (from to)
   (save-restriction
     (narrow-to-region from to)
     (ps-print-ensure-fontified from to)
+    (deactivate-mark)
     (ps-generate-postscript-with-faces1 from to)))
 
 (defun ps-generate-postscript (from to)
diff --git a/lisp/simple.el b/lisp/simple.el
index d847082..df8279e 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4386,7 +4386,8 @@ (defun deactivate-mark (&optional force)
       (if (eq (car-safe transient-mark-mode) 'only)
 	  (setq transient-mark-mode (cdr transient-mark-mode)))
       (setq mark-active nil)
-      (run-hooks 'deactivate-mark-hook))))
+      (run-hooks 'deactivate-mark-hook)
+      (redisplay--update-region-highlight (selected-window)))))
 
 (defun activate-mark (&optional no-tmm)
   "Activate the mark.
-- 
1.9.0

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.





^ permalink raw reply related	[flat|nested] 8+ messages in thread

* bug#16866: 24.3.50; printing region gives non colorized output
  2014-03-19 16:24       ` Stefan-W. Hahn
@ 2014-03-19 19:13         ` Stefan
  0 siblings, 0 replies; 8+ messages in thread
From: Stefan @ 2014-03-19 19:13 UTC (permalink / raw)
  To: Stefan-W. Hahn; +Cc: 16866-done

Version:24.4

> I tried following patch. It looks like it works. (I'm not so deep in code
> to see if this has other side effects.)

Thanks, installed,


        Stefan





^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-03-19 19:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-24 16:45 bug#16866: 24.3.50; printing region gives non colorized output Stefan-W. Hahn
2014-02-24 17:33 ` Eli Zaretskii
2014-02-24 20:09   ` Stefan-W. Hahn
2014-02-25 16:40 ` Stefan-W. Hahn
2014-03-16 14:22   ` Stefan-W. Hahn
2014-03-18 20:04     ` Stefan Monnier
2014-03-19 16:24       ` Stefan-W. Hahn
2014-03-19 19:13         ` Stefan

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).