emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to hide a table column from exporting
@ 2016-04-22 18:40 Kaushal Modi
  2016-04-26 16:29 ` Michael Brand
  0 siblings, 1 reply; 5+ messages in thread
From: Kaushal Modi @ 2016-04-22 18:40 UTC (permalink / raw)
  To: emacs-org list

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

Hi,

I was trying to prevent an org table column from exporting to html. So I
started looking for a solution and found this:
http://stackoverflow.com/q/6641379/1219634

I have never used Radio Tables, and that too in org-mode itself (because it
looks like Radio Tables are designed to insert org-mode processed tables in
other major modes).

So I tried doing the below, and I cannot figure out how to insert the Radio
Table in that "Final Table" heading.

What I need to achieve:
- Not export the source table
- Generate the radio table at export time (even better if the radio table
updates each time I do C-u C-c C-c on the source table).

* Final Table
# BEGIN RECEIVE ORGTBL output-table
# END RECEIVE ORGTBL output-table

* Source Table
:noexport:
#+ORGTBL: SEND output-table orgtbl-to-html :skipcols (3)
|---+-----+------|
| 2 | 1/2 | junk |
| 4 | 1/4 | junk |
| 8 | 1/2 | junk |
|---+-----+------|

Org-mode version 8.3.4 (release_8.3.4-748-g7e320e @
/home/kmodi/usr_local/apps/6/emacs/emacs-25/share/emacs/site-lisp/org/)

Thanks.

Kaushal
-- 

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 1797 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to hide a table column from exporting
  2016-04-22 18:40 How to hide a table column from exporting Kaushal Modi
@ 2016-04-26 16:29 ` Michael Brand
  2016-05-03 16:57   ` Kaushal Modi
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Brand @ 2016-04-26 16:29 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: emacs-org list

Hi Kaushal

On Fri, Apr 22, 2016 at 8:40 PM, Kaushal Modi <kaushal.modi@gmail.com> wrote:

> I was trying to prevent an org table column from exporting to html. So I
> started looking for a solution and found this:
> http://stackoverflow.com/q/6641379/1219634

Please see my answer for one solution in the thread "tables, comment
in one line, export to html" that started on 2016-04-19, e. g. at
http://thread.gmane.org/gmane.emacs.orgmode/106497/focus=106683

Michael

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to hide a table column from exporting
  2016-04-26 16:29 ` Michael Brand
@ 2016-05-03 16:57   ` Kaushal Modi
  2018-05-07 20:45     ` Kaushal Modi
  2018-05-11  4:27     ` stardiviner
  0 siblings, 2 replies; 5+ messages in thread
From: Kaushal Modi @ 2016-05-03 16:57 UTC (permalink / raw)
  To: Michael Brand; +Cc: emacs-org list

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

Thanks Michael!

That solution works great! I followed the discussion that followed in that
thread and have adopted the following solution in my config for now.

# http://thread.gmane.org/gmane.emacs.orgmode/106497/focus=106683

| / | <#> |    | <r> |
|   | 1n  | 2y |  3y |
# Exports to ASCII as
# 2y  3y

| / | <r> | <#> |    |
|   |  1y | 2n  | 3y |
# Exports to ASCII as
# 1y  3y

| /  | <r> | <#> |
| 1y |  2y | 3n  |
# Exports to ASCII as
# 1y  2y

| / | <#> | <#> | <r> | <#> | <#> | <#> |
|   | 1n  | 2n  |  3y | 4n  | 5n  | 6n  |
# Exports to ASCII as
# 3y

| / | <r> | <l> | <r> | <l> | <r> | <l> |
| / | <#> | <#> | <#> |     | <#> | <#> |
|   |  1n | 2n  |  3n | 4y  |  5n | 6n  |
# Exports to ASCII as
# 4y

# Same result with a less useful notation:
| / | <r> | <l> | <r> | <l> | <r> | <l> |
| / | <#> | <#> |     |     | <#> | <#> |
| / |     | <#> | <#> |     |     |     |
|   |  1n | 2n  |  3n | 4y  |  5n | 6n  |
# Exports to ASCII as
# 4y

# Deletion must not get trapped with this:
| / | <r> | <l> | <r> | <l> | <r> | <l> |
| / |     |     |     |     |     |     |
|   | <#> | <#> | <#> |     |     |     |
|   |  1y | 2y  |  3y | 4y  |  5y | 6y  |
# Exports to ASCII as
# <#>  <#>  <#>
#  1y  2y    3y  4y  5y  6y


* COMMENT
#+BEGIN_SRC emacs-lisp
(defun mbrand/org-export-delete-commented-cols (back-end)
  "Delete columns $2 to $> marked as `<#>' on a row with `/' in $1.
If you want a non-empty column $1 to be deleted make it $2 by
inserting an empty column before and adding `/' in $1."
  (while (re-search-forward "^[ \t]*| +/ +|\\(.*|\\)? +\\(<#>\\) *|" nil t)
    (goto-char (match-beginning 2))
    (org-table-delete-column)
    (beginning-of-line)))
(add-hook 'org-export-before-processing-hook
#'mbrand/org-export-delete-commented-cols)
;; (remove-hook 'org-export-before-processing-hook
#'mbrand/org-export-delete-commented-cols)
#+END_SRC


On Tue, Apr 26, 2016 at 12:29 PM Michael Brand <michael.ch.brand@gmail.com>
wrote:

> Hi Kaushal
>
> On Fri, Apr 22, 2016 at 8:40 PM, Kaushal Modi <kaushal.modi@gmail.com>
> wrote:
>
> > I was trying to prevent an org table column from exporting to html. So I
> > started looking for a solution and found this:
> > http://stackoverflow.com/q/6641379/1219634
>
> Please see my answer for one solution in the thread "tables, comment
> in one line, export to html" that started on 2016-04-19, e. g. at
> http://thread.gmane.org/gmane.emacs.orgmode/106497/focus=106683
>
> Michael
>
-- 

-- 
Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 4302 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to hide a table column from exporting
  2016-05-03 16:57   ` Kaushal Modi
@ 2018-05-07 20:45     ` Kaushal Modi
  2018-05-11  4:27     ` stardiviner
  1 sibling, 0 replies; 5+ messages in thread
From: Kaushal Modi @ 2018-05-07 20:45 UTC (permalink / raw)
  To: Michael Brand; +Cc: emacs-org list

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

A quick update on the solution I posted there.

Within the org-export-before-processing-hook, it seems like a "(goto-char
(point-min))" was always implied before? That's not the case any more.

So that goto-char now has to be added explicitly. This works now (as of Org
mode version 9.1.13 (release_9.1.13-726-gc71e93..)):

/Wondering if this change is expected through some series of changes in 9.x
../

=====
(defun mbrand/org-export-delete-commented-cols (back-end)
  "Delete columns $2 to $> marked as `<#>' on a row with `/' in $1.
If you want a non-empty column $1 to be deleted make it $2 by
inserting an empty column before and adding `/' in $1."
  (goto-char (point-min)) ;Only this added to the previous solution
  (while (re-search-forward
          "^[ \t]*| +/ +|\\(.*|\\)? +\\(<#>\\) *|" nil :noerror)
    (goto-char (match-beginning 2))
    (org-table-delete-column)
    (beginning-of-line)))
=====

On Tue, May 3, 2016 at 12:57 PM Kaushal Modi <kaushal.modi@gmail.com> wrote:

> Thanks Michael!
>
> That solution works great! I followed the discussion that followed in that
> thread and have adopted the following solution in my config for now.
>
> # http://thread.gmane.org/gmane.emacs.orgmode/106497/focus=106683
>
> | / | <#> |    | <r> |
> |   | 1n  | 2y |  3y |
> # Exports to ASCII as
> # 2y  3y
>
> | / | <r> | <#> |    |
> |   |  1y | 2n  | 3y |
> # Exports to ASCII as
> # 1y  3y
>
> | /  | <r> | <#> |
> | 1y |  2y | 3n  |
> # Exports to ASCII as
> # 1y  2y
>
> | / | <#> | <#> | <r> | <#> | <#> | <#> |
> |   | 1n  | 2n  |  3y | 4n  | 5n  | 6n  |
> # Exports to ASCII as
> # 3y
>
> | / | <r> | <l> | <r> | <l> | <r> | <l> |
> | / | <#> | <#> | <#> |     | <#> | <#> |
> |   |  1n | 2n  |  3n | 4y  |  5n | 6n  |
> # Exports to ASCII as
> # 4y
>
> # Same result with a less useful notation:
> | / | <r> | <l> | <r> | <l> | <r> | <l> |
> | / | <#> | <#> |     |     | <#> | <#> |
> | / |     | <#> | <#> |     |     |     |
> |   |  1n | 2n  |  3n | 4y  |  5n | 6n  |
> # Exports to ASCII as
> # 4y
>
> # Deletion must not get trapped with this:
> | / | <r> | <l> | <r> | <l> | <r> | <l> |
> | / |     |     |     |     |     |     |
> |   | <#> | <#> | <#> |     |     |     |
> |   |  1y | 2y  |  3y | 4y  |  5y | 6y  |
> # Exports to ASCII as
> # <#>  <#>  <#>
> #  1y  2y    3y  4y  5y  6y
>
>
> * COMMENT
> #+BEGIN_SRC emacs-lisp
> (defun mbrand/org-export-delete-commented-cols (back-end)
>   "Delete columns $2 to $> marked as `<#>' on a row with `/' in $1.
> If you want a non-empty column $1 to be deleted make it $2 by
> inserting an empty column before and adding `/' in $1."
>   (while (re-search-forward "^[ \t]*| +/ +|\\(.*|\\)? +\\(<#>\\) *|" nil t)
>     (goto-char (match-beginning 2))
>     (org-table-delete-column)
>     (beginning-of-line)))
> (add-hook 'org-export-before-processing-hook
> #'mbrand/org-export-delete-commented-cols)
> ;; (remove-hook 'org-export-before-processing-hook
> #'mbrand/org-export-delete-commented-cols)
> #+END_SRC
>
>
> On Tue, Apr 26, 2016 at 12:29 PM Michael Brand <michael.ch.brand@gmail.com>
> wrote:
>
>> Hi Kaushal
>>
>> On Fri, Apr 22, 2016 at 8:40 PM, Kaushal Modi <kaushal.modi@gmail.com>
>> wrote:
>>
>> > I was trying to prevent an org table column from exporting to html. So I
>> > started looking for a solution and found this:
>> > http://stackoverflow.com/q/6641379/1219634
>>
>> Please see my answer for one solution in the thread "tables, comment
>> in one line, export to html" that started on 2016-04-19, e. g. at
>> http://thread.gmane.org/gmane.emacs.orgmode/106497/focus=106683
>>
>> Michael
>>
> --
>
> --
> Kaushal Modi
>
-- 

Kaushal Modi

[-- Attachment #2: Type: text/html, Size: 5907 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to hide a table column from exporting
  2016-05-03 16:57   ` Kaushal Modi
  2018-05-07 20:45     ` Kaushal Modi
@ 2018-05-11  4:27     ` stardiviner
  1 sibling, 0 replies; 5+ messages in thread
From: stardiviner @ 2018-05-11  4:27 UTC (permalink / raw)
  To: Kaushal Modi; +Cc: Michael Brand, emacs-org list

Hi, Modi, I try to apply you config into Org Radio Tables.

Like this:

,----
| #+ BEGIN RECEIVE ORGTBL test-table-comment-column
| | a | b |
| | 1 | 2 |
| #+ END RECEIVE ORGTBL test-table-comment-column
| 
| #+ORGTBL: SEND test-table-comment-column orgtbl-to-orgtbl :splice nil :skip 0
| | / | <#> | <c> |
| |   | a   |  b  |
| |   | 1   |  2  |
`----

But as you can see, the commented column is not deleted at radio table receive location.

Can it be adapted to Org Radio Tables?

-- 
[ stardiviner ] don't need to convince with trends.
       Blog: https://stardiviner.github.io/
       IRC(freenode): stardiviner
       GPG: F09F650D7D674819892591401B5DF1C95AE89AC3
      

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-11  4:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-22 18:40 How to hide a table column from exporting Kaushal Modi
2016-04-26 16:29 ` Michael Brand
2016-05-03 16:57   ` Kaushal Modi
2018-05-07 20:45     ` Kaushal Modi
2018-05-11  4:27     ` stardiviner

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