Question

I have an Emacs org mode table that looks like this:

 |--------------------------------+------------------------------------------------------|
 | <20>                           | <60>                                                 |
 | How do you alter your password | The command to alter your password in oracle is::    |
 | in Oracle?                     |                                                      |
 |                                |     ALTER USER {userid} IDENTIFIED BY {password};    |
 |                                |                                                      |
 |--------------------------------+------------------------------------------------------|

When the table is resized with C-c C-c i.e. with keyboard shortcut: Ctrl-C + Ctrl-C, or automatically, it ruins the spacing inside of the table elements and I get:

 |--------------------------------+------------------------------------------------------|
 | <20>                           | <60>                                                 |
 | How do you alter your password | The command to alter your password in oracle is::    |
 | in Oracle?                     |                                                      |
 |                                | ALTER USER {userid} IDENTIFIED BY {password};        |
 |                                |                                                      |
 |--------------------------------+------------------------------------------------------|

It automatically trims the leading spaces from the content in the table. Is there a way to prevent this in org mode tables? I want org mode to not change the formatting of the content.

This is with Emacs version 24.3.50, but the behavior is the same in version 24.2 (I tried in both versions).

No correct solution

OTHER TIPS

A really hack-ish way to work around it is to redefine or defadvice around org-table-align. The relevant snippet is roughly around here. By changing * to ?, you'll keep the spaces at the beginning.

--- ./org-table.el
+++ ./org-table.el.orig
@@ -752,7 +752,7 @@
     ;; Get the data fields by splitting the lines.
     (setq fields (mapcar
          (lambda (l)
-           (org-split-string l " *| *"))
+           (org-split-string l " *| ?"))
          (delq nil (copy-sequence lines))))
     ;; How many fields in the longest line?
     (condition-case nil

I'm not sure if you really want to do that, though. Would you consider restructuring your markup, perhaps by using headings instead, with a custom markup function in case you really need it to look like tables afterwards? If that makes you boggle, another way to accomplish that might be with #+BEGIN_HTML and #+END_HTML blocks. Not elegant, but ah well...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top