* From formatted to table
@ 2009-09-29 14:48 andrea Crotti
2009-09-29 17:54 ` Jonathan Arkell
2009-09-29 18:21 ` Bernt Hansen
0 siblings, 2 replies; 4+ messages in thread
From: andrea Crotti @ 2009-09-29 14:48 UTC (permalink / raw
To: emacs-orgmode
I have for example a table where
| one thing | dsjfls |
| two things | dslkjfls |
| three abc dej | dsf |
And I would like to get
| one | thing | dsjfls |
| two | things | dslkjfls |
| three | abc dej | dsf |
I tried some simple substitutions but substituting all the spaces in
the region selected will cause problems elsewhere. I would need to
substitute " " only in one column, is that possible?
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: From formatted to table
2009-09-29 14:48 From formatted to table andrea Crotti
@ 2009-09-29 17:54 ` Jonathan Arkell
2009-09-29 19:07 ` Nick Dokos
2009-09-29 18:21 ` Bernt Hansen
1 sibling, 1 reply; 4+ messages in thread
From: Jonathan Arkell @ 2009-09-29 17:54 UTC (permalink / raw
To: andrea Crotti, emacs-orgmode@gnu.org
I do a macros for this
Put the point on the first word of the table
Record Macro
Search for " "
Insert "|"
Tab (next column)
Tab (first column next row
Stop Recording.
Then just C-x e (run macro) until the job is done. If you know how many lines are on the table, you can use a prefix argument with C-x e.
-----Original Message-----
From: emacs-orgmode-bounces+jonathana=criticalmass.com@gnu.org [mailto:emacs-orgmode-bounces+jonathana=criticalmass.com@gnu.org] On Behalf Of andrea Crotti
Sent: September 29, 2009 8:49 AM
To: emacs-orgmode@gnu.org
Subject: [Orgmode] From formatted to table
I have for example a table where
| one thing | dsjfls |
| two things | dslkjfls |
| three abc dej | dsf |
And I would like to get
| one | thing | dsjfls |
| two | things | dslkjfls |
| three | abc dej | dsf |
I tried some simple substitutions but substituting all the spaces in
the region selected will cause problems elsewhere. I would need to
substitute " " only in one column, is that possible?
_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode
The information contained in this message is confidential. It is intended to be read only by the individual or entity named above or their designee. If the reader of this message is not the intended recipient, you are hereby notified that any distribution of this message, in any form, is strictly prohibited. If you have received this message in error, please immediately notify the sender and delete or destroy any copy of this message.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: From formatted to table
2009-09-29 14:48 From formatted to table andrea Crotti
2009-09-29 17:54 ` Jonathan Arkell
@ 2009-09-29 18:21 ` Bernt Hansen
1 sibling, 0 replies; 4+ messages in thread
From: Bernt Hansen @ 2009-09-29 18:21 UTC (permalink / raw
To: andrea Crotti; +Cc: emacs-orgmode
andrea Crotti <andrea.crotti.0@gmail.com> writes:
> I have for example a table where
>
> | one thing | dsjfls |
> | two things | dslkjfls |
> | three abc dej | dsf |
>
> And I would like to get
>
> | one | thing | dsjfls |
> | two | things | dslkjfls |
> | three | abc dej | dsf |
>
> I tried some simple substitutions but substituting all the spaces in
> the region selected will cause problems elsewhere. I would need to
> substitute " " only in one column, is that possible?
Anything is possible in Emacs :) -- just look at org-mode!
This sounds like a use for a keyboard macro to me...
Position point on line 1 of the table
C-x (
C-s SPC C-s RET |
C-a C-n
C-x e
and repeat 'e' for every line in the table
then C-p C-c C-c to realign.
If you do this a lot you can save the macro or build a lisp function
that does it - repeating for the entire table.
HTH,
-Bernt
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: From formatted to table
2009-09-29 17:54 ` Jonathan Arkell
@ 2009-09-29 19:07 ` Nick Dokos
0 siblings, 0 replies; 4+ messages in thread
From: Nick Dokos @ 2009-09-29 19:07 UTC (permalink / raw
To: Jonathan Arkell; +Cc: emacs-orgmode@gnu.org, andrea Crotti
Jonathan Arkell <jonathana@criticalmass.com> wrote:
> I do a macros for this
>
> Put the point on the first word of the table
> Record Macro
> Search for " "
> Insert "|"
> Tab (next column)
> Tab (first column next row
> Stop Recording.
>
> Then just C-x e (run macro) until the job is done. If you know how many l=
> ines are on the table, you can use a prefix argument with C-x e.
>
>
>
> -----Original Message-----
> From: emacs-orgmode-bounces+jonathana=3Dcriticalmass.com@gnu.org [mailto:em=
> acs-orgmode-bounces+jonathana=3Dcriticalmass.com@gnu.org] On Behalf Of andr=
> ea Crotti
> Sent: September 29, 2009 8:49 AM
> To: emacs-orgmode@gnu.org
> Subject: [Orgmode] From formatted to table
>
> I have for example a table where
>
> | one thing | dsjfls |
> | two things | dslkjfls |
> | three abc dej | dsf |
>
> And I would like to get
>
> | one | thing | dsjfls |
> | two | things | dslkjfls |
> | three | abc dej | dsf |
>
> I tried some simple substitutions but substituting all the spaces in
> the region selected will cause problems elsewhere. I would need to
> substitute " " only in one column, is that possible?
>
>
Two things to add to Jonathan's answer:
o You don't have to know the length of the table: just mark the region
containing the table, C-x n n (narrow-to-region) and C-0 C-x e to repeat
the macro for ever or until an error occurs, whichever comes first :-)
Then widen: C-x n w
o Alternatively, "It's just text" (TM), so you can use a
sed/perl/awk/python/foo script to do arbitrary
transformations. Blasphemy, I know, but emacs doesn't have to do
everything.
You can even run the script from within emacs: mark the region and C-u
M-| (shell-command-on-region with the prefix argument specifying that
that output of the command is to replace the region) with the following
script
sed '/|/s/[^|] /&| /'
should do the trick. It's utterly liberating to be able to use all sorts
of different tools on your file and the single, most important advantage
of org-mode when compared to all the other systems out there.
HTH,
Nick
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-09-29 19:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-29 14:48 From formatted to table andrea Crotti
2009-09-29 17:54 ` Jonathan Arkell
2009-09-29 19:07 ` Nick Dokos
2009-09-29 18:21 ` Bernt Hansen
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.