* [PATCH] org-table-transpose-table-at-point: Preserve indentation and point
@ 2013-09-30 18:35 Michael Brand
2013-10-08 7:40 ` Michael Brand
0 siblings, 1 reply; 4+ messages in thread
From: Michael Brand @ 2013-09-30 18:35 UTC (permalink / raw)
To: Org Mode
[-- Attachment #1: Type: text/plain, Size: 329 bytes --]
Hi all
On Mon, Sep 30, 2013 at 8:30 PM, Michael Brand
<michael.ch.brand@gmail.com> wrote:
> http://orgmode.org/worg/org-hacks.html#field-same-row-or-column
For the use case of org-table-transpose-table-at-point there, I made a
patch for org-table-transpose-table-at-point to preserve indentation
and point after transposition.
[-- Attachment #2: 0001-org-table-transpose-table-at-point-Preserve-indentat.patch.txt --]
[-- Type: text/plain, Size: 2090 bytes --]
From 119aad10f2144a1397f2b034bef46dc891dbae5a Mon Sep 17 00:00:00 2001
From: Michael Brand <michael.ch.brand@gmail.com>
Date: Mon, 30 Sep 2013 20:32:29 +0200
Subject: [PATCH] org-table-transpose-table-at-point: Preserve indentation and
point
* lisp/org-table.el (org-table-transpose-table-at-point): Preserve
indentatinon of first row. Restore point to transposed field in
transposed table.
---
lisp/org-table.el | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/lisp/org-table.el b/lisp/org-table.el
index 5bc754c..7be77cc 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -1834,7 +1834,7 @@ blindly applies a recipe that works for simple tables."
(goto-char beg)))))
(defun org-table-transpose-table-at-point ()
- "Transpose orgmode table at point and eliminate hlines.
+ "Transpose Org table at point and eliminate hlines.
So a table like
| 1 | 2 | 4 | 5 |
@@ -1849,9 +1849,11 @@ will be transposed as
| 4 | c | g |
| 5 | d | h |
-Note that horizontal lines disappeared."
+Note that horizontal lines disappear."
(interactive)
(let* ((table (delete 'hline (org-table-to-lisp)))
+ (dline_old (org-table-current-line))
+ (col_old (org-table-current-column))
(contents (mapcar (lambda (p)
(let ((tp table))
(mapcar
@@ -1861,10 +1863,17 @@ Note that horizontal lines disappeared."
(setq tp (cdr tp))))
table)))
(car table))))
- (delete-region (org-table-begin) (org-table-end))
- (insert (mapconcat (lambda(x) (concat "| " (mapconcat 'identity x " | " ) " |\n" ))
- contents ""))
- (org-table-align)))
+ (goto-char (org-table-begin))
+ (re-search-forward "|")
+ (backward-char)
+ (delete-region (point) (org-table-end))
+ (insert (mapconcat
+ (lambda(x)
+ (concat "| " (mapconcat 'identity x " | " ) " |\n" ))
+ contents ""))
+ (org-table-goto-line col_old)
+ (org-table-goto-column dline_old))
+ (org-table-align))
;;;###autoload
(defun org-table-wrap-region (arg)
--
1.7.12.4 (Apple Git-37)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] org-table-transpose-table-at-point: Preserve indentation and point
2013-09-30 18:35 [PATCH] org-table-transpose-table-at-point: Preserve indentation and point Michael Brand
@ 2013-10-08 7:40 ` Michael Brand
2013-10-15 14:46 ` Michael Brand
0 siblings, 1 reply; 4+ messages in thread
From: Michael Brand @ 2013-10-08 7:40 UTC (permalink / raw)
To: Org Mode
Hi all
I would like to remind to review and apply the previously attached patch.
On Mon, Sep 30, 2013 at 8:35 PM, Michael Brand
<michael.ch.brand@gmail.com> wrote:
> On Mon, Sep 30, 2013 at 8:30 PM, Michael Brand
> <michael.ch.brand@gmail.com> wrote:
>> http://orgmode.org/worg/org-hacks.html#field-same-row-or-column
>
> For the use case of org-table-transpose-table-at-point there, I made a
> patch for org-table-transpose-table-at-point to preserve indentation
> and point after transposition.
Michael
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] org-table-transpose-table-at-point: Preserve indentation and point
2013-10-08 7:40 ` Michael Brand
@ 2013-10-15 14:46 ` Michael Brand
2013-10-15 14:49 ` Carsten Dominik
0 siblings, 1 reply; 4+ messages in thread
From: Michael Brand @ 2013-10-15 14:46 UTC (permalink / raw)
To: Carsten Dominik, Bastien, Nicolas Goaziou; +Cc: Org Mode
Hi Carsten, Bastien and Nicolas
On Tue, Oct 8, 2013 at 9:40 AM, Michael Brand
<michael.ch.brand@gmail.com> wrote:
> On Mon, Sep 30, 2013 at 8:35 PM, Michael Brand
> <michael.ch.brand@gmail.com> wrote:
>> For the use case of org-table-transpose-table-at-point there, I made a
>> patch for org-table-transpose-table-at-point to preserve indentation
>> and point after transposition.
>
> I would like to remind to review and apply the previously attached patch.
I would like to remind to review and apply the patch attached on
[2013-09-30 Mon] to this thread.
Michael
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] org-table-transpose-table-at-point: Preserve indentation and point
2013-10-15 14:46 ` Michael Brand
@ 2013-10-15 14:49 ` Carsten Dominik
0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2013-10-15 14:49 UTC (permalink / raw)
To: Michael Brand; +Cc: Bastien, Org Mode, Nicolas Goaziou
[-- Attachment #1: Type: text/plain, Size: 809 bytes --]
Hi Michael,
thank you for the reminder, sorry for the delay.
The patch has been applied now.
- Carsten
On Oct 15, 2013, at 4:46 PM, Michael Brand <michael.ch.brand@gmail.com> wrote:
> Hi Carsten, Bastien and Nicolas
>
> On Tue, Oct 8, 2013 at 9:40 AM, Michael Brand
> <michael.ch.brand@gmail.com> wrote:
>> On Mon, Sep 30, 2013 at 8:35 PM, Michael Brand
>> <michael.ch.brand@gmail.com> wrote:
>>> For the use case of org-table-transpose-table-at-point there, I made a
>>> patch for org-table-transpose-table-at-point to preserve indentation
>>> and point after transposition.
>>
>> I would like to remind to review and apply the previously attached patch.
>
> I would like to remind to review and apply the patch attached on
> [2013-09-30 Mon] to this thread.
>
> Michael
[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 455 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-15 14:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-30 18:35 [PATCH] org-table-transpose-table-at-point: Preserve indentation and point Michael Brand
2013-10-08 7:40 ` Michael Brand
2013-10-15 14:46 ` Michael Brand
2013-10-15 14:49 ` Carsten Dominik
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).