Re: ps-print-buffer-with-faces doesn't use selected frame's background
On 2007-01-22, Richard Stallman said: I just tested it. With ps-use-face-background set to t, it seems to print correctly. Should that be the default setting of ps-use-face-background? Since I print to .ps file I don't mind setting it to t. But for others using the REAL printer, that would be quite a waste to print something almost completely black. Would it look good to stay with white background and using reverse-video color for the rest faces? Just a wild guess. -- Leo sdl.web AT gmail.com (GPG Key: 9283AA3F) ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
Richard Stallman wrote: If the ~/.emacs file have: (setq initial-frame-alist (append '((background-color DarkSlateGray)) initial-frame-alist)) (setq default-frame-alist (append '((background-color DarkSlateGray)) default-frame-alist)) (require 'printing) ; or (require 'ps-print) then ps-print is loaded before initial-frame-alist has any effect, so, ps-default-bg is set to white. Yes, that is the cause. There is no way it can examine a frame parameter before there is a frame. So your other approach would seem to be needed. Ok, I've just updated Emacs 22 CVS. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
On 2007-01-21, Vinicius Jose Latorre said: Richard Stallman wrote: If the ~/.emacs file have: (setq initial-frame-alist (append '((background-color DarkSlateGray)) initial-frame-alist)) (setq default-frame-alist (append '((background-color DarkSlateGray)) default-frame-alist)) (require 'printing) ; or (require 'ps-print) then ps-print is loaded before initial-frame-alist has any effect, so, ps-default-bg is set to white. Yes, that is the cause. There is no way it can examine a frame parameter before there is a frame. So your other approach would seem to be needed. Ok, I've just updated Emacs 22 CVS. I just tested it. With ps-use-face-background set to t, it seems to print correctly. -- Leo sdl.web AT gmail.com (GPG Key: 9283AA3F) ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
I just tested it. With ps-use-face-background set to t, it seems to print correctly. Should that be the default setting of ps-use-face-background? ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
If the ~/.emacs file have: (setq initial-frame-alist (append '((background-color DarkSlateGray)) initial-frame-alist)) (setq default-frame-alist (append '((background-color DarkSlateGray)) default-frame-alist)) (require 'printing) ; or (require 'ps-print) then ps-print is loaded before initial-frame-alist has any effect, so, ps-default-bg is set to white. Yes, that is the cause. There is no way it can examine a frame parameter before there is a frame. So your other approach would seem to be needed. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
Well, the ps-print commands have a comment: ;;;###autoload just before the command definition. Yes. So when you run one of these commands, it will load ps-print. However, if you type C-h v ps-default-bg before that, it will not see that the variable even exists. Humm, trying the initialization above, I can see that ps-print is loaded before .emacs file is loaded. So, the background is white when ps-print is loaded and, only during .emacs loading, the background is changed. I suspected as much. What causes that? What does the backtrace say? If the variables have a value (let's say, 'frame-parameter), the value of them is calculated when any ps-print command is activated. And it's used frame-parameter function to get the color value. With your explanation, I now understand that idea, and I think it is a good one. Ok, could I implement it now in Emacs 22 before the release? Yes. But please also investigate what causes ps-print to be loaded early. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
Richard Stallman wrote: 4. start new Emacs session 5. type: C-h v ps-default-bg RET == #ff (white) That is quite strange, because when I do emacs -Q and C-h v ps-default-bg RET it says that variable isn't defined. I wonder, have you done something to cause ps-print to be preloaded? Well, the ps-print commands have a comment: ;;;###autoload just before the command definition. When I start Emacs with -Q, typing C-h v ps- TAB appears some options to complete but ps-default-bg is not among them, only ps-multibyte-buffer, ps-page-dimensions-database, ps-paper-type and ps-print-color-p. And these options have the comment ;;;###autoload just before the variable definition. 2. set in emacs/lisp/ps-print.el file: (defcustom ps-default-bg (frame-parameter nil 'background-color)) Please try this: (defcustom ps-default-bg (progn (debug) (frame-parameter nil 'background-color))) Then you will go into the debugger when that initialization gets run, and you can see when it gets done, and what code runs it. Humm, trying the initialization above, I can see that ps-print is loaded before .emacs file is loaded. So, the background is white when ps-print is loaded and, only during .emacs loading, the background is changed. If the variables have a value (let's say, 'frame-parameter), the value of them is calculated when any ps-print command is activated. And it's used frame-parameter function to get the color value. With your explanation, I now understand that idea, and I think it is a good one. Ok, could I implement it now in Emacs 22 before the release? ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
Richard Stallman wrote: Well, I don't know why, but when the initialization code for ps-default-bg and ps-default-fg include frame-parameter, What is the precise test case that you tried? 1. set in the ~/.emacs file: (setq initial-frame-alist (append '((background-color DarkSlateGray)) initial-frame-alist)) (setq default-frame-alist (append '((background-color DarkSlateGray)) default-frame-alist)) 2. set in emacs/lisp/ps-print.el file: (defcustom ps-default-bg (frame-parameter nil 'background-color)) 3. byte-compile ps-print.el file 4. start new Emacs session 5. type: C-h v ps-default-bg RET == #ff (white) 6. type: M-: (frame-parameter nil 'background-color) RET == DarkSlateGray If the variables have a value (let's say, 'frame-parameter), the value of them is calculated when any ps-print command is activated. And it's used frame-parameter function to get the color value. I don't understand what that means. Could you show me the code you have in mind? Well, the idea is to have the following initialization: (defcustom ps-default-bg 'frame-parameter) When ps-print is invoked as, for example: M-x ps-print-buffer-with-faces RET The following piece of code is executed: (setq ps-default-background (cond ((eq ps-default-bg 'frame-parameter) (frame-parameter nil 'background-color)) ;; ... other conditions ... )) So, the frame-parameter function is invoked only during ps-print command activation instead of during ps-print file loading. ps-default-fg variable is handled in a similar way. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
I made some tests and it is not possible to use frame-parameter in the ps-default-fg and ps-default-bg initialization, because, during Emacs initilization, ps-print is loaded before the frame parameters are set. 1. Why is ps-print loaded before the frame parameters are set? In what case is that so? 2. It would be possible to avoid computing the defaults for ps-default-fg and ps-default-bg until a command is given to print something. Would that solve the problem? ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
Well, I don't know why, but when the initialization code for ps-default-bg and ps-default-fg include frame-parameter, What is the precise test case that you tried? If the variables have a value (let's say, 'frame-parameter), the value of them is calculated when any ps-print command is activated. And it's used frame-parameter function to get the color value. I don't understand what that means. Could you show me the code you have in mind? ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
Hi Leo, I made some tests and it is not possible to use frame-parameter in the ps-default-fg and ps-default-bg initialization, because, during Emacs initilization, ps-print is loaded before the frame parameters are set. The settings: (setq ps-zebra-stripes nil ps-use-face-background t ps-default-bg t) seem to do what you want. The above settings could not work if frame parameters are changed dynamically or if you use face remapping. Regards, Vinicius Vinicius Jose Latorre wrote: Hi Leo, Thanks for the Emacs image. Leo wrote: Hi Vinicius, * Vinicius Jose Latorre (2007-01-08 23:21 -0200) said: ^ Hi Eli, Hi Leo, Eli Zaretskii wrote: From: Leo [EMAIL PROTECTED] Date: Sat, 06 Jan 2007 17:29:34 + * Eli Zaretskii (2007-01-06 12:59 +0200) said: ^ `ps-print-buffer-with-faces' will print a dark background buffer into a .ps file with white background. This makes the text difficult to read. This is a feature. See the variable ps-use-face-background for how to override it. I play with it. I put the buffer I want to print in another frame and swap its foreground and background by modifying frame parameters so that the change only happens in that frame. But then printing still uses the global frame parameter's foreground and background colors instead of the selected frame's. Is this a bug? I don't know. Vinicius, could you please look into this? Thanks. ps-print does not get color frame parameters; it only deals with faces. The variables ps-default-fg, ps-default-bg and ps-use-face-background are only relative to faces. So, to get the frame parameters to print you could use some function like: (defun my-ps-print-buffer-with-faces (optional filename) (interactive (list (ps-print-preprint current-prefix-arg))) (let ((ps-default-bg (frame-parameter nil 'background-color)) (ps-default-fg (frame-parameter nil 'foreground-color)) (ps-use-face-background t)) (ps-print-buffer-with-faces filename))) Regards, Thank you for the answer. However output from ps-print does not look good generally in a dark background? Is this a known problem? Ok, using the ps-default-bg default value (white) is not good when using a dark background. This is neither a problem nor a bug. You could set ps-default-bg and ps-default-fg to a suitable color. One possible way to improve ps-default-bg initialization could be set it in ps-print with (frame-parameter nil 'background-color) The value of ps-default-fg and ps-default-bg variables are not changed when frame parameters change. Note that even the initialization above will not be good if the frame parameters (background-color and foreground-color) are changed dynamically. ps-print also allows face remapping, so, the initialization above could not be good depending on the colors used. Regards, Vinicius ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
* Vinicius Jose Latorre (2007-01-11 11:07 -0200) said: ^ I made some tests and it is not possible to use frame-parameter in the ps-default-fg and ps-default-bg initialization, because, during Emacs initilization, ps-print is loaded before the frame parameters are set. The settings: (setq ps-zebra-stripes nil ps-use-face-background t ps-default-bg t) seem to do what you want. The above settings could not work if frame parameters are changed dynamically or if you use face remapping. Thank you very much, Vinicius. Do you think we can make a better default setting so that people won't print out something unreadable by accident? -- Leo sdl.web AT gmail.com (GPG Key: 9283AA3F) ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
I made some tests and it is not possible to use frame-parameter in the ps-default-fg and ps-default-bg initialization, because, during Emacs initilization, ps-print is loaded before the frame parameters are set. 1. Why is ps-print loaded before the frame parameters are set? In what case is that so? 2. It would be possible to avoid computing the defaults for ps-default-fg and ps-default-bg until a command is given to print something. Would that solve the problem? ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
Richard Stallman wrote: I made some tests and it is not possible to use frame-parameter in the ps-default-fg and ps-default-bg initialization, because, during Emacs initilization, ps-print is loaded before the frame parameters are set. 1. Why is ps-print loaded before the frame parameters are set? In what case is that so? Well, I don't know why, but when the initialization code for ps-default-bg and ps-default-fg include frame-parameter, the result is always: ps-default-bg #ff (white) ps-default-fg #22 (gray98) It doesn't matter if the background-color frame parameter is set to white, DarkSlateGray, black or any other color in the initial-frame-alist variable, the initialization value is always as above. 2. It would be possible to avoid computing the defaults for ps-default-fg and ps-default-bg until a command is given to print something. Would that solve the problem? Well, it could solve the problem. If the variables have a value (let's say, 'frame-parameter), the value of them is calculated when any ps-print command is activated. And it's used frame-parameter function to get the color value. Could I implement this now in Emacs 22 or wait until after release? ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
* Vinicius Jose Latorre (2007-01-10 03:01 -0200) said: ^ Hi Leo, Thanks for the Emacs image. Welcome! [...] Thank you for the answer. However output from ps-print does not look good generally in a dark background? Is this a known problem? Ok, using the ps-default-bg default value (white) is not good when using a dark background. This is neither a problem nor a bug. You could set ps-default-bg and ps-default-fg to a suitable color. A dark background will waste a lot of ink if printed ;) But I think ps-print should choose a different color according to the background type: dark or light. One possible way to improve ps-default-bg initialization could be set it in ps-print with (frame-parameter nil 'background-color) The value of ps-default-fg and ps-default-bg variables are not changed when frame parameters change. Note that even the initialization above will not be good if the frame parameters (background-color and foreground-color) are changed dynamically. ps-print also allows face remapping, so, the initialization above could not be good depending on the colors used. Regards, Vinicius -- Leo sdl.web AT gmail.com (GPG Key: 9283AA3F) ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background (was: ps-print-buffer-with-faces in dark background)
Hi Eli, Hi Leo, Eli Zaretskii wrote: From: Leo [EMAIL PROTECTED] Date: Sat, 06 Jan 2007 17:29:34 + * Eli Zaretskii (2007-01-06 12:59 +0200) said: ^ `ps-print-buffer-with-faces' will print a dark background buffer into a .ps file with white background. This makes the text difficult to read. This is a feature. See the variable ps-use-face-background for how to override it. I play with it. I put the buffer I want to print in another frame and swap its foreground and background by modifying frame parameters so that the change only happens in that frame. But then printing still uses the global frame parameter's foreground and background colors instead of the selected frame's. Is this a bug? I don't know. Vinicius, could you please look into this? Thanks. ps-print does not get color frame parameters; it only deals with faces. The variables ps-default-fg, ps-default-bg and ps-use-face-background are only relative to faces. So, to get the frame parameters to print you could use some function like: (defun my-ps-print-buffer-with-faces (optional filename) (interactive (list (ps-print-preprint current-prefix-arg))) (let ((ps-default-bg (frame-parameter nil 'background-color)) (ps-default-fg (frame-parameter nil 'foreground-color)) (ps-use-face-background t)) (ps-print-buffer-with-faces filename))) Regards, Vinicius PS: See also: How Ps-Print Deals With Faces http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage#PsPrintPackage21 How Ps-Print Deals With Color http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage#PsPrintPackage22 ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background (was: ps-print-buffer-with-faces in dark background)
Hi Vinicius, * Vinicius Jose Latorre (2007-01-08 23:21 -0200) said: ^ Hi Eli, Hi Leo, Eli Zaretskii wrote: From: Leo [EMAIL PROTECTED] Date: Sat, 06 Jan 2007 17:29:34 + * Eli Zaretskii (2007-01-06 12:59 +0200) said: ^ `ps-print-buffer-with-faces' will print a dark background buffer into a .ps file with white background. This makes the text difficult to read. This is a feature. See the variable ps-use-face-background for how to override it. I play with it. I put the buffer I want to print in another frame and swap its foreground and background by modifying frame parameters so that the change only happens in that frame. But then printing still uses the global frame parameter's foreground and background colors instead of the selected frame's. Is this a bug? I don't know. Vinicius, could you please look into this? Thanks. ps-print does not get color frame parameters; it only deals with faces. The variables ps-default-fg, ps-default-bg and ps-use-face-background are only relative to faces. So, to get the frame parameters to print you could use some function like: (defun my-ps-print-buffer-with-faces (optional filename) (interactive (list (ps-print-preprint current-prefix-arg))) (let ((ps-default-bg (frame-parameter nil 'background-color)) (ps-default-fg (frame-parameter nil 'foreground-color)) (ps-use-face-background t)) (ps-print-buffer-with-faces filename))) Regards, Thank you for the answer. However output from ps-print does not look good generally in a dark background? Is this a known problem? exampel.ps.bz2 Description: exampel.ps.bz2 Vinicius PS: See also: How Ps-Print Deals With Faces http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage#PsPrintPackage21 How Ps-Print Deals With Color http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage#PsPrintPackage22 regards, -- Leo sdl.web AT gmail.com (GPG Key: 9283AA3F) ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
Hi Leo, Could you send me an image showing how it looks in Emacs? Also, please, do the following steps: 1. switch to *scratch* buffer. 2. do: M-: (insert (ps-setup)) RET 3. save in a file and send me back. Thanks, Vinicius Leo wrote: Hi Vinicius, * Vinicius Jose Latorre (2007-01-08 23:21 -0200) said: ^ Hi Eli, Hi Leo, Eli Zaretskii wrote: From: Leo [EMAIL PROTECTED] Date: Sat, 06 Jan 2007 17:29:34 + * Eli Zaretskii (2007-01-06 12:59 +0200) said: ^ `ps-print-buffer-with-faces' will print a dark background buffer into a .ps file with white background. This makes the text difficult to read. This is a feature. See the variable ps-use-face-background for how to override it. I play with it. I put the buffer I want to print in another frame and swap its foreground and background by modifying frame parameters so that the change only happens in that frame. But then printing still uses the global frame parameter's foreground and background colors instead of the selected frame's. Is this a bug? I don't know. Vinicius, could you please look into this? Thanks. ps-print does not get color frame parameters; it only deals with faces. The variables ps-default-fg, ps-default-bg and ps-use-face-background are only relative to faces. So, to get the frame parameters to print you could use some function like: (defun my-ps-print-buffer-with-faces (optional filename) (interactive (list (ps-print-preprint current-prefix-arg))) (let ((ps-default-bg (frame-parameter nil 'background-color)) (ps-default-fg (frame-parameter nil 'foreground-color)) (ps-use-face-background t)) (ps-print-buffer-with-faces filename))) Regards, Thank you for the answer. However output from ps-print does not look good generally in a dark background? Is this a known problem? Vinicius PS: See also: How Ps-Print Deals With Faces http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage#PsPrintPackage21 How Ps-Print Deals With Color http://www.emacswiki.org/cgi-bin/wiki/PsPrintPackage#PsPrintPackage22 regards, ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background
Hi Leo, Thanks for the Emacs image. Leo wrote: Hi Vinicius, * Vinicius Jose Latorre (2007-01-08 23:21 -0200) said: ^ Hi Eli, Hi Leo, Eli Zaretskii wrote: From: Leo [EMAIL PROTECTED] Date: Sat, 06 Jan 2007 17:29:34 + * Eli Zaretskii (2007-01-06 12:59 +0200) said: ^ `ps-print-buffer-with-faces' will print a dark background buffer into a .ps file with white background. This makes the text difficult to read. This is a feature. See the variable ps-use-face-background for how to override it. I play with it. I put the buffer I want to print in another frame and swap its foreground and background by modifying frame parameters so that the change only happens in that frame. But then printing still uses the global frame parameter's foreground and background colors instead of the selected frame's. Is this a bug? I don't know. Vinicius, could you please look into this? Thanks. ps-print does not get color frame parameters; it only deals with faces. The variables ps-default-fg, ps-default-bg and ps-use-face-background are only relative to faces. So, to get the frame parameters to print you could use some function like: (defun my-ps-print-buffer-with-faces (optional filename) (interactive (list (ps-print-preprint current-prefix-arg))) (let ((ps-default-bg (frame-parameter nil 'background-color)) (ps-default-fg (frame-parameter nil 'foreground-color)) (ps-use-face-background t)) (ps-print-buffer-with-faces filename))) Regards, Thank you for the answer. However output from ps-print does not look good generally in a dark background? Is this a known problem? Ok, using the ps-default-bg default value (white) is not good when using a dark background. This is neither a problem nor a bug. You could set ps-default-bg and ps-default-fg to a suitable color. One possible way to improve ps-default-bg initialization could be set it in ps-print with (frame-parameter nil 'background-color) The value of ps-default-fg and ps-default-bg variables are not changed when frame parameters change. Note that even the initialization above will not be good if the frame parameters (background-color and foreground-color) are changed dynamically. ps-print also allows face remapping, so, the initialization above could not be good depending on the colors used. Regards, Vinicius ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
Re: ps-print-buffer-with-faces doesn't use selected frame's background (was: ps-print-buffer-with-faces in dark background)
From: Leo [EMAIL PROTECTED] Date: Sat, 06 Jan 2007 17:29:34 + * Eli Zaretskii (2007-01-06 12:59 +0200) said: ^ `ps-print-buffer-with-faces' will print a dark background buffer into a .ps file with white background. This makes the text difficult to read. This is a feature. See the variable ps-use-face-background for how to override it. I play with it. I put the buffer I want to print in another frame and swap its foreground and background by modifying frame parameters so that the change only happens in that frame. But then printing still uses the global frame parameter's foreground and background colors instead of the selected frame's. Is this a bug? I don't know. Vinicius, could you please look into this? Thanks. ___ emacs-pretest-bug mailing list emacs-pretest-bug@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug