From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rodolfo Medina Newsgroups: gmane.emacs.help Subject: A `my-ps-print-setting' function (was: ps-print variables interactive setting) Date: Sun, 07 Sep 2008 17:44:26 +0100 Organization: SunSITE.dk - Supporting Open source Message-ID: <87fxobgb2t.fsf@gmail.com> References: <87ej42m64o.fsf@gmail.com> <87ej412cpw.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1220805650 17581 80.91.229.12 (7 Sep 2008 16:40:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 7 Sep 2008 16:40:50 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Sep 07 18:41:45 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KcNKW-0000iZ-IY for geh-help-gnu-emacs@m.gmane.org; Sun, 07 Sep 2008 18:41:40 +0200 Original-Received: from localhost ([127.0.0.1]:44673 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KcNJW-0001Sh-Qh for geh-help-gnu-emacs@m.gmane.org; Sun, 07 Sep 2008 12:40:38 -0400 Original-Path: news.stanford.edu!newsfeed.stanford.edu!goblin1!goblin2!goblin.stu.neva.ru!news.net.uni-c.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:4uaJvpf4uHJ8GVoy7byMLDW+DR8= Original-Lines: 109 Original-NNTP-Posting-Host: 151.80.200.39 Original-X-Trace: news.sunsite.dk DXC=fN; NO\c]CX2OVgHIS4l:13YSB=nbEKnk; 4mi>jDOWoH7:AocXk=\=_4T7bXfBO; G:5KAib\KDO`h2m=c5DAkLCD<@; 9@; 1ofkX5oRFj4oedVA5 Original-X-Complaints-To: staff@sunsite.dk Original-Xref: news.stanford.edu gnu.emacs.help:161979 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:57322 Archived-At: Rodolfo Medina 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)) )