all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Peter Dyballa <Peter_Dyballa@Web.DE>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to prompt for string?
Date: Fri, 17 Feb 2006 20:58:01 +0100	[thread overview]
Message-ID: <42E80D4C-46A4-4100-8B96-DD3FF0AC21AE@Web.DE> (raw)
In-Reply-To: <1140152334.515131.156650@g43g2000cwa.googlegroups.com>


Am 17.02.2006 um 05:58 schrieb jacksneckhurts@yahoo.com:

> I'm trying to teach myself emacs Lisp, but can't figure out how to
> prompt for a string. I found the "read-key-sequence-vector" function,
> but that only takes in one character. Does anyone know how to prompt
> for a string?

Yes, there seem to be a few! I remember that calendar prompts me a  
few times when I want to go to some date. And there are these  
functions to change an encoding, C-x RET f for example. Let's see how  
they do it!

C-h k C-x RET f opens a *Help* buffer with a hyper link to mule.el. I  
follow it. Oufff, it opens in another window! I do not need to  
remember the function's name! Oh -- the cursor is already positioned  
at the function's start ... shall I manage to remember this  
behaviour? But, what is a life without constant sorrows?! I'm glad  
that I've chosen a bad example: no obvious output or input, but ...  
it's prompting me with "Coding system for saving file (default nil):  
" -- let's search for this sentence! Ah, there it is -- the first  
line of code of this function set-buffer-file-coding-system, very  
strange:

   (interactive "zCoding system for saving file (default nil): \nP")


OK, that's one guess. Let's see how a veteran does it in Calendar!   
(interactive (list (calendar-read-date))) -- a function in  
calendar.el. Hey, GNU Emacs even takes me to my private copy with  
German text! Here two functions, calendar-read and completing-read  
are doing the job of prompting, while taking the first argument as  
the prompt's text. The first one uses (read-minibuffer prompt initial- 
contents), the latter uses a function in `C source code'. (completing- 
read PROMPT TABLE &optional PREDICATE REQUIRE-MATCH INITIAL-INPUT  
HIST DEF INHERIT-INPUT-METHOD). Aha.


Two "applications" and three ways to prompt for an input! That's  
efficiency.

--
Greetings

   Pete

Got Mole problems?
Call Avogadro 6.02 x 10^23

  parent reply	other threads:[~2006-02-17 19:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-17  4:58 How to prompt for string? jacksneckhurts
2006-02-17  5:50 ` Pascal Bourguignon
2006-02-17  7:00   ` jacksneckhurts
2006-02-17 18:18     ` Kevin Rodgers
2006-02-17 16:18   ` Dirk-Jan.Binnema
2006-02-17 16:44 ` Kevin Rodgers
2006-02-17 19:58 ` Peter Dyballa [this message]
2006-02-18  7:24   ` Drew Adams

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=42E80D4C-46A4-4100-8B96-DD3FF0AC21AE@Web.DE \
    --to=peter_dyballa@web.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.