emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rolf Sander <rolf.sander@mpic.de>
To: emacs-orgmode@gnu.org
Subject: Re: Fwd: comment lines inside org tables
Date: Fri, 30 Sep 2016 16:52:43 +0200	[thread overview]
Message-ID: <ef074eb6-57dc-71ef-5310-ce83bc11b058@mpic.de> (raw)
In-Reply-To: <87bmz910up.fsf@nicolasgoaziou.fr>

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: rolf.sander@mpic.de
   PO Box 3060, 55020 Mainz, Germany     homepage: www.rolf-sander.net
-----------------------------------------------------------------------
                www.atmospheric-chemistry-and-physics.net
                 www.geoscientific-model-development.net
-----------------------------------------------------------------------

  reply	other threads:[~2016-09-30 14:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-27  8:05 comment lines inside org tables Rolf Sander (MPI)
2016-09-27 10:56 ` Fwd: " Rolf Sander (MPI)
2016-09-27 11:31   ` Nicolas Goaziou
2016-09-27 12:06     ` Rolf Sander (MPI)
2016-09-27 21:36       ` Nicolas Goaziou
2016-09-30 14:52         ` Rolf Sander [this message]
2016-09-30 15:36           ` Nicolas Goaziou
2016-10-02 19:23             ` Rolf Sander
2016-10-03 13:16               ` Rolf Sander (MPI)
     [not found]               ` <6cd445a96b6d4cd88b912298ee4f4df1@DB5PR01MB1895.eurprd01.prod.exchangelabs.com>
2016-10-03 13:27                 ` Eric S Fraga
2016-10-05 12:30                   ` Rolf Sander (MPI)
2016-10-05 14:58                     ` Nicolas Goaziou
2016-10-05 15:32                       ` Rolf Sander (MPI)
2016-10-05 16:10                         ` Thomas S. Dye
2016-10-05 16:29                         ` Nicolas Goaziou
  -- strict thread matches above, loose matches on Subject: below --
2016-09-27 11:18 John Kitchin

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=ef074eb6-57dc-71ef-5310-ce83bc11b058@mpic.de \
    --to=rolf.sander@mpic.de \
    --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).