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

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

RE: An elisp question


From: Drew Adams
Subject: RE: An elisp question
Date: Tue, 16 Sep 2008 13:09:59 -0700

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

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