help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Adding to ps-print-hook problems


From: Kevin Rodgers
Subject: Re: Adding to ps-print-hook problems
Date: Mon, 16 Sep 2002 10:37:34 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

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 via email to

[Prev in Thread] Current Thread [Next in Thread]