unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Nordlöw <per.nordlow@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Read another with M-RET
Date: Wed, 21 Jul 2010 04:25:18 -0700 (PDT)	[thread overview]
Message-ID: <34e5f154-9ba5-4a06-8eb9-c7a891a193b7@i31g2000yqm.googlegroups.com> (raw)

How do I modify read-string-list so that RET ends loop a single read
and M-RET finishes current input and ask for another instead of the
logic given in the code below where RET finishes current and ask for
another and a final empty string (just RET) instead ends the loop?

Thanks in advance,
Nordlöw

Here's the code:

(defun read-string-list (&optional prompt uniquify)
  "Construct a list of strings interactively from minibuffer.
An empty string (RET) terminates the read loop."
  (interactive)
  (let ((sl nil))
    (let (str)
      (while (not (equal
                   (setq str (read-string
                              (concat (or prompt
                                          "String")
                                      " (or RET to end list): ")))
                   ""))
        (if uniquify
            (add-to-list 'sl str t)
          (setq sl (append sl `(,str))))
        ))
    sl))


             reply	other threads:[~2010-07-21 11:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-21 11:25 Nordlöw [this message]
2010-07-21 12:37 ` Read another with M-RET Andreas Politz
2010-07-21 14:45 ` TheFlyingDutchman
2010-07-21 20:48   ` Nordlöw

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=34e5f154-9ba5-4a06-8eb9-c7a891a193b7@i31g2000yqm.googlegroups.com \
    --to=per.nordlow@gmail.com \
    --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).