[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Fwd: comment lines inside org tables
From: |
Rolf Sander |
Subject: |
Re: [O] Fwd: comment lines inside org tables |
Date: |
Fri, 30 Sep 2016 16:52:43 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
Hello Nicolas,
Then I don't understand what you really want. You want to comment a
row, but it's not clear wrt to what action.
I want to add a comment line into the file that does not disturb the
table. Like a "|---+---+---|" hline. I don't want any action. All
programming languages have the option to add comments to the source
code. The comment does not trigger any action, and the result of
executing the code is the same, whether with or without comment lines.
It would be nice if org-tbl would allow comment lines as well.
Anyway, in the general case, there is no way to comment a row.
Okay, so my question turns into a feature request now...
I have started to modify defun org-table-align. With the modification,
org-tbl now ignores all lines starting with "|-/". For me it works fine.
However, please let me know if you see any side-effects. You can
download the full defun here:
http://www.rolf-sander.net/tmp/org-table-align-new.el
And here is a diff to the original code:
*******************************************************
diff -U 1 org-table-align-old.el org-table-align-new.el
@@ -63,4 +63,12 @@
;; At the same time, we remove trailing space.
+ (setq lines0 (mapcar (lambda (l)
+ (cond ((string-match "^ *|-" l)
+ nil)
+ ((string-match "[ \t]+$" l)
+ (substring l 0 (match-beginning 0)))
+ (t l))
+ )
+ lines))
(setq lines (mapcar (lambda (l)
- (if (string-match "^ *|-" l)
+ (if (string-match "^ *|-\\($\\|[^/]\\)" l)
nil
@@ -74,3 +82,3 @@
(org-split-string l " *| *"))
- (delq nil (copy-sequence lines))))
+ (delq nil (copy-sequence lines0))))
;; How many fields in the longest line?
@@ -164,5 +172,9 @@
(lambda (l)
- (if l (apply 'format rfmt
- (append (pop fields) emptystrings))
- hfmt))
+ (cond ((eq l nil)
+ hfmt)
+ ((string-match "^ *|-/" l)
+ (concat l "\n"))
+ (t
+ (apply 'format rfmt
+ (append (pop fields) emptystrings)))))
lines ""))
*******************************************************
Best regards
Rolf
--
-----------------------------------------------------------------------
Rolf Sander phone: [+49] 6131/305-4610
Max-Planck Institute of Chemistry email: address@hidden
PO Box 3060, 55020 Mainz, Germany homepage: www.rolf-sander.net
-----------------------------------------------------------------------
www.atmospheric-chemistry-and-physics.net
www.geoscientific-model-development.net
-----------------------------------------------------------------------