From: Kaushal Modi <kaushal.modi@gmail.com>
To: Emanuel Berg <embe8573@student.uu.se>,
help-gnu-emacs@gnu.org, brad.r.haack@gmail.com
Subject: Re: fill comma separated list
Date: Thu, 02 Jun 2016 16:08:54 +0000 [thread overview]
Message-ID: <CAFyQvY0mCb9suFmJzcXwsskBTg=f1JswGnZTqFFWC9jjvd8njw@mail.gmail.com> (raw)
In-Reply-To: <86k2iq8a3v.fsf@student.uu.se>
This works:
With this in a buffer:
5.1816,
-3.81,
4.8768,
5.1816,
-4.4196,
4.8768,
6.4008,
-4.4196,
5.48640,
6.4008,
-3.81,
5.486400;
C-x h ; Mark whole buffer
C-u M-| ; Run shell-command-on-region and replace region with results
paste -d' ' - - -
Do 'man paste' to learn more about that.
On Thu, Jun 2, 2016 at 11:50 AM Emanuel Berg <embe8573@student.uu.se> wrote:
> papab <brad.r.haack@gmail.com> writes:
>
> > I have a whole bunch of sequences of numbers,
> > like this: 5.1816, -3.81, 4.8768, 5.1816,
> > -4.4196, 4.8768, 6.4008, -4.4196, 5.48640,
> > 6.4008, -3.81, 5.486400;
> >
> > I'd like to be able to make it look like this
> > easily: 5.1816, -3.81, 4.8768, 5.1816,
> > -4.4196, 4.8768, 6.4008, -4.4196, 5.486400,
> > 6.4008, -3.81, 5.48640
> >
> > 3 numbers per row. Suggestions?
> > Some variation of fill-paragraph?
>
> You want to separate data, programming
> (modification of the data), and interface
> (display of the result).
>
> Here, there is no modification of the data, but
> you still want the display (interface) to be
> programmable, as sometime in the future perhaps
> you want four data items per row and then it'll
> be super-fast to change the digit 3 into a 4
> with no other change necessary!
>
> This is called MVC but what happens when people
> explain and/or define that is that everyone
> gets confused and irritated. But it is
> actually simple!
>
> So if you understood my description as I think
> you did, *don't* read the Wikipedia article on
> MVC! [1]
>
> I'd do:
>
> 1. Put the data in a text file with no
> commas and one and only one data item
> per line.
>
> 2. Write a defun that reads that into
> a Lisp list.
>
> 3. Write a defun that iterates the list and
> prints a newline for every X items, 3 in
> your case.
>
> Tell me if you need help with any of those
> steps :)
>
> [1] Hey, I told you not to read it!
>
> --
> underground experts united .... http://user.it.uu.se/~embe8573
> Emacs Gnus Blogomatic ......... http://user.it.uu.se/~embe8573/blogomatic
> - so far: 34 Blogomatic articles -
>
--
--
Kaushal Modi
next prev parent reply other threads:[~2016-06-02 16:08 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-19 13:02 fill comma separated list papab
2016-05-19 13:12 ` Emanuel Berg
2016-06-02 16:08 ` Kaushal Modi [this message]
[not found] ` <mailman.702.1464883755.1216.help-gnu-emacs@gnu.org>
2016-06-02 17:11 ` Emanuel Berg
2016-06-02 16:41 ` Jorge A. Alfaro-Murillo
2016-06-02 17:47 ` Kaushal Modi
2016-06-02 18:36 ` Jorge A. Alfaro-Murillo
2016-06-02 18:50 ` Jorge A. Alfaro-Murillo
2016-06-02 19:06 ` Kaushal Modi
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='CAFyQvY0mCb9suFmJzcXwsskBTg=f1JswGnZTqFFWC9jjvd8njw@mail.gmail.com' \
--to=kaushal.modi@gmail.com \
--cc=brad.r.haack@gmail.com \
--cc=embe8573@student.uu.se \
--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.