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.m...@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.br...@gmail.com>
> wrote:
>
>> Hi Kaushal
>>
>> On Fri, Apr 22, 2016 at 8:40 PM, Kaushal Modi <kaushal.m...@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

Reply via email to