Re: printing problems

[email protected]
Newsgroups gmane.emacs.help
Message-ID <[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!).
     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.

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.

-- 
The lyf so short, the craft so long to lerne.
- Geoffrey Chaucer, The Parliament of Birds.
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.