unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Andreas Politz <politza@fh-trier.de>
To: help-gnu-emacs@gnu.org
Subject: Re: ps-print variables interactive setting
Date: Thu, 04 Sep 2008 00:32:48 +0200	[thread overview]
Message-ID: <1220481354.252639@arno.fh-trier.de> (raw)
In-Reply-To: <87ej412cpw.fsf@gmail.com>

Rodolfo Medina wrote:
> Rodolfo Medina <rodolfo.medina@gmail.com> wrote:
> 
>>> I wish to define a function that prompts me more than once: let's call it
>>> `my-function': when I type `M-x my-function', in the echo area I see (just an
>>> example):
>>>
>>>  Hi, how are you today?
>>>
>>> .  Then I type, e.g., `fine RET', and again it prompts me with:
>>>
>>>  I see.  And, what did you do yesterday?
>>>
>>> ... and so on.  Then I'm going to put some `if... else' conditions over my
>>> possible answers.  Can anybody please provide some hints about how to elisp
>>> this?
> 
> 
> 
> Barry Margolin <barmar@alum.mit.edu> writes:
> 
>> (defun my-function ()
>>   (interactive)
>>   (let* ((response (read-from-minibuffer "Hi, how are you today? "))
>>          (new-prompt (format "I see, you're %s?  And where did you go 
>> yesterday?" response))
>>          (response2 (read-from-minibuffer new-prompt)))
>>     (message "I hope you enjoyed %s" response2)))
> 
> 
> Thanks, that works.
> I wish to set some ps-print variables in an interactive way, i.e. be prompted
> for the value that I want to set.  So, following Barry's hint, I put:
> 
> 
> (defun my-manage-ps-font-size ()
>   (interactive)
>   (let* ((prompt1 (read-from-minibuffer "Font size? "))
> 	 (prompt2 (format "(quote (7 . %s))" prompt1))
> 	 )
>   (setq ps-font-size prompt2)
>     )
> )
> 
> 
> , but it seems that the variable's value is put between "" and so it is not
> accepted.  I need help in this point.  Thanks to anyone still helping.
> 
> Rodolfo


Take a look at the documentation of the interactive call, it let's you
read any kind of data from the minibuffer.

(defun my-manage-ps-font-size(size string)
   (interactive "nFont size ? \nsErase all memory ? ")
   (setq ps-font-size (cons 7 size)))

This reads a number and a string.

-ap


  parent reply	other threads:[~2008-09-03 22:32 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 [this message]
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     ` A `my-ps-print-setting' function (was: ps-print variables interactive setting) Rodolfo Medina
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=1220481354.252639@arno.fh-trier.de \
    --to=politza@fh-trier.de \
    --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).