emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Michael Brand <michael.ch.brand@gmail.com>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Small improvement of maintainability of link escaping
Date: Sat, 5 Oct 2013 15:04:06 +0200	[thread overview]
Message-ID: <CALn3zogi05x=n-DQX4J9sdptDC0r3jfrrKev=LVbrzz-Q6mAOA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 232 bytes --]

Hi all

I would like to ask to review and apply the attached patch. It is to
have a timely separatation from a related change that I will suggest
with an ERT in a later patch: Just add "+" to
org-link-escape-chars-browser.

Michael

[-- 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)


             reply	other threads:[~2013-10-05 13:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-05 13:04 Michael Brand [this message]
2013-10-05 13:31 ` [PATCH] Small improvement of maintainability of link escaping Michael Brand
2013-10-16 13:49   ` Michael Brand
2013-10-17  5:02     ` Carsten Dominik
2013-11-17 12:04 ` Michael Brand

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='CALn3zogi05x=n-DQX4J9sdptDC0r3jfrrKev=LVbrzz-Q6mAOA@mail.gmail.com' \
    --to=michael.ch.brand@gmail.com \
    --cc=emacs-orgmode@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 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).