bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#16866: 24.3.50; printing region gives non colorized output


From: Stefan-W. Hahn
Subject: bug#16866: 24.3.50; printing region gives non colorized output
Date: Wed, 19 Mar 2014 17:24:40 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

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.





reply via email to

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