* Adding to ps-print-hook problems
@ 2002-09-16 15:17 Jeff Rancier
2002-09-16 16:37 ` Kevin Rodgers
2002-09-17 11:33 ` Klaus Berndl
0 siblings, 2 replies; 6+ messages in thread
From: Jeff Rancier @ 2002-09-16 15:17 UTC (permalink / raw)
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?
Jeff
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Adding to ps-print-hook problems
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
2002-09-17 11:33 ` Klaus Berndl
1 sibling, 1 reply; 6+ messages in thread
From: Kevin Rodgers @ 2002-09-16 16:37 UTC (permalink / raw)
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>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Adding to ps-print-hook problems
2002-09-16 16:37 ` Kevin Rodgers
@ 2002-09-16 17:29 ` Jeff Rancier
2002-09-16 19:39 ` Kai Großjohann
0 siblings, 1 reply; 6+ messages in thread
From: Jeff Rancier @ 2002-09-16 17:29 UTC (permalink / raw)
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>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Adding to ps-print-hook problems
2002-09-16 17:29 ` Jeff Rancier
@ 2002-09-16 19:39 ` Kai Großjohann
0 siblings, 0 replies; 6+ messages in thread
From: Kai Großjohann @ 2002-09-16 19:39 UTC (permalink / raw)
"Jeff Rancier" <jeff.rancier@softechnics.com> writes:
> 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?
You can have your hook function ask the user explicitly, rather than
via the `interactive' spec. See read-from-minibuffer,
completing-read, and friends.
kai
--
~/.signature is: umop 3p!sdn (Frank Nobis)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Adding to ps-print-hook problems
2002-09-16 15:17 Adding to ps-print-hook problems Jeff Rancier
2002-09-16 16:37 ` Kevin Rodgers
@ 2002-09-17 11:33 ` Klaus Berndl
2002-09-17 11:51 ` Marco Lonsing
1 sibling, 1 reply; 6+ messages in thread
From: Klaus Berndl @ 2002-09-17 11:33 UTC (permalink / raw)
On Mon, 16 Sep 2002, 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))
I would strongly recommend the package printing.el from the author of ps-print
which offers you a great interface (keyboard and mouse!) for all the ps-print
stuff and much more. IMHO the combination of printing.el and ps-print.el
really rocks. And IMHO i do not understand why printing.el is not in the
distribution of Emacs 21.X?!
Get it from http://www.cpqd.com.br/~vinicius/emacs/.
This package offer you a function pr-ps-fast-fire which does pretty what you
want!
If you have problems with configuring printing.el i can send you my
configuration...
Ciao,
Klaus
>
> (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?
>
> Jeff
--
Klaus Berndl mailto: klaus.berndl@sdm.de
sd&m AG http://www.sdm.de
software design & management
Thomas-Dehler-Str. 27, 81737 München, Germany
Tel +49 89 63812-392, Fax -220
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Adding to ps-print-hook problems
2002-09-17 11:33 ` Klaus Berndl
@ 2002-09-17 11:51 ` Marco Lonsing
0 siblings, 0 replies; 6+ messages in thread
From: Marco Lonsing @ 2002-09-17 11:51 UTC (permalink / raw)
Klaus Berndl <Klaus.Berndl@raibau.raiffeisen.at> writes:
> I would strongly recommend the package printing.el from the author of ps-print
> which offers you a great interface (keyboard and mouse!) for all the ps-print
> stuff and much more. IMHO the combination of printing.el and ps-print.el
> really rocks. And IMHO i do not understand why printing.el is not in the
> distribution of Emacs 21.X?!
Vinicius told me that printing.el will be part of GNU Emacs
distribution soon. There were some problems regarding CVS Emacs which
have been resolved with the latest version v6.6.6
Marco
--
Marco Lonsing
Mathematik XI - Numerik email: Marco.Lonsing@ruhr-uni-bochum.de
Ruhr-Universitaet Bochum phone: +49-234-32-23244
Universitaetsstr. 150 fax : +49-234-32-03244
D-44721 Bochum, GERMANY www : http://www.ruhr-uni-bochum.de/num1/marco/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-09-17 11:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2002-09-16 19:39 ` Kai Großjohann
2002-09-17 11:33 ` Klaus Berndl
2002-09-17 11:51 ` Marco Lonsing
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.