GNU bug report logs - #5254
ps-print and faces specified as strings

Previous Next

Package: emacs;

Reported by: harven <harven <at> free.fr>

Date: Sun, 13 Dec 2009 00:05:04 UTC

Severity: normal

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 5254 in the body.
You can then email your comments to 5254 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4360; Package emacs. (Sun, 06 Sep 2009 17:00:03 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):

From: harven <harven <at> free.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: bug#5254: ps-print and faces specified as strings
Date: Sun, 20 Dec 2009 22:44:43 +0100
ps-spool-buffer-with-faces and ps-print-buffer-with-faces report errors
if there is a face specified as a string in the buffer.

Tested with emacs22 and emacs23 ; starting in a buffer in fundamental
mode, we type and execute the following:

  (facemenu-set-face "bold" 1 (point-max))

The text in the buffer becomes bold as expected.
We now try to spool the buffer using M-x ps-spool-buffer-with-faces.
This gives the error:

ps-face-attribute-list: Wrong type argument: listp, "bold"

A *postscript* buffer has been created, as expected, but it is empty.
It should have contained a faithful postscript image of the buffer.
The error can be reproduced with any face, not just bold.

It seems that the problem comes from the fact that somewhere in the
ps-print-* functions, the face is expected to be a symbol -- 'bold. 
In the function given below, the face is defined by facemenu-set-face
as a string -- "bold". If we use instead
(facemenu-set-face 'bold 1 (point-max))
to color the buffer, the error disappear.

It may not be a bug per se, yet it would be nice (and more consistent)
if the ps-print package could handle faces specified as strings.


In GNU Emacs 22.1.1 (i386-apple-darwin8.10.1, X toolkit) of 2007-08-13
Windowing system distributor `The X.Org Foundation', version 11.0.60802000

also

In GNU Emacs 23.1.1 (i486-pc-linux-gnu, GTK+ VErsion 2.18.2)) 
of 2009-11-02 on raven, modified by Debian
Windowing System distributor  `The X.Org Foundation', version 11.0.10605000


Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#5254; Package emacs. (Mon, 07 Sep 2009 21:35:04 GMT) Full text and rfc822 format available.

Message #6 received at 5254 <at> debbugs.gnu.org (full text, mbox):

From: Eduard Wiebe <ew <at> pusto.de>
To: harven <harven <at> free.fr>
Cc: Vinicius Jose Latorre <viniciusjl <at> ig.com.br>, 5254 <at> debbugs.gnu.org
Subject: bug#5254: ps-print and faces specified as strings
Date: Wed, 23 Dec 2009 17:03:14 +0100
harven <harven <at> free.fr> writes:

 Hi,

and thank you for your report.

> ps-spool-buffer-with-faces and ps-print-buffer-with-faces report errors
> if there is a face specified as a string in the buffer.
>
> Tested with emacs22 and emacs23 ; starting in a buffer in fundamental
> mode, we type and execute the following:
>
>   (facemenu-set-face "bold" 1 (point-max))
>
> The text in the buffer becomes bold as expected.
> We now try to spool the buffer using M-x ps-spool-buffer-with-faces.
> This gives the error:
>
> ps-face-attribute-list: Wrong type argument: listp, "bold"
>
> A *postscript* buffer has been created, as expected, but it is empty.
> It should have contained a faithful postscript image of the buffer.
> The error can be reproduced with any face, not just bold.
>
> It seems that the problem comes from the fact that somewhere in the
> ps-print-* functions, the face is expected to be a symbol -- 'bold. 

Indeed.

> In the function given below, the face is defined by facemenu-set-face
> as a string -- "bold". If we use instead
> (facemenu-set-face 'bold 1 (point-max))
> to color the buffer, the error disappear.
>
> It may not be a bug per se, yet it would be nice (and more consistent)
> if the ps-print package could handle faces specified as strings.

Can you try following patch:

diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index 386fc14..f799926 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -6254,7 +6254,8 @@ If FACE is not a valid face name, use default face."
     (or (and (symbolp face)
 	     (cdr (assq face ps-black-white-faces-alist)))
 	(vector 0 nil nil)))
-   ((symbolp face)
+   ((or (symbolp face) (facep face))
+    (and (stringp face) (setq face (intern face)))
     (cdr (or (assq face ps-print-face-extension-alist)
 	     (assq face ps-print-face-alist)
 	     (let* ((the-face (if (facep face) face 'default))

-- 
Eduard Wiebe

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#5254; Package emacs. (Mon, 07 Sep 2009 21:35:04 GMT) Full text and rfc822 format available.

Message #9 received at 5254 <at> debbugs.gnu.org (full text, mbox):

From: Vinicius Jose Latorre <viniciusjl <at> ig.com.br>
To: Eduard Wiebe <ew <at> pusto.de>
Cc: 5254 <at> debbugs.gnu.org, harven <harven <at> free.fr>
Subject: bug#5254: ps-print and faces specified as strings
Date: Wed, 23 Dec 2009 20:35:34 -0200
Hi all,


Maybe this patch is better:

*** 6249,6254 ****
--- 6249,6255 ----
  return the attribute vector.

  If FACE is not a valid face name, use default face."
+   (and (stringp face) (facep face) (setq face (intern face)))
    (cond
     (ps-black-white-faces-alist
      (or (and (symbolp face)


Thanks for your report,


Vinicius


Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#5254; Package emacs. (Mon, 07 Sep 2009 21:35:04 GMT) Full text and rfc822 format available.

Message #12 received at unknown <at> unknown (full text, mbox):

From: harven <harven <at> free.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#5254: ps-print and faces specified as strings
Date: Thu, 24 Dec 2009 03:21:01 -0800 (PST)
Hi,

both patches work, thanks.

Harven


Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#5254; Package emacs. (Mon, 07 Sep 2009 21:35:04 GMT) Full text and rfc822 format available.

Message #15 received at 5254 <at> debbugs.gnu.org (full text, mbox):

From: Eduard Wiebe <ew <at> pusto.de>
To: Vinicius Jose Latorre <viniciusjl <at> ig.com.br>
Cc: 5254 <at> debbugs.gnu.org
Subject: bug#5254: ps-print and faces specified as strings
Date: Thu, 24 Dec 2009 14:52:49 +0100
Vinicius Jose Latorre <viniciusjl <at> ig.com.br> writes:

> Hi all,
>
>
> Maybe this patch is better:
>
> *** 6249,6254 ****
> --- 6249,6255 ----
>   return the attribute vector.
>
>   If FACE is not a valid face name, use default face."
> +   (and (stringp face) (facep face) (setq face (intern face)))
>     (cond
>      (ps-black-white-faces-alist
>       (or (and (symbolp face)
>

I agree.

-- 
Eduard Wiebe


bug closed, send any further explanations to harven <harven <at> free.fr> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 05 Jan 2010 23:03:57 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <bug-gnu-emacs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 03 Feb 2010 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 141 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.