unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Rodolfo Medina <rodolfo.medina@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: A `my-ps-print-setting' function (was: ps-print variables interactive setting)
Date: Sun, 07 Sep 2008 17:44:26 +0100	[thread overview]
Message-ID: <87fxobgb2t.fsf@gmail.com> (raw)
In-Reply-To: 87ej412cpw.fsf@gmail.com

Rodolfo Medina <rodolfo.medina@gmail.com> writes:

> [...] I wish to set some ps-print variables in an interactive way, i.e. be
> prompted for the value that I want to set.



With the help that came from this list, I defined a `my-ps-print-setting'
function, that I'm reporting below.  Improvements are welcome: in particular
I wish it said: "please answer `r' or `l'" when prompting for a right or left
footer and the answer is neither r nor l.  Besides, I wish to have
automatically odd page numbers in the right footer and even page numbers in
the left footer.  But I'm starting a new thread for that.

bye
Rodolfo



(defun my-ps-print-setting ()
  "Prompts for some ps print settings.
Other settings are inside the function definition
and can be changed at pleasure."
  (interactive)
  (if (equal (y-or-n-p "Do you want footer? ") t)
      (let (key val)
	(while (progn
		 (setq key
		       (let ((cursor-in-echo-area t))
			 (read-char
			  (format "right or left? "))))
		 (not (memq key '(?r ?l)))))
	(if (eq key ?r)
	    (if (equal (y-or-n-p "So, you want right footer.  \
Do you want the default footer? ") nil)
		(let ((my-page-number (read-string 
				       "Enter the footer you want: ")))
		  (setq ps-right-footer (list (concat "(" my-page-number ")"))
			ps-print-footer t
			ps-print-footer-frame nil
			ps-top-margin 20
			ps-bottom-margin 5
			ps-left-margin 10
			ps-right-margin 7
			ps-print-header nil
			ps-show-n-of-n nil
			ps-print-footer-frame nil
			ps-footer-lines 1
			ps-left-footer (quote ( ))
			ps-footer-offset -10))
	      (setq ps-right-footer (quote ("/pagenumberstring load"))
		    ps-print-footer t
		    ps-print-footer-frame nil
		    ps-top-margin 20
		    ps-bottom-margin 5
		    ps-left-margin 10
		    ps-right-margin 7
		    ps-print-header nil
		    ps-show-n-of-n nil
		    ps-print-footer-frame nil
		    ps-footer-lines 1
		    ps-left-footer (quote ( ))
		    ps-footer-offset -10))
	  (if (equal (y-or-n-p "So, you want left footer.  \
Do you want the default footer? ") nil)
	      (let ((my-page-number (read-string 
				     "Enter the footer you want: ")))
		(setq ps-left-footer (list (concat "(" my-page-number ")"))
		      ps-print-footer t
		      ps-print-footer-frame nil
		      ps-top-margin 20
		      ps-bottom-margin 5
		      ps-left-margin 10
		      ps-right-margin 7
		      ps-print-header nil
		      ps-show-n-of-n nil
		      ps-print-footer-frame nil
		      ps-footer-lines 1
		      ps-right-footer (quote ( ))
		      ps-footer-offset -10))
	    (setq ps-left-footer (quote ("/pagenumberstring load"))
		  ps-print-footer t
		  ps-print-footer-frame nil
		  ps-top-margin 20
		  ps-bottom-margin 5
		  ps-left-margin 10
		  ps-right-margin 7
		  ps-print-header nil
		  ps-show-n-of-n nil
		  ps-print-footer-frame nil
		  ps-footer-lines 1
		  ps-right-footer (quote ( ))
		  ps-footer-offset -10))
	  ))
    (setq ps-print-footer nil
					;	  ps-top-margin 10
	  ps-top-margin 5
	  ps-bottom-margin 0
	  ps-left-margin 10
	  ps-right-margin 0
	  ps-print-header nil
	  ps-print-footer nil))    
  (let ((font-size (read-number "What font size do you want? ")))
    (setq ps-font-size (cons 7 font-size)))
  (if (equal ps-font-size '(7 . 9.5))
      (setq-default fill-column 101))
  (if (equal ps-font-size '(7 . 12))
      (setq-default fill-column 78))
  )


  parent reply	other threads:[~2008-09-07 16:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-03  0:21 How to define a `multiple prompt' function? Rodolfo Medina
2008-09-03  4:08 ` Barry Margolin
2008-09-03 20:31   ` ps-print variables interactive setting (was: How to define a `multiple prompt' function?) Rodolfo Medina
2008-09-03 19:51     ` ps-print variables interactive setting Lennart Borgman (gmail)
2008-09-03 22:32     ` Andreas Politz
2008-09-04 17:24       ` `are-you-fine' function definition (was: ps-print variables interactive setting) Rodolfo Medina
2008-09-05  2:18         ` `are-you-fine' function definition Kevin Rodgers
     [not found]         ` <mailman.18482.1220581140.18990.help-gnu-emacs@gnu.org>
2008-09-06 16:27           ` Rodolfo Medina
2008-09-06 16:32             ` `y-or-n-p' function definition (was: `are-you-fine' function definition) Rodolfo Medina
2008-09-08 10:14               ` `y-or-n-p' function definition Nikolaj Schumacher
2008-09-04 21:47     ` ps-right-footer interactive setting (was: ps-print variables interactive setting) Rodolfo Medina
2008-09-05  1:19       ` Barry Margolin
2008-09-05 10:21         ` ps-right-footer interactive setting Rodolfo Medina
2008-09-05 19:21           ` Chetan
2008-09-06 16:28             ` Rodolfo Medina
2008-09-07 16:44     ` Rodolfo Medina [this message]
2008-09-07 19:40       ` A `my-ps-print-setting' function Andreas Politz
2008-09-08  1:18         ` defchoice macro (was: A `my-ps-print-setting' function) Rodolfo Medina
2008-09-03 19:43 ` How to define a `multiple prompt' function? Evans Winner

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=87fxobgb2t.fsf@gmail.com \
    --to=rodolfo.medina@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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).