all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Read another with M-RET
@ 2010-07-21 11:25 Nordlöw
  2010-07-21 12:37 ` Andreas Politz
  2010-07-21 14:45 ` TheFlyingDutchman
  0 siblings, 2 replies; 4+ messages in thread
From: Nordlöw @ 2010-07-21 11:25 UTC (permalink / raw)
  To: help-gnu-emacs

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))


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-07-21 20:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-21 11:25 Read another with M-RET Nordlöw
2010-07-21 12:37 ` Andreas Politz
2010-07-21 14:45 ` TheFlyingDutchman
2010-07-21 20:48   ` Nordlöw

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.