unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Rodolfo Medina'" <rodolfo.medina@gmail.com>, <help-gnu-emacs@gnu.org>
Subject: RE: An elisp question
Date: Tue, 16 Sep 2008 13:09:59 -0700	[thread overview]
Message-ID: <001f01c91838$32b44540$0200a8c0@us.oracle.com> (raw)
In-Reply-To: <87zlm7alrq.fsf@gmail.com>

> I have a set of `setq' conditions that I wish to group into a 
> function and put inside another function:
> 
> (defun my-test ()
>   (interactive)
>   (if (equal (y-or-n-p "Yes or no? ") t)
>       (setq ps-print-footer t
> 	    ps-print-footer-frame nil
> 	    ps-top-margin 18
> 	    ps-bottom-margin 5
> 	    ps-left-margin 9
> 	    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 0
> 	    )
>     (message "hallo")))
> 
> How can I group all those `setq' conditions into a function 
> and put that function name in place of them in `my-test'
> definition?

(defun foo ()
  (setq ps-print-footer t
	  ps-print-footer-frame nil
	  ps-top-margin 18
	  ps-bottom-margin 5
	  ps-left-margin 9
	  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 0))

(defun my-test ()
  (interactive)
  (if (equal (y-or-n-p "Yes or no? ") t)
      (foo)
    (message "hallo")))

Is this some kind of homework assignment? ;-)






  reply	other threads:[~2008-09-16 20:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-16 20:17 An elisp question Rodolfo Medina
2008-09-16 20:09 ` Drew Adams [this message]
     [not found] ` <mailman.19376.1221595777.18990.help-gnu-emacs@gnu.org>
2008-09-16 20:20   ` Joost Kremers
2008-09-16 20:51     ` Drew Adams
     [not found]     ` <mailman.19377.1221598264.18990.help-gnu-emacs@gnu.org>
2008-09-17 18:29       ` Oleksandr Gavenko
2008-09-17 21:05         ` Joost Kremers
2008-09-18  8:06         ` Bastien
2008-09-19 16:13         ` Nikolaj Schumacher
     [not found]         ` <mailman.19562.1221840826.18990.help-gnu-emacs@gnu.org>
2008-09-19 18:17           ` Oleksandr Gavenko

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='001f01c91838$32b44540$0200a8c0@us.oracle.com' \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=rodolfo.medina@gmail.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).