Re: printing problems

gfp <[email protected]>
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
Hi,

thanks very much

please see annotations underneath.


Am 02.04.26 um 17:07 schrieb [email protected]:
> gfp <[email protected]> writes:
> 
>>
>> after changing all my "setq"  to "setopt"
>> today opening emacs
>> I got a backtrace:
>>
>> Debugger entered--Lisp error: (error "Invalid text printer name
>> ‘prt_06a’ for variable ‘pr-txt-name’")
>>     error("Invalid text printer name `%s' for variable `pr-txt-name'"
>> prt_06a)
>>     pr-txt-set-printer(prt_06a)
>>     pr-menu-set-txt-title(prt_06a)
>>     pr-txt-name-custom-set(pr-txt-name prt_06a)
>>     setopt--set(pr-txt-name prt_06a)
>>     load-with-code-conversion("/home/gfp/.config/emacs/init.el"
>> "/home/gfp/.config/emacs/init.el" t t)
>>     load("/home/gfp/.config/emacs/init" noerror nomessage)
>>     #f(compiled-function () #<bytecode 0x810b596305a1f90>)()
>>     startup--load-user-init-file(#f(compiled-function () #<bytecode
>> -0x6238d89e15d8e90>) #f(compiled-function () #<bytecode
>> -0x15951949e52b234f>) t)
>>     command-line()
>>     normal-top-level()
>> ---------------------------------------------------------
>>
> 
> 
> 1. Type C-h f setopt.  The Help text displays
> 
>    Note that ‘setopt’ will emit a warning if the type of a VALUE
>    does not match the type of the corresponding VARIABLE as
>    declared by ‘defcustom’.  (VARIABLE will be assigned the
>    value even if it doesn’t match the type.)
> 
> This is a good reason to use ‘setopt’ instead of ‘setq’ for
> user options (that is, for variables whose help text says
> that the variable can be customized).  After each ‘setopt’
> that you have written in your Emacs Lisp file, type C-x C-e
> to evaluate the expression.  If the type of a VALUE does not
> match the type of the corresponding VARIABLE as declared by
> ‘defcustom’, then ‘setopt’ will emit a warning.
> 
> 2. A good reason to use the Easy Customization is that it
> can write the Emacs Lisp expression for you.  One method for
> starting it is:
> 
>     - C-h v <variable-name>
>     - In the *Help* buffer, locate the ‘Customize’ button and
>       click on it.  If there is no Customize button, then
>       this variable is not a user option.
> 
> Once you have started Easy Customization for that user
> option, locate the ‘State’ button.  Click on it to display a
> menu.  At the bottom of the menu are two radio button
> options: "Show Current Value" and "Show Lisp Saved
> Expression".  You can select between the two options to show
> how your value is displayed.
> 
>    - "Show Current Value" displays the value broken up by
>      fields that you can fill in without having to know the
>      structure of the Lisp expression.
>    - "Show Lisp Saved Expression" shows what you may write as
>      the user option’s ‘setopt’ value.
> 
> 3. You have the expression:
>     (setopt pr-txt-printer-alist
>          '((prt_06a "lpr" nil "prt_06a")
>            (prt_07c nil   nil "prt_07c")
>            ))
> 
> This looks suspiciously like the example for Unix in the
> Easy Customization for this user option.
> 
>     - Do you have two printers named "prt_06a" and "prt_07c"?
>       If you only have one printer, then you can reset your
>       value for ‘pr-txt-printer-alist’ (use the ‘Revert’
>       button in the Easy Customization) to restore the
>       expression that includes ‘default’.
> 
>     - Have you configured your printer?  You will need to
>       have done this outside of Emacs.  How you do this
>       depends on your operating system and what utilities it
>       provides for installing/configuring a printer.  During
>       the installation/configuration of your printer, you will
>       choose a printer "name".  You will need to record that
>       name and provide it to Emacs.
> 
>       Then, using the Easy Customization for
>       ‘pr-txt-printer-alist’, you will have the following:
> 
>       ‘INS’ ‘DEL’ Text Printer:
>              Printer Symbol Name: default
>              Printer Command: lpr
>              Printer Switches:
>              ‘INS’
>              Printer Name: ‘Value Menu’ None
> 
>       You can then click on the ‘Value Menu’ button, select
>       ‘String’ from the button, and then type the your
>       printer’s name in the "String:" field.  You do not need
>       to include double quotes around the name of your
>       printer.
> 
>       Once you have entered your printer’s name, click on the
>       ‘Apply’ button to set the value of
>       ‘pr-txt-printer-alist’ for the current session (ONLY!).

why only for the current session?

>       You can then click on the ‘State’ button, select ‘Show
>       Saved Lisp Expression’ to see what the Lisp expression
>       is that you can use as the value for your ‘setopt’
>       expression.  This expression will have ‘default’ in it,
>       which is all that you need if you have only one printer --
>       your default.

I saved this "default" option in my init.el file.

But if I can set this in my customization
why do I need it in my init.el file?

> 
> You can repeat the steps above for each of your ‘setopt’
> expressions.  This will help you to get the form of each
> expression’s value set correctly.  A reason that the Easy
> Customization was created was to help Emacs users so that
> they do not need to know the form of the values (which can
> be complex).  You can use it exclusively (discarding the use
> of ‘setopt’) or you can use it to help you write your
> ‘setopt’ expressions.
> 
this part in my init.el file looks now like this:
I put the old values after the new value

  (setopt pr-txt-printer-alist
             '((default "lpr" nil "HP-Officejet-J4500-series"))) 
;;'((prt_06a "lpr" nil "prt_06a")
	                                                               ;; 
(prt_07c nil   nil "prt_07c")
  
;;     ))



my init.el file:

(require 'printing)
     (setopt pr-path-alist
	    '((unix      "." "/home/gfp/.guix-profile/bin" ghostview mpage 
PATH)  ;;'((unix      "." "~/bin" ghostview mpage PATH)
	      (ghostview "/home/gfp/.guix-profile/bin/gsview-dir") 
   ;;  (ghostview "$HOME/bin/gsview-dir")
	      (mpage     "/home/gfp/.guix-profile/bin/mpage-dir") 
   ;;  (mpage     "$HOME/bin/mpage-dir")
	      ))
     (setopt pr-txt-printer-alist
             '((default "lpr" nil "HP-Officejet-J4500-series"))) 
;;'((prt_06a "lpr" nil "prt_06a")
	                                                               ;; 
(prt_07c nil   nil "prt_07c")
  
;;     ))
     (setopt pr-txt-name      'prt_06a)
     (setq pr-ps-printer-alist                          ;;bug in emacs 
if warning comes up by setting setopt
           '((lps_06b "lpr" nil "-P" "lps_06b")
             (lps_07c "lpr" nil nil  "lps_07c")
             (lps_08c nil   nil nil  "lps_08c")
             ))
     (setopt pr-ps-name       'lps_06b)
     (setopt pr-temp-dir      "/tmp/")
     (setopt pr-gv-command    "gv")
     (setopt pr-gs-command    "gs")
     (setopt pr-gs-switches '("-q -dNOPAUSE -I/usr/share/ghostscript/5.10"))
     (setopt pr-gs-device     "uniprint")
     (setopt pr-gs-resolution 300)
     (setopt pr-ps-utility    'mpage)
     (setopt pr-ps-utility-alist
     '((mpage "mpage" nil    "-b%s" "-%d" "-l" "-t" "-T" ">" nil)
       (psnup "psnup" ("-q") "-P%s" "-%d" "-l" nil  nil  " " nil
      (inherits-from: . no-duplex))
       ))
    (setopt pr-setting-database
     '((no-duplex
        nil nil nil
	       (pr-file-duplex . nil)
	       (pr-file-tumble . nil))
	      ))
     (pr-update-menus t)		; update now printer and utility menus

thanks

Gottfried
OpenPGP_0xAC95367953582A3C.asc (application/pgp-keys, 636 B)
-----BEGIN PGP PUBLIC KEY BLOCK-----

xjMEaabDLRYJKwYBBAHaRw8BAQdAb7YT561Dj5CV9io77VLLjpOOSCz+xjHVL2Bj
+S/FSUbNGmdmcCAoMjAyNikgPGdmcEBwb3N0ZW8uYXQ+wpMEExYKADsWIQQkU+mE
m7kVmbEo/+eslTZ5U1gqPAUCaabDLQIbAwULCQgHAgIiAgYVCgkICwIEFgIDAQIe
BwIXgAAKCRCslTZ5U1gqPOPkAQDhysdwuz2eJo6kCGuVszxhEw6znPKV14R8a3vn
enCgywD9GulbjLKlGTpx6WyFmZ0bBZI1GVpIVr3qGbyFcAFZZADOOARppsMtEgor
BgEEAZdVAQUBAQdAX5BGmJLZB5B2ioEAy0C0iqgJ0GzUK4IP7gSGE9k/RQIDAQgH
wngEGBYKACAWIQQkU+mEm7kVmbEo/+eslTZ5U1gqPAUCaabDLQIbDAAKCRCslTZ5
U1gqPDixAP4teZj90382b6mB2mZT+KjjZz0opx/rahnOejBcW/+SkgD/StQdLbeZ
DqGFJ0TlGeHGxNB28C1fUE815wapzB6cKg4=
=u+uM
-----END PGP PUBLIC KEY BLOCK-----
OpenPGP_signature.asc (application/pgp-signature, 236 B)
-----BEGIN PGP SIGNATURE-----

wnsEABYIACMWIQQkU+mEm7kVmbEo/+eslTZ5U1gqPAUCac+4KwUDAAAAAAAKCRCslTZ5U1gqPHSm
AQC9633vVtCqcbs98k2l+zW2ux92KRLeerantza3tShSjQEA2Gnf0BvJkuWnoHNxX1TbqPvz+o1c
l7tDJcooxoOvdQo=
=2MhQ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.