From: brian powell <briangpowellms@gmail.com>
To: Juan Pechiar <juan@pechiar.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: Sorting table columns (*not* content)
Date: Mon, 1 Nov 2010 11:39:53 -0400 [thread overview]
Message-ID: <AANLkTineAcbqgubTBt-u6L_R-kDi2A_cOfrDG2KPVjf-@mail.gmail.com> (raw)
In-Reply-To: <20101101144342.GA2450@soloJazz.com>
[-- Attachment #1.1: Type: text/plain, Size: 2044 bytes --]
Jeff Horn seems to be explaining specifics of how to do some nitty-gritty
manipulations--he mentions (quoting the manual) methods for yanking, Ccxy
The methods Jeff expressed are useful for the question posed.
I recommend rectangle-kill and rectangle-yank--Cxrk and Cxry to solve this
(in a very simple albeit possibly faster or slower way--depending on how
many columns you want to move/sort---moving column/rectangle 3 to the 3rd
position in this case--took a few seconds)
I tested Juan's method/defun---works grrrrreat!!
Thanks Juan
P.S. I did lose the hlines like you reported; but, to put the line back was
3 key strokes: |-Tab
On Mon, Nov 1, 2010 at 10:43 AM, Juan Pechiar <juan@pechiar.com> wrote:
> If you don't mind losing h-lines, you can transpose the table, sort
> rows, and transpose back.
>
> This code (which I previously posted to the list) transposes a table:
>
> #+begin_src: emacs-lisp
>
> (defun org-transpose-table-at-point ()
> "Transpose orgmode table at point, eliminate hlines"
> (interactive)
> (let ((contents (apply #'mapcar* #'list
> (remove-if-not 'listp ;; remove 'hline from list
> (org-table-to-lisp)))) ;; signals
> error if not table
> )
> (delete-region (org-table-begin) (org-table-end))
> (insert (mapconcat (lambda(x) (concat "| " (mapconcat 'identity x " | "
> ) " |\n" ))
> contents
> ""))
> (org-table-align)
> )
> )
>
> #+end_src
>
> Regards,
> .j.
>
> On Mon, Nov 01, 2010 at 02:42:55PM +0100, Gary wrote:
> > Is there any way to sort the columns of a table, such that for example
> >
> > | Col 3 | Col 1 | Col 2 |
> >
> > can be converted to
> >
> > | Col 1 | Col 2 | Col 3 |
> > |-------+-------+-------|
> > | ... | ... | ... |
> >
> > ?
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
[-- Attachment #1.2: Type: text/html, Size: 2847 bytes --]
[-- Attachment #2: Type: text/plain, Size: 201 bytes --]
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
next prev parent reply other threads:[~2010-11-01 15:40 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-01 13:42 Sorting table columns (*not* content) Gary
2010-11-01 13:52 ` Jeff Horn
2010-11-01 14:15 ` Gary
2010-11-01 15:09 ` Jeff Horn
2010-11-01 19:44 ` Carsten Dominik
2010-11-02 11:05 ` Gary
2010-11-01 19:02 ` Christian Moe
2010-11-01 19:27 ` brian powell
2010-11-01 14:43 ` Juan Pechiar
2010-11-01 15:33 ` Gary
2010-11-01 15:39 ` brian powell [this message]
2010-11-01 17:47 ` Dan Davison
2010-11-01 18:44 ` brian powell
2010-11-02 11:03 ` Gary
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.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=AANLkTineAcbqgubTBt-u6L_R-kDi2A_cOfrDG2KPVjf-@mail.gmail.com \
--to=briangpowellms@gmail.com \
--cc=emacs-orgmode@gnu.org \
--cc=juan@pechiar.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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).