emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Jeff Trull <edaskel@att.net>
Subject: Re: [BUG] org-export-table-row-number off by one when special row present [9.6.23 ( @ /home/jet/.config/emacs/elpa/org-9.6.23/)]
Date: Tue, 02 Apr 2024 12:51:40 +0000	[thread overview]
Message-ID: <87h6gkszab.fsf@localhost> (raw)
In-Reply-To: <CAF_DUeH1RR=xCGBoFspVTRt9Za=LaHWgMuzq9-Ki2qUZUpuQxw@mail.gmail.com>

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

Jeff Trull <edaskel@att.net> writes:

>> During export, table may be not the same as it appears in the original
>> document - some rows may be omitted. `org-export-table-row-number'
>> returns the coordinates in as-exported table, not in the original table.
>>
>
> Agreed. I believe this behavior contradicts its documentation string:
>
> "... Return value is zero-indexed and ignores separators.  The function
> returns nil
> for special rows and separators."
>
> The language is different for what rows are ignored ("separators") and for
> what cells it will
> return nil ("special rows and separators"). This is consistent with the
> user-facing addresses,
> which do not consider separator rows, but do consider column alignment rows.

What about the attached patch?

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-lisp-ox.el-org-export-table-row-number-Clarify-docst.patch --]
[-- Type: text/x-patch, Size: 1050 bytes --]

From 6457e6e3a9c112b9a1bc3a549a93f3cd6a64b2c3 Mon Sep 17 00:00:00 2001
Message-ID: <6457e6e3a9c112b9a1bc3a549a93f3cd6a64b2c3.1712062152.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Tue, 2 Apr 2024 15:49:01 +0300
Subject: [PATCH] lisp/ox.el (org-export-table-row-number): Clarify docstring

---
 lisp/ox.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/ox.el b/lisp/ox.el
index c794c570f..8c7e092e3 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -5432,7 +5432,8 @@ (defun org-export-table-row-number (table-row info)
   "Return TABLE-ROW number.
 INFO is a plist used as a communication channel.  Return value is
 zero-indexed and ignores separators.  The function returns nil
-for special rows and separators."
+for separators and table rows that are marked to be ignored according
+to the INFO plist."
   (when (eq (org-element-property :type table-row) 'standard)
     (let* ((cache (or (plist-get info :table-row-number-cache)
 		      (let ((table (make-hash-table :test #'eq)))
-- 
2.44.0


[-- Attachment #3: Type: text/plain, Size: 1368 bytes --]


> In this case, it's not specific to any exporter. org-export--skip-p returns
> true for column alignment rows with the following code:
>
>     (table-cell
>      (and (org-export-table-has-special-column-p
>   (org-export-get-parent-table datum))
>  (org-export-first-sibling-p datum options)))

This part of the code is not for alignment rows, it is for special
columns.

> So these rows will be in the ignore-list for all exporters.

This is no longer true on main.

> ... And that's reasonable - when ignore-list is being used for
> deciding what to export. The problem, as I see it, is that
> org-export-table-row-number does not consider this when determining
> the "address" of a cell.

?? `org-export-table-row-number' considers the ignore list because
`org-element-map' considers it.

> So, there is no bug here.
>>
>
> I  disagree :) and suggest the following change to org-export-row-number
> (line 5390):
>
>     info))
>
> should become:
>
>   (org-plist-delete info 'ignore-list)))
>
> which will make it consistent with its docstring and with user-facing
> addresses.

The docstring should be fixed, not the function behaviour.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>

  parent reply	other threads:[~2024-04-02 13:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAF_DUeEgLW2atD=_Bq9xSMA3oTceaAeBxKt8wu69PeT6FtOVpA.ref@mail.gmail.com>
2024-03-31 18:38 ` [BUG] org-export-table-row-number off by one when special row present [9.6.23 ( @ /home/jet/.config/emacs/elpa/org-9.6.23/)] Jeff Trull
2024-04-01 10:42   ` Ihor Radchenko
     [not found]     ` <CAF_DUeH1RR=xCGBoFspVTRt9Za=LaHWgMuzq9-Ki2qUZUpuQxw@mail.gmail.com>
2024-04-02 12:51       ` Ihor Radchenko [this message]
2024-04-05 14:08     ` Ihor Radchenko

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=87h6gkszab.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=edaskel@att.net \
    /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).