unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Jeff Rancier" <jeff.rancier@softechnics.com>
Subject: Re: Adding to ps-print-hook problems
Date: Mon, 16 Sep 2002 17:29:04 GMT	[thread overview]
Message-ID: <Axoh9.62971$xm.12776983@twister.nyroc.rr.com> (raw)
In-Reply-To: 3D8608CE.9000802@ihs.com

I changed it as follows:

    (defun jbr-ps-print-n-up-hook (&optional number-of-pages)

adding the ampersand.  Now, if I call ps-print-buffer-with-faces()
non-interactively, it works as before, which is good.  If I call
ps-print-buffer-with-faces() interactively, (with C-2, for example, I'm
assumed that the 2 will be passed interactively to my hook function), the
interactive call, is only for the immediate function which gets called,
i.e., ps-print-buffer-with-faces(), which I guess makes good sense.  I then
get prompted for a post-script filename to the buffer to be spooled to.

So, I guess the next question is:  How do I bypass the interactive property
of ps-print-buffer-with-faces(), and have my hook function be interactive?



"Kevin Rodgers" <kevinr@ihs.com> wrote in message
news:3D8608CE.9000802@ihs.com...
> Jeff Rancier wrote:
>
> > Hi all.  I wanted to create a simple function to prompt me for the n-up
> > number of pages to print when I run the function,
> > ps-print-buffer-with-faces.  Here's what I came up with:
> >
> > (defun jbr-ps-print-n-up-hook (number-of-pages)
> >   (interactive "nN-up number of pages: ")
> >   (setq ps-n-up-printing number-of-pages))
> >
> > (add-hook 'ps-print-hook 'jbr-ps-print-n-up-hook)
> >
> > I thought that was pretty straight forward.  When I select that from the
> > menu-bar, I get the following in my *Messages* buffer:
> >
> > Debugger entered--Lisp error: (wrong-number-of-arguments (lambda
> > (number-of-pages) (interactive "nN-up number of pages: ") (setq
> > ps-n-up-printing number-of-pages)) 0)
> >   jbr-ps-print-n-up-hook()
> >   run-hooks(ps-print-hook)
> >   ps-spool-with-faces(1 2947 nil)
> >   ps-print-with-faces(1 2947 nil)
> >   ps-print-buffer-with-faces(nil)
> > * call-interactively(ps-print-buffer-with-faces)
> >
> > Is that the wrong-number-of-arguments to run-hooks?  And if so, is that
a
> > bug in ps-print?  Or am I incorrectly writing my hook,
> > jbr-ps-print-n-up-hook?  I am simply calling
ps-print-buffer-with-faces()
> > incorrectly, now that it is interactive?
>
>
> Hook functions are always called with no arguments, but your function
requires
>
> one argument.  Just make it optional:
>
> (defun jbr-ps-print-n-up-hook (optional number-of-pages)
>    ...)
>
> --
> Kevin Rodgers <kevinr@ihs.com>
>

  reply	other threads:[~2002-09-16 17:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-16 15:17 Adding to ps-print-hook problems Jeff Rancier
2002-09-16 16:37 ` Kevin Rodgers
2002-09-16 17:29   ` Jeff Rancier [this message]
2002-09-16 19:39     ` Kai Großjohann
2002-09-17 11:33 ` Klaus Berndl
2002-09-17 11:51   ` Marco Lonsing

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='Axoh9.62971$xm.12776983@twister.nyroc.rr.com' \
    --to=jeff.rancier@softechnics.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).