all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

* 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.
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.