From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.help Subject: Re: fill comma separated list Date: Thu, 02 Jun 2016 16:08:54 +0000 Message-ID: References: <31550a04-e2c8-4169-9818-b392379237af@googlegroups.com> <86k2iq8a3v.fsf@student.uu.se> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1464886266 549 80.91.229.3 (2 Jun 2016 16:51:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 2 Jun 2016 16:51:06 +0000 (UTC) To: Emanuel Berg , help-gnu-emacs@gnu.org, brad.r.haack@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 02 18:51:05 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1b8Vpo-0004ln-Ay for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 18:51:04 +0200 Original-Received: from localhost ([::1]:49020 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8Vpn-0007b0-72 for geh-help-gnu-emacs@m.gmane.org; Thu, 02 Jun 2016 12:51:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52093) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8VBG-0004aq-2W for help-gnu-emacs@gnu.org; Thu, 02 Jun 2016 12:09:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b8VBA-0007sY-Rp for help-gnu-emacs@gnu.org; Thu, 02 Jun 2016 12:09:09 -0400 Original-Received: from mail-oi0-x22a.google.com ([2607:f8b0:4003:c06::22a]:36709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b8VBA-0007rR-M0 for help-gnu-emacs@gnu.org; Thu, 02 Jun 2016 12:09:04 -0400 Original-Received: by mail-oi0-x22a.google.com with SMTP id j1so84452566oih.3 for ; Thu, 02 Jun 2016 09:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=85tHPWlWq6J3f04SWhO3U4JPjVWVfrRg6QeCv1AUdj8=; b=jRUnvJFKFf9ikP8yI+xBU1pzfspAdJeNtNzBjo9eeu5G9DgCWoUTf+k/mB3nAv3wwK +qLM2jhZ2fSReHWr11QjMpwJHZvh2647R2xPCO6p+BPh+pu8Bh0Z64UADmi2LJLxz/Hw W7WoOO1mOrshXlkjGcOgvcnKzZi3UMhqKuGVPMyVA/5CPqcCRLwM/QAAzmzKFzggvXib CG6w++TcVt6jVWq7qITZIVMAj7wAWVH3I00PNYHIo9KuZnTbl6hrRyZo9zYXaJukeRAo GpcwEPmrGsFeHTlrmwuRXXfBKnzvjisq47ij1ztRbeNF5oB/LF/IfuPT0bOjDjzwLsOu B3JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=85tHPWlWq6J3f04SWhO3U4JPjVWVfrRg6QeCv1AUdj8=; b=d5mFs3zxmXe4K45vjib0FWyEo/1VNkEUrFE9PhmvhEejTfp+CBFE1Jb4E/izboHkaC NKfzkYGxcN3gcAn/hDtSoDkyv2cghV59vDvCHdMwDTAryz4jxfDkMOPkexXg13IHQApe /swgCYfqjwNG6k798HCMWR/XT1RMOXoOeB7ppBR1B4q7Xg+hXFmZZebpoa+EzWQAG+Qn 1O8WzmENhpaOZJumslLpRJWBVo6MyaeZhk876LwNOpV2SMW2k0vcYZ2l2nfY9qo99z0n Jm4LqZrzXheabjjtzCSpAp3+f00c6VfqDEj08xuIWmCSD9+4dW0cwQgAfCjNsJRJHdFA Ej1w== X-Gm-Message-State: ALyK8tLnJgsNU7UVj/CTWc+wPUSzDWcyvbBrkqYmkF7ZOH+KN19Gg2kc8WiI//gmiiJ5eojCFMnZqjQJXSySNg== X-Received: by 10.202.187.10 with SMTP id l10mr27727587oif.125.1464883743893; Thu, 02 Jun 2016 09:09:03 -0700 (PDT) In-Reply-To: <86k2iq8a3v.fsf@student.uu.se> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:4003:c06::22a X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:110258 Archived-At: 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 wrote: > papab 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