* ox-latex table tabbing support.
@ 2022-03-28 14:38 emacs--- via General discussions about Org-mode.
2022-04-04 10:33 ` Ihor Radchenko
[not found] ` <87wng5nno3.fsf@localhost-Mzo7eKN----2>
0 siblings, 2 replies; 25+ messages in thread
From: emacs--- via General discussions about Org-mode. @ 2022-03-28 14:38 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1.1: Type: text/plain, Size: 1713 bytes --]
Dear all,
I have implemented tabbing (http://www.ctex.org/documents/latex/latex2e-html/ltx-58.html) support for ox-latex. By setting #+ATTR_LATEX: :mode tabbingthe exporter will use the tabbing environment.
The benefits of using tabbing over tabular:
- Can span multiple pages (also possible with long tables).
- Cell width is fixed and does not depend on the content.
- Cells can overflow.
Use cases of tabbing:
- Generate letter headings with fixed layout
- Generate tables on invoices
- Can replace multi-columns (my personal use case)
Example 1:
#+ATTR_LATEX: :mode tabbing
| A | B |
| | C |
is exported to
\begin{tabbing}
\hspace{0.49\textwidth} \= \hspace{0.49\textwidth} \= \kill
A \> B\\
\> C\\
\end{tabbing}
Example 2:
#+ATTR_LATEX: :mode tabbing
| *Address* | Some street 100, box 101 | | *GSM* | 00 000 00 00 00 |
| | Country | | *Email* | mail@example.com |
the exported pdf is attached to this mail.
Example 3:
#+ATTR_LATEX: :mode tabbing :align \hspace{2cm} \= \hspace{2cm} \= \kill
| name: | A very long product name in this cell | |
| options: | option 1 | 1 |
| | option 2 | 1 |
| | option 3 | 0 |
the exported pdf is attached to this mail.
Implementation details:
- The table environment must be set to tabbing
- The cell separators must be set to \>
- The alignment string must be updated.
Kind regards,
Bob Vergauwen
[-- Attachment #1.2: Type: text/html, Size: 3782 bytes --]
[-- Attachment #2: 0001-ox-latex.el-Added-padding-support.patch --]
[-- Type: application/octet-stream, Size: 5493 bytes --]
From bddcf5a79c6fb14c6f0c9cd32e3c50d2fec26f9b Mon Sep 17 00:00:00 2001
From: Bob Vergauwen <bob.vergauwen@gmail.com>
Date: Mon, 28 Mar 2022 15:33:15 +0200
Subject: [PATCH 1/3] ox-latex.el: Added padding support
* lisp/ox-latex.el (org-latex-table): Tabbing support.
(org-latex--align-string-tabbing): This function generates
the LaTeX alignment string for the tabbing environment. An
optional string can be passed to this command via the
`:align' parameter.
(org-table--org-tabbing): Generates the tabbing export
string for latex.
(org-latex-table-cell): This function now checks the type
of the parent table of the cell. If the parrent type is
set to `padding', the cell separator is set to ` \> '
otherwise the default cell separator ` &- ' is used.
TINYCHANGE
---
lisp/ox-latex.el | 61 ++++++++++++++++++++++++++++++++++++++++++++----
1 file changed, 57 insertions(+), 4 deletions(-)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 0edba9e52..ac710b574 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -3194,7 +3194,7 @@ CONTENTS is the contents of the object."
;; `org-latex-table' is the entry point for table transcoding. It
;; takes care of tables with a "verbatim" mode. Otherwise, it
;; delegates the job to either `org-latex--table.el-table',
-;; `org-latex--org-table' or `org-latex--math-table' functions,
+;; `org-latex--org-table' or `org-latex--math-table' or `org-latex--org-tabbing' functions,
;; depending of the type of the table and the mode requested.
;;
;; `org-latex--align-string' is a subroutine used to build alignment
@@ -3218,8 +3218,10 @@ contextual information."
`(table nil ,@(org-element-contents table))))))
;; Case 2: Matrix.
((or (string= type "math") (string= type "inline-math"))
- (org-latex--math-table table info))
- ;; Case 3: Standard table.
+ (org-latex--math-table table info))
+ ;; Case 3: Tabbing
+ ((string= type "tabbing") (org-table--org-tabbing table contents info))
+ ;; Case 4: Standard table.
(t (concat (org-latex--org-table table contents info)
;; When there are footnote references within the
;; table, insert their definition just after it.
@@ -3256,6 +3258,34 @@ centered."
info)
(apply 'concat (nreverse align)))))
+(defun org-latex--align-string-tabbing (table info &optional math?)
+ "Return an appropriate LaTeX alignment string, for the
+latex tabbing environment.
+TABLE is the considered table. INFO is a plist used as
+a communication channel. When optional argument MATH? is
+non-nil, TABLE is meant to be a matrix, where all cells are
+centered."
+ (or (org-export-read-attribute :attr_latex table :align)
+ (let ((align "")
+ (count 0)
+ (separator ""))
+ (progn
+ ;; Count the number of cells in the first row.
+ (setq count (length
+ (org-element-map
+ (org-element-map table 'table-row
+ (lambda (row)
+ (and (eq (org-element-property :type row) 'standard) row))
+ info 'first-match)
+ 'table-cell
+ (lambda (cell) cell))))
+ ;; Calculate the column width, using a proportion of the documets
+ ;; textwidth.
+ (setq separator (format "\\hspace{%s\\textwidth} \\= " (- (/ 1.0 count) 0.01)))
+ (setq align (apply 'concat (make-list count separator)))
+ (setq align (concat align "\\kill")))
+ )))
+
(defun org-latex--decorate-table (table attributes caption above? info)
"Decorate TABLE string with caption and float environment.
@@ -3358,6 +3388,23 @@ This function assumes TABLE has `org' as its `:type' property and
table-env)))
(org-latex--decorate-table output attr caption above? info))))))
+
+(defun org-table--org-tabbing (table contenst info)
+ "Return appropriate LaTeX code for an Org table, using the
+latex tabbing syntax.
+TABLE is the table type element to transcode. CONTENTS is its
+contents, as a string. INFO is a plist used as a communication
+channel.
+This function assumes TABLE has `org' as its `:type' property and
+`tabbing' as its `:mode' attribute."
+ (let ((output (format "\\begin{%s}\n%s\n%s\\end{%s}"
+ "tabbing"
+ (org-latex--align-string-tabbing table info )
+ contenst
+ "tabbing")))
+ output)
+ )
+
(defun org-latex--table.el-table (table info)
"Return appropriate LaTeX code for a table.el table.
@@ -3441,6 +3488,9 @@ This function assumes TABLE has `org' as its `:type' property and
"Transcode a TABLE-CELL element from Org to LaTeX.
CONTENTS is the cell contents. INFO is a plist used as
a communication channel."
+ (let (
+ (type (org-export-read-attribute :attr_latex (org-export-get-parent-table table-cell) :mode))
+ )
(concat
(let ((scientific-format (plist-get info :latex-table-scientific-notation)))
(if (and contents
@@ -3452,7 +3502,10 @@ a communication channel."
(match-string 1 contents)
(match-string 2 contents))
contents))
- (when (org-export-get-next-element table-cell info) " & ")))
+ (when (org-export-get-next-element table-cell info)
+ (if (string= type "tabbing")
+ " \\> " " & ")
+ ))))
;;;; Table Row
--
2.30.1 (Apple Git-130)
[-- Attachment #3: 0002-org-manual.org-Added-padding-feature-to-the-manual.patch --]
[-- Type: application/octet-stream, Size: 1403 bytes --]
From 95c5f19f98ee177f00a3d2389a5b96a667d71176 Mon Sep 17 00:00:00 2001
From: Bob Vergauwen <bob.vergauwen@gmail.com>
Date: Mon, 28 Mar 2022 15:52:24 +0200
Subject: [PATCH 2/3] org-manual.org: Added padding feature to the manual
* doc/org-manual.org (Tables in LaTeX export):
Added the documentation of the padding feature to
the documentation of the LaTeX table exporter.
TINYCHANGE
---
doc/org-manual.org | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 49d906c27..e3bd61bc8 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13546,10 +13546,12 @@ include:
#+vindex: org-latex-default-table-mode
The LaTeX export back-end wraps the table differently depending on
the mode for accurate rendering of math symbols. Mode is either
- =table=, =math=, =inline-math= or =verbatim=.
+ =table=, =math=, =inline-math=, =verbatim= or =tabbing=.
For =math= or =inline-math= mode, LaTeX export back-end wraps the
table in a math environment, but every cell in it is exported as-is.
+ For =tabbing= the LaTeX tabbing environment is used and the correct
+ tabbing delimiters =\>= are used.
The LaTeX export back-end determines the default mode from
~org-latex-default-table-mode~. The LaTeX export back-end merges
contiguous tables in the same mode into a single environment.
--
2.30.1 (Apple Git-130)
[-- Attachment #4: 0003-ORG-NEWS-Added-padding-feature-to-version-9.6.patch --]
[-- Type: application/octet-stream, Size: 1446 bytes --]
From cec5c642fe1d2e6ffd8710bdf1edd2ad7018ce47 Mon Sep 17 00:00:00 2001
From: Bob Vergauwen <bob.vergauwen@gmail.com>
Date: Mon, 28 Mar 2022 15:55:48 +0200
Subject: [PATCH 3/3] ORG-NEWS: Added padding feature to version 9.6
* etc/ORG-NEWS: (New features):
Added the tabbing feature to the list of new features for the 9.6
release of org-mode.
TINYCHANGE
---
etc/ORG-NEWS | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index fd29d39d7..df0bf4778 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -77,6 +77,18 @@ Items in a description list that begin with =Function:=, =Variable:=
or certain related prefixes are converted using Texinfo definition
commands.
+*** New ox-latex tabbing support for tables.
+
+Latex tables can now be exported to the latex tabbing environment [[https://latexref.xyz/tabbing.html][tabbing environment]].
+This is done by adding =#+ATTR_LATEX: :mode tabbing= at the top
+of the table.
+The default column width is set to 1/n times the latex textwidth,
+where n is the number of columns.
+This behaviour can be changed by supplying a =:align= parameter.
+
+The tabbing environment can be useful when generating simple tables which
+can be span multiple pages and when table cells are allowed to overflow.
+
** New functions and changes in function arguments
*** New function ~org-element-cache-map~ for quick mapping across Org elements
--
2.30.1 (Apple Git-130)
[-- Attachment #5: padding-example.pdf --]
[-- Type: application/pdf, Size: 37897 bytes --]
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: ox-latex table tabbing support.
2022-03-28 14:38 ox-latex table tabbing support emacs--- via General discussions about Org-mode.
@ 2022-04-04 10:33 ` Ihor Radchenko
[not found] ` <87wng5nno3.fsf@localhost-Mzo7eKN----2>
1 sibling, 0 replies; 25+ messages in thread
From: Ihor Radchenko @ 2022-04-04 10:33 UTC (permalink / raw)
To: emacs; +Cc: emacs-orgmode
emacs--- via "General discussions about Org-mode."
<emacs-orgmode@gnu.org> writes:
> I have implemented tabbing (http://www.ctex.org/documents/latex/latex2e-html/ltx-58.html) support for ox-latex. By setting #+ATTR_LATEX: :mode tabbingthe exporter will use the tabbing environment.
>
> The benefits of using tabbing over tabular:
> - Can span multiple pages (also possible with long tables).
> - Cell width is fixed and does not depend on the content.
> - Cells can overflow.
Looks useful. Marking your message as a patch to be tracked at
updated.orgmode.org
Some comments are below.
> TINYCHANGE
Note that your patch >15 LOC and cannot be applied without copyright
assignment. See https://orgmode.org/worg/org-contribute.html#copyright
> -;; `org-latex--org-table' or `org-latex--math-table' functions,
> +;; `org-latex--org-table' or `org-latex--math-table' or `org-latex--org-tabbing' functions,
We generally try to keep all the text in source files narrower than 70
characters (default value of fill-column). You can use fill-region to
make Emacs autofill the comment lines.
> +(defun org-latex--align-string-tabbing (table info &optional math?)
It looks like math? argument is unused. Is it intentional?
> + "Return an appropriate LaTeX alignment string, for the
> +latex tabbing environment.
> +TABLE is the considered table. INFO is a plist used as
> +a communication channel. When optional argument MATH? is
> +non-nil, TABLE is meant to be a matrix, where all cells are
> +centered."
> + (or (org-export-read-attribute :attr_latex table :align)
> + (let ((align "")
> + (count 0)
> + (separator ""))
> + (progn
You do not need an extra progn inside let.
> +(defun org-table--org-tabbing (table contenst info)
^contents
> + "Return appropriate LaTeX code for an Org table, using the
> +latex tabbing syntax.
> +TABLE is the table type element to transcode. CONTENTS is its
> +contents, as a string. INFO is a plist used as a communication
> +channel.
> +This function assumes TABLE has `org' as its `:type' property and
> +`tabbing' as its `:mode' attribute."
> + (let ((output (format "\\begin{%s}\n%s\n%s\\end{%s}"
> + "tabbing"
> + (org-latex--align-string-tabbing table info )
> + contenst
^contents
Best,
Ihor
^ permalink raw reply [flat|nested] 25+ messages in thread
[parent not found: <87wng5nno3.fsf@localhost-Mzo7eKN----2>]
* Re: ox-latex table tabbing support.
[not found] ` <87wng5nno3.fsf@localhost-Mzo7eKN----2>
@ 2022-04-04 14:03 ` emacs--- via General discussions about Org-mode.
2022-06-21 4:43 ` Daniel Fleischer
0 siblings, 1 reply; 25+ messages in thread
From: emacs--- via General discussions about Org-mode. @ 2022-04-04 14:03 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: Emacs Orgmode
[-- Attachment #1.1: Type: text/plain, Size: 2810 bytes --]
Hi Ihor,
Thanks for the response. I updated my patched and mailed the requested copyright form to assign@gnu.org
Kind regards,
Bob
--
Sent with Tutanota, the secure & ad-free mailbox.
Apr 4, 2022, 12:33 by yantar92@gmail.com:
> emacs--- via "General discussions about Org-mode."
> <emacs-orgmode@gnu.org> writes:
>
>> I have implemented tabbing (http://www.ctex.org/documents/latex/latex2e-html/ltx-58.html) support for ox-latex. By setting #+ATTR_LATEX: :mode tabbingthe exporter will use the tabbing environment.
>>
>> The benefits of using tabbing over tabular:
>> - Can span multiple pages (also possible with long tables).
>> - Cell width is fixed and does not depend on the content.
>> - Cells can overflow.
>>
>
> Looks useful. Marking your message as a patch to be tracked at
> updated.orgmode.org
>
> Some comments are below.
>
>> TINYCHANGE
>>
>
> Note that your patch >15 LOC and cannot be applied without copyright
> assignment. See https://orgmode.org/worg/org-contribute.html#copyright
>
>> -;; `org-latex--org-table' or `org-latex--math-table' functions,
>> +;; `org-latex--org-table' or `org-latex--math-table' or `org-latex--org-tabbing' functions,
>>
>
> We generally try to keep all the text in source files narrower than 70
> characters (default value of fill-column). You can use fill-region to
> make Emacs autofill the comment lines.
>
>> +(defun org-latex--align-string-tabbing (table info &optional math?)
>>
>
> It looks like math? argument is unused. Is it intentional?
>
>> + "Return an appropriate LaTeX alignment string, for the
>> +latex tabbing environment.
>> +TABLE is the considered table. INFO is a plist used as
>> +a communication channel. When optional argument MATH? is
>> +non-nil, TABLE is meant to be a matrix, where all cells are
>> +centered."
>> + (or (org-export-read-attribute :attr_latex table :align)
>> + (let ((align "")
>> + (count 0)
>> + (separator ""))
>> + (progn
>>
>
> You do not need an extra progn inside let.
>
>> +(defun org-table--org-tabbing (table contenst info)
>>
>
> ^contents
>
>> + "Return appropriate LaTeX code for an Org table, using the
>> +latex tabbing syntax.
>> +TABLE is the table type element to transcode. CONTENTS is its
>> +contents, as a string. INFO is a plist used as a communication
>> +channel.
>> +This function assumes TABLE has `org' as its `:type' property and
>> +`tabbing' as its `:mode' attribute."
>> + (let ((output (format "\\begin{%s}\n%s\n%s\\end{%s}"
>> + "tabbing"
>> + (org-latex--align-string-tabbing table info )
>> + contenst
>>
>
> ^contents
>
>
> Best,
> Ihor
>
[-- Attachment #1.2: Type: text/html, Size: 4124 bytes --]
[-- Attachment #2: padding-feature.patch --]
[-- Type: application/octet-stream, Size: 6413 bytes --]
diff --git a/doc/org-manual.org b/doc/org-manual.org
index 49d906c27..e3bd61bc8 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -13546,10 +13546,12 @@ include:
#+vindex: org-latex-default-table-mode
The LaTeX export back-end wraps the table differently depending on
the mode for accurate rendering of math symbols. Mode is either
- =table=, =math=, =inline-math= or =verbatim=.
+ =table=, =math=, =inline-math=, =verbatim= or =tabbing=.
For =math= or =inline-math= mode, LaTeX export back-end wraps the
table in a math environment, but every cell in it is exported as-is.
+ For =tabbing= the LaTeX tabbing environment is used and the correct
+ tabbing delimiters =\>= are used.
The LaTeX export back-end determines the default mode from
~org-latex-default-table-mode~. The LaTeX export back-end merges
contiguous tables in the same mode into a single environment.
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index fd29d39d7..9bcc9fabf 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -77,6 +77,19 @@ Items in a description list that begin with =Function:=, =Variable:=
or certain related prefixes are converted using Texinfo definition
commands.
+*** New ox-latex tabbing support for tables.
+
+Latex tables can now be exported to the latex tabbing environment
+[[https://latexref.xyz/tabbing.html][tabbing environment]].
+This is done by adding =#+ATTR_LATEX: :mode tabbing= at the top
+of the table.
+The default column width is set to 1/n times the latex textwidth,
+where n is the number of columns.
+This behaviour can be changed by supplying a =:align= parameter.
+
+The tabbing environment can be useful when generating simple tables which
+can be span multiple pages and when table cells are allowed to overflow.
+
** New functions and changes in function arguments
*** New function ~org-element-cache-map~ for quick mapping across Org elements
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 0edba9e52..50dc4bb1e 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -3194,7 +3194,8 @@ CONTENTS is the contents of the object."
;; `org-latex-table' is the entry point for table transcoding. It
;; takes care of tables with a "verbatim" mode. Otherwise, it
;; delegates the job to either `org-latex--table.el-table',
-;; `org-latex--org-table' or `org-latex--math-table' functions,
+;; `org-latex--org-table' or `org-latex--math-table' or
+;; `org-latex--org-tabbing' functions,
;; depending of the type of the table and the mode requested.
;;
;; `org-latex--align-string' is a subroutine used to build alignment
@@ -3218,8 +3219,10 @@ contextual information."
`(table nil ,@(org-element-contents table))))))
;; Case 2: Matrix.
((or (string= type "math") (string= type "inline-math"))
- (org-latex--math-table table info))
- ;; Case 3: Standard table.
+ (org-latex--math-table table info))
+ ;; Case 3: Tabbing
+ ((string= type "tabbing") (org-table--org-tabbing table contents info))
+ ;; Case 4: Standard table.
(t (concat (org-latex--org-table table contents info)
;; When there are footnote references within the
;; table, insert their definition just after it.
@@ -3256,6 +3259,34 @@ centered."
info)
(apply 'concat (nreverse align)))))
+(defun org-latex--align-string-tabbing (table info)
+ "Return an appropriate LaTeX alignment string, for the
+latex tabbing environment.
+TABLE is the considered table. INFO is a plist used as
+a communication channel."
+ (or (org-export-read-attribute :attr_latex table :align)
+ (let ((align "")
+ (count 0)
+ (separator ""))
+ ;; Count the number of cells in the first row.
+ (setq count (length
+ (org-element-map
+ (org-element-map table 'table-row
+ (lambda (row)
+ (and (eq (org-element-property :type row) 'standard) row))
+ info 'first-match)
+ 'table-cell
+ (lambda (cell) cell))))
+ ;; Calculate the column width, using a proportion of the documets
+ ;; textwidth.
+ (setq separator (format
+ "\\hspace{%s\\textwidth} \\= "
+ (- (/ 1.0 count) 0.01)))
+ (setq align (concat
+ (apply 'concat (make-list count separator))
+ "\\kill")))
+ ))
+
(defun org-latex--decorate-table (table attributes caption above? info)
"Decorate TABLE string with caption and float environment.
@@ -3358,6 +3389,23 @@ This function assumes TABLE has `org' as its `:type' property and
table-env)))
(org-latex--decorate-table output attr caption above? info))))))
+
+(defun org-table--org-tabbing (table contenst info)
+ "Return appropriate LaTeX code for an Org table, using the
+latex tabbing syntax.
+TABLE is the table type element to transcode. CONTENTS is its
+contents, as a string. INFO is a plist used as a communication
+channel.
+This function assumes TABLE has `org' as its `:type' property and
+`tabbing' as its `:mode' attribute."
+ (let ((output (format "\\begin{%s}\n%s\n%s\\end{%s}"
+ "tabbing"
+ (org-latex--align-string-tabbing table info )
+ contenst
+ "tabbing")))
+ output)
+ )
+
(defun org-latex--table.el-table (table info)
"Return appropriate LaTeX code for a table.el table.
@@ -3441,6 +3489,9 @@ This function assumes TABLE has `org' as its `:type' property and
"Transcode a TABLE-CELL element from Org to LaTeX.
CONTENTS is the cell contents. INFO is a plist used as
a communication channel."
+ (let (
+ (type (org-export-read-attribute :attr_latex (org-export-get-parent-table table-cell) :mode))
+ )
(concat
(let ((scientific-format (plist-get info :latex-table-scientific-notation)))
(if (and contents
@@ -3452,7 +3503,10 @@ a communication channel."
(match-string 1 contents)
(match-string 2 contents))
contents))
- (when (org-export-get-next-element table-cell info) " & ")))
+ (when (org-export-get-next-element table-cell info)
+ (if (string= type "tabbing")
+ " \\> " " & ")
+ ))))
;;;; Table Row
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: ox-latex table tabbing support.
2022-04-04 14:03 ` emacs--- via General discussions about Org-mode.
@ 2022-06-21 4:43 ` Daniel Fleischer
2022-06-24 13:37 ` Robert Pluim
2022-06-26 1:54 ` ox-latex table tabbing support Ihor Radchenko
0 siblings, 2 replies; 25+ messages in thread
From: Daniel Fleischer @ 2022-06-21 4:43 UTC (permalink / raw)
To: emacs--- via General discussions about Org-mode.; +Cc: Ihor Radchenko, emacs
Hi Bob,
Thank you very much for the patch. It was merged to master in 4a0d951c.
Also, you were added to the orgmode contributes at
https://orgmode.org/worg/contributors.html.
Thanks for the contribution.
Best,
--
Daniel Fleischer
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: ox-latex table tabbing support.
2022-06-21 4:43 ` Daniel Fleischer
@ 2022-06-24 13:37 ` Robert Pluim
2022-06-24 14:20 ` Daniel Fleischer
2022-06-26 1:54 ` ox-latex table tabbing support Ihor Radchenko
1 sibling, 1 reply; 25+ messages in thread
From: Robert Pluim @ 2022-06-24 13:37 UTC (permalink / raw)
To: Daniel Fleischer; +Cc: emacs-orgmode, Ihor Radchenko, emacs
>>>>> On Tue, 21 Jun 2022 07:43:12 +0300, Daniel Fleischer <danflscr@gmail.com> said:
Daniel> Hi Bob,
Daniel> Thank you very much for the patch. It was merged to master in 4a0d951c.
Daniel> Also, you were added to the orgmode contributes at
Daniel> https://orgmode.org/worg/contributors.html.
Hi Daniel, I see this was committed with you as Author: and Bob as
Created-by:, which is somewhat unusual. I canʼt find anything about
Created-by in the descriptions of org-mode's processes (and this is
the only instance I can see in the commit logs).
Robert
--
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: ox-latex table tabbing support.
2022-06-24 13:37 ` Robert Pluim
@ 2022-06-24 14:20 ` Daniel Fleischer
2022-06-24 15:01 ` Robert Pluim
0 siblings, 1 reply; 25+ messages in thread
From: Daniel Fleischer @ 2022-06-24 14:20 UTC (permalink / raw)
To: Robert Pluim; +Cc: emacs-orgmode, Ihor Radchenko, emacs
[-- Attachment #1: Type: text/plain, Size: 531 bytes --]
Robert Pluim [2022-06-24 Fri 15:37] wrote:
> Hi Daniel, I see this was committed with you as Author: and Bob as
> Created-by:, which is somewhat unusual. I canʼt find anything about
> Created-by in the descriptions of org-mode's processes (and this is
> the only instance I can see in the commit logs).
That patch was actually just a diff, so I created a commit so it was my name. I came up with the "created-by" field to
attribute the work to Bob. Is there another way it should have been done?
Daniel Fleischer
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: ox-latex table tabbing support.
2022-06-24 14:20 ` Daniel Fleischer
@ 2022-06-24 15:01 ` Robert Pluim
2022-06-24 15:50 ` Daniel Fleischer
2022-06-24 19:32 ` emacs--- via General discussions about Org-mode.
0 siblings, 2 replies; 25+ messages in thread
From: Robert Pluim @ 2022-06-24 15:01 UTC (permalink / raw)
To: Daniel Fleischer; +Cc: emacs-orgmode, Ihor Radchenko, emacs
>>>>> On Fri, 24 Jun 2022 17:20:37 +0300, Daniel Fleischer <danflscr@gmail.com> said:
Daniel> Robert Pluim [2022-06-24 Fri 15:37] wrote:
>> Hi Daniel, I see this was committed with you as Author: and Bob as
>> Created-by:, which is somewhat unusual. I canʼt find anything about
>> Created-by in the descriptions of org-mode's processes (and this is
>> the only instance I can see in the commit logs).
Daniel> That patch was actually just a diff, so I created a commit so it was
Daniel> my name. I came up with the "created-by" field to
Daniel> attribute the work to Bob. Is there another way it should have been done?
git commit --author='Bob Vergauwen <emacs@vergauwen.me>'
which would show you as the committer, and Bob as the author.
Robert
--
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: ox-latex table tabbing support.
2022-06-24 15:01 ` Robert Pluim
@ 2022-06-24 15:50 ` Daniel Fleischer
2022-06-24 19:32 ` emacs--- via General discussions about Org-mode.
1 sibling, 0 replies; 25+ messages in thread
From: Daniel Fleischer @ 2022-06-24 15:50 UTC (permalink / raw)
To: Robert Pluim; +Cc: emacs-orgmode, Ihor Radchenko, emacs
[-- Attachment #1: Type: text/plain, Size: 332 bytes --]
Robert Pluim [2022-06-24 Fri 17:01] wrote:
> git commit --author='Bob Vergauwen <emacs@vergauwen.me>'
>
> which would show you as the committer, and Bob as the author.
Thanks for the tip; I wasn't aware one can use any identity to author a commit.
Perhaps that's why there's an option to do GPG signing in git.
Daniel Fleischer
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: ox-latex table tabbing support.
2022-06-24 15:01 ` Robert Pluim
2022-06-24 15:50 ` Daniel Fleischer
@ 2022-06-24 19:32 ` emacs--- via General discussions about Org-mode.
2022-06-25 3:32 ` Ihor Radchenko
1 sibling, 1 reply; 25+ messages in thread
From: emacs--- via General discussions about Org-mode. @ 2022-06-24 19:32 UTC (permalink / raw)
To: Robert Pluim; +Cc: Daniel Fleischer, emacs-orgmode, Ihor Radchenko
[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]
Hi Robert,
I used the instructions provide on
https://orgmode.org/worg/org-contribute.html#first-patch.
For me, it was a first too, send a patch via email. Can I
prevent these issues in the future or use a different method
to send my patches?
Kind regardes,
Bob
--
Sent with Tutanota, enjoy secure & ad-free emails.
Jun 24, 2022, 17:01 by rpluim@gmail.com:
>>>>>> On Fri, 24 Jun 2022 17:20:37 +0300, Daniel Fleischer <danflscr@gmail.com> said:
>>>>>>
>
> Daniel> Robert Pluim [2022-06-24 Fri 15:37] wrote:
> >> Hi Daniel, I see this was committed with you as Author: and Bob as
> >> Created-by:, which is somewhat unusual. I canʼt find anything about
> >> Created-by in the descriptions of org-mode's processes (and this is
> >> the only instance I can see in the commit logs).
>
> Daniel> That patch was actually just a diff, so I created a commit so it was
> Daniel> my name. I came up with the "created-by" field to
> Daniel> attribute the work to Bob. Is there another way it should have been done?
>
> git commit --author='Bob Vergauwen <emacs@vergauwen.me>'
>
> which would show you as the committer, and Bob as the author.
>
> Robert
> --
>
[-- Attachment #2: Type: text/html, Size: 2289 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: ox-latex table tabbing support.
2022-06-24 19:32 ` emacs--- via General discussions about Org-mode.
@ 2022-06-25 3:32 ` Ihor Radchenko
2022-06-26 10:08 ` Robert Pluim
0 siblings, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-06-25 3:32 UTC (permalink / raw)
To: emacs; +Cc: Robert Pluim, Daniel Fleischer, emacs-orgmode
emacs@vergauwen.me writes:
> Hi Robert,
> I used the instructions provide on
> https://orgmode.org/worg/org-contribute.html#first-patch.
> For me, it was a first too, send a patch via email. Can I
> prevent these issues in the future or use a different method
> to send my patches?
I think we describe one method in
https://orgmode.org/worg/org-contribute.html#org5355fd7
You can also find my personal suggestions and walkthrough in
https://orgmode.org/list/87levyzwsk.fsf@localhost
Best,
Ihor
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: ox-latex table tabbing support.
2022-06-25 3:32 ` Ihor Radchenko
@ 2022-06-26 10:08 ` Robert Pluim
2022-06-26 13:47 ` [PATCH] describe how to override Author Robert Pluim
0 siblings, 1 reply; 25+ messages in thread
From: Robert Pluim @ 2022-06-26 10:08 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs, Daniel Fleischer, emacs-orgmode
>>>>> On Sat, 25 Jun 2022 11:32:21 +0800, Ihor Radchenko <yantar92@gmail.com> said:
Ihor> emacs@vergauwen.me writes:
>> Hi Robert,
>> I used the instructions provide on
>> https://orgmode.org/worg/org-contribute.html#first-patch.
>> For me, it was a first too, send a patch via email. Can I
>> prevent these issues in the future or use a different method
>> to send my patches?
I donʼt think you did anything wrong, although if you'd committed the
changes locally and run 'git format-patch' to produce the patch file,
your authorship would have been included (Ihor's link below discusses
it at length)
Ihor> I think we describe one method in
Ihor> https://orgmode.org/worg/org-contribute.html#org5355fd7
Ihor> You can also find my personal suggestions and walkthrough in
Ihor> https://orgmode.org/list/87levyzwsk.fsf@localhost
The thing thatʼs missing is any discussion of how to ensure the Author
of the commit is set correctly. When applying git patches it all
works, but not when applying diffs. Iʼll read through the
org-contribute section and see if I can come up with some verbiage.
Robert
--
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH] describe how to override Author
2022-06-26 10:08 ` Robert Pluim
@ 2022-06-26 13:47 ` Robert Pluim
2022-06-26 14:04 ` Daniel Fleischer
2022-06-27 9:53 ` Ihor Radchenko
0 siblings, 2 replies; 25+ messages in thread
From: Robert Pluim @ 2022-06-26 13:47 UTC (permalink / raw)
To: emacs-orgmode
Robert> The thing thatʼs missing is any discussion of how to ensure the Author
Robert> of the commit is set correctly. When applying git patches it all
Robert> works, but not when applying diffs. Iʼll read through the
Robert> org-contribute section and see if I can come up with some verbiage.
Something like this? (I hope Iʼve got the syntax right, I seldom write
org for exporting purposes). The emacs CONTRIBUTE guidelines talk
about setting 'Author', but I guess not everyone reads those...
diff --git a/org-contribute.org b/org-contribute.org
index a3cb6f2b..c01bf417 100644
--- a/org-contribute.org
+++ b/org-contribute.org
@@ -270,6 +270,19 @@ * Your first commit as an Org maintainer
locally and make sure you have a clean commit history before merging
it into the =bugfix= or =main= branch.
+When applying patches written by other people, please ensure that the
+=Author= information of the resulting commit(s) is correct. When
+applying patches created with =git format-patch= this will happen
+automatically, but when applying simple diffs you will need to
+override the author. Here are three ways to do that, depending on
+which method you use to commit to git:
+
+1. Command line: src_sh{git commit --author='First Last <flast@somewhere.com>'}
+2. =VC=: Set the 'Author:' field in log-edit mode (requires setting
+ `log-edit-setup-add-author').
+3. =Magit=: Override the author using the =-A= flag from magit's commit
+ transient.
+
To check our Git workflow in more details, please read [[file:org-maintenance.org][Org maintenance]].
* Commit messages and ChangeLog entries
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH] describe how to override Author
2022-06-26 13:47 ` [PATCH] describe how to override Author Robert Pluim
@ 2022-06-26 14:04 ` Daniel Fleischer
2022-06-27 9:53 ` Ihor Radchenko
1 sibling, 0 replies; 25+ messages in thread
From: Daniel Fleischer @ 2022-06-26 14:04 UTC (permalink / raw)
To: Robert Pluim; +Cc: emacs-orgmode
Robert Pluim [2022-06-26 Sun 15:47] wrote:
> Something like this? (I hope Iʼve got the syntax right, I seldom write
> org for exporting purposes). The emacs CONTRIBUTE guidelines talk
> about setting 'Author', but I guess not everyone reads those...
> +When applying patches written by other people, please ensure that the
> +=Author= information of the resulting commit(s) is correct. When
> +applying patches created with =git format-patch= this will happen
> +automatically, but when applying simple diffs you will need to
> +override the author. Here are three ways to do that, depending on
2 spaces here.
Looks good and to the point.
--
Daniel Fleischer
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] describe how to override Author
2022-06-26 13:47 ` [PATCH] describe how to override Author Robert Pluim
2022-06-26 14:04 ` Daniel Fleischer
@ 2022-06-27 9:53 ` Ihor Radchenko
2022-06-28 12:07 ` Robert Pluim
1 sibling, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-06-27 9:53 UTC (permalink / raw)
To: Robert Pluim; +Cc: emacs-orgmode
Robert Pluim <rpluim@gmail.com> writes:
> diff --git a/org-contribute.org b/org-contribute.org
Maybe add the details to org-maintenance.org instead?
This is more of a technical detail needed for maintainers, not for the
committers.
> +1. Command line: src_sh{git commit --author='First Last <flast@somewhere.com>'}
I think we usually prefer source blocks to inline source blocks.
> +2. =VC=: Set the 'Author:' field in log-edit mode (requires setting
> + `log-edit-setup-add-author').
'Author:' -> =Author:=
`log-edit-setup-add-author' -> ~log-edit-setup-add-author~
Best,
Ihor
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] describe how to override Author
2022-06-27 9:53 ` Ihor Radchenko
@ 2022-06-28 12:07 ` Robert Pluim
2022-06-29 10:10 ` Ihor Radchenko
0 siblings, 1 reply; 25+ messages in thread
From: Robert Pluim @ 2022-06-28 12:07 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
>>>>> On Mon, 27 Jun 2022 17:53:30 +0800, Ihor Radchenko <yantar92@gmail.com> said:
Ihor> Robert Pluim <rpluim@gmail.com> writes:
>> diff --git a/org-contribute.org b/org-contribute.org
Ihor> Maybe add the details to org-maintenance.org instead?
Ihor> This is more of a technical detail needed for maintainers, not for the
Ihor> committers.
Iʼd be worried if the org maintainer(s) didnʼt know how to override
Author :-)
Occasional committers would probably not read org-maintenance.org, and
those are the people this section is aimed at, I think. Plus itʼs the
kind of thing you need to catch early: once the commit has been pushed
itʼs too late.
>> +1. Command line: src_sh{git commit --author='First Last <flast@somewhere.com>'}
Ihor> I think we usually prefer source blocks to inline source blocks.
OK, changed.
>> +2. =VC=: Set the 'Author:' field in log-edit mode (requires setting
>> + `log-edit-setup-add-author').
Ihor> 'Author:' -> =Author:=
Ihor> `log-edit-setup-add-author' -> ~log-edit-setup-add-author~
OK, changed.
Robert
--
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] describe how to override Author
2022-06-28 12:07 ` Robert Pluim
@ 2022-06-29 10:10 ` Ihor Radchenko
2022-06-30 8:18 ` Robert Pluim
0 siblings, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-06-29 10:10 UTC (permalink / raw)
To: Robert Pluim; +Cc: emacs-orgmode
Robert Pluim <rpluim@gmail.com> writes:
>>>>>> On Mon, 27 Jun 2022 17:53:30 +0800, Ihor Radchenko <yantar92@gmail.com> said:
>
> Ihor> Robert Pluim <rpluim@gmail.com> writes:
> >> diff --git a/org-contribute.org b/org-contribute.org
>
> Ihor> Maybe add the details to org-maintenance.org instead?
> Ihor> This is more of a technical detail needed for maintainers, not for the
> Ihor> committers.
>
> Iʼd be worried if the org maintainer(s) didnʼt know how to override
> Author :-)
I have bad news for you... Simply because I never ever had a need to do
it :) Not like selecting this option from Magit dispatch is difficult.
> Occasional committers would probably not read org-maintenance.org, and
> those are the people this section is aimed at, I think. Plus itʼs the
> kind of thing you need to catch early: once the commit has been pushed
> itʼs too late.
Not really. org-contribute.org is the page directly linked from
orgmode.org. It is aiming for new contributors with no write access.
More elaborate things like backwards compatibility, copyright process
assistance, etc are documented in org-maintenance.org.
Modifying submitted diffs/patches appears to lay within the more
elaborate category IMHO.
> >> +1. Command line: src_sh{git commit --author='First Last <flast@somewhere.com>'}
>
> Ihor> I think we usually prefer source blocks to inline source blocks.
>
> OK, changed.
>
> >> +2. =VC=: Set the 'Author:' field in log-edit mode (requires setting
> >> + `log-edit-setup-add-author').
>
> Ihor> 'Author:' -> =Author:=
> Ihor> `log-edit-setup-add-author' -> ~log-edit-setup-add-author~
>
> OK, changed.
I guess that you intended to attach the updated patch, but haven't?
Best,
Ihor
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] describe how to override Author
2022-06-29 10:10 ` Ihor Radchenko
@ 2022-06-30 8:18 ` Robert Pluim
2022-06-30 13:19 ` Ihor Radchenko
0 siblings, 1 reply; 25+ messages in thread
From: Robert Pluim @ 2022-06-30 8:18 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
>>>>> On Wed, 29 Jun 2022 18:10:00 +0800, Ihor Radchenko <yantar92@gmail.com> said:
Ihor> Robert Pluim <rpluim@gmail.com> writes:
>> Iʼd be worried if the org maintainer(s) didnʼt know how to override
>> Author :-)
Ihor> I have bad news for you... Simply because I never ever had a need to do
Ihor> it :) Not like selecting this option from Magit dispatch is difficult.
But you were at least aware that it was possible :-)
>> Occasional committers would probably not read org-maintenance.org, and
>> those are the people this section is aimed at, I think. Plus itʼs the
>> kind of thing you need to catch early: once the commit has been pushed
>> itʼs too late.
Ihor> Not really. org-contribute.org is the page directly linked from
Ihor> orgmode.org. It is aiming for new contributors with no write access.
This particular change is in "Your first commit as an Org
maintainer". Perhaps that node should be moved to org-maintenance.org?
Ihor> More elaborate things like backwards compatibility, copyright process
Ihor> assistance, etc are documented in org-maintenance.org.
Ihor> Modifying submitted diffs/patches appears to lay within the more
Ihor> elaborate category IMHO.
Ihor> I guess that you intended to attach the updated patch, but haven't?
No, since weʼre still discussing where it should go.
Robert
--
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] describe how to override Author
2022-06-30 8:18 ` Robert Pluim
@ 2022-06-30 13:19 ` Ihor Radchenko
2022-06-30 15:17 ` Robert Pluim
0 siblings, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-06-30 13:19 UTC (permalink / raw)
To: Robert Pluim; +Cc: emacs-orgmode
Robert Pluim <rpluim@gmail.com> writes:
> >> Occasional committers would probably not read org-maintenance.org, and
> >> those are the people this section is aimed at, I think. Plus itʼs the
> >> kind of thing you need to catch early: once the commit has been pushed
> >> itʼs too late.
>
> Ihor> Not really. org-contribute.org is the page directly linked from
> Ihor> orgmode.org. It is aiming for new contributors with no write access.
>
> This particular change is in "Your first commit as an Org
> maintainer". Perhaps that node should be moved to org-maintenance.org?
I do not think so. I am seeing this section as a "crash course" for the
new maintainers. We should only provide the critical information there.
Not too much, not too less. Something to not scare people with the
details.
The elaborate details should be in org-maintenance.org, which is
directly mentioned at the end of the "first commit" section.
Best,
Ihor
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] describe how to override Author
2022-06-30 13:19 ` Ihor Radchenko
@ 2022-06-30 15:17 ` Robert Pluim
2022-07-02 4:21 ` Ihor Radchenko
0 siblings, 1 reply; 25+ messages in thread
From: Robert Pluim @ 2022-06-30 15:17 UTC (permalink / raw)
To: Ihor Radchenko; +Cc: emacs-orgmode
>>>>> On Thu, 30 Jun 2022 21:19:36 +0800, Ihor Radchenko <yantar92@gmail.com> said:
Ihor> Robert Pluim <rpluim@gmail.com> writes:
>> >> Occasional committers would probably not read org-maintenance.org, and
>> >> those are the people this section is aimed at, I think. Plus itʼs the
>> >> kind of thing you need to catch early: once the commit has been pushed
>> >> itʼs too late.
>>
Ihor> Not really. org-contribute.org is the page directly linked from
Ihor> orgmode.org. It is aiming for new contributors with no write access.
>>
>> This particular change is in "Your first commit as an Org
>> maintainer". Perhaps that node should be moved to org-maintenance.org?
Ihor> I do not think so. I am seeing this section as a "crash course" for the
Ihor> new maintainers. We should only provide the critical information there.
Ihor> Not too much, not too less. Something to not scare people with the
Ihor> details.
I guess we disagree about whether knowing about the distinction
between 'Author:' and 'Commit:' is critical or not. For a free
software project correct attribution of changes is very important, so
committers should pay attention to it (and by extension the
documentation should educate them about it at the earliest
opportunity). But youʼre the maintainer :-)
Ihor> The elaborate details should be in org-maintenance.org, which is
Ihor> directly mentioned at the end of the "first commit" section.
In "Where can I track bugs, patches and updates?" or somewhere else?
BTW, Iʼm having trouble parsing this sentence from there:
You don't much more: confirming bugs is a critical contribution.
Thereʼs at least one word missing betweeen "donʼt" and "much" there.
Robert
--
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] describe how to override Author
2022-06-30 15:17 ` Robert Pluim
@ 2022-07-02 4:21 ` Ihor Radchenko
0 siblings, 0 replies; 25+ messages in thread
From: Ihor Radchenko @ 2022-07-02 4:21 UTC (permalink / raw)
To: Robert Pluim; +Cc: emacs-orgmode
Robert Pluim <rpluim@gmail.com> writes:
>>>>>> On Thu, 30 Jun 2022 21:19:36 +0800, Ihor Radchenko <yantar92@gmail.com> said:
>
> Ihor> Robert Pluim <rpluim@gmail.com> writes:
> >> >> Occasional committers would probably not read org-maintenance.org, and
> >> >> those are the people this section is aimed at, I think. Plus itʼs the
> >> >> kind of thing you need to catch early: once the commit has been pushed
> >> >> itʼs too late.
> >>
> Ihor> Not really. org-contribute.org is the page directly linked from
> Ihor> orgmode.org. It is aiming for new contributors with no write access.
> >>
> >> This particular change is in "Your first commit as an Org
> >> maintainer". Perhaps that node should be moved to org-maintenance.org?
>
> Ihor> I do not think so. I am seeing this section as a "crash course" for the
> Ihor> new maintainers. We should only provide the critical information there.
> Ihor> Not too much, not too less. Something to not scare people with the
> Ihor> details.
>
> I guess we disagree about whether knowing about the distinction
> between 'Author:' and 'Commit:' is critical or not. For a free
> software project correct attribution of changes is very important, so
> committers should pay attention to it (and by extension the
> documentation should educate them about it at the earliest
> opportunity). But youʼre the maintainer :-)
Maybe we are mis-communicating here.
AFAIU, carefully checking Author: and Commit: is only relevant when
applying commits made by people without commit access. Same goes for
checking the copyright status of the patch authors.
Occasional committers do not usually apply patches made by others.
> Ihor> The elaborate details should be in org-maintenance.org, which is
> Ihor> directly mentioned at the end of the "first commit" section.
>
> In "Where can I track bugs, patches and updates?" or somewhere else?
I think that "Copyright assignments" is suitable. "keep track of
copyright assignments" includes checking the copyright status of the
patch authors.
> BTW, Iʼm having trouble parsing this sentence from there:
>
> You don't much more: confirming bugs is a critical contribution.
>
> Thereʼs at least one word missing betweeen "donʼt" and "much" there.
Fixed. Should be
"You don't need to do much more: confirming bugs is a critical contribution."
Best,
Ihor
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: ox-latex table tabbing support.
2022-06-21 4:43 ` Daniel Fleischer
2022-06-24 13:37 ` Robert Pluim
@ 2022-06-26 1:54 ` Ihor Radchenko
2022-06-26 3:49 ` Kyle Meyer
1 sibling, 1 reply; 25+ messages in thread
From: Ihor Radchenko @ 2022-06-26 1:54 UTC (permalink / raw)
To: Daniel Fleischer; +Cc: emacs--- via General discussions about Org-mode., emacs
Daniel Fleischer <danflscr@gmail.com> writes:
> Thank you very much for the patch. It was merged to master in 4a0d951c.
> Also, you were added to the orgmode contributes at
> https://orgmode.org/worg/contributors.html.
>
> Thanks for the contribution.
This commit triggers
In org-latex--align-string-tabbing:
ox-latex.el:3713:54: Warning: Unused lexical variable `align'
Looking at the code, it does not look like align variable serve any
purpose. Can someone please double check if the patch is working as
intended?
Best,
Ihor
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: ox-latex table tabbing support.
2022-06-26 1:54 ` ox-latex table tabbing support Ihor Radchenko
@ 2022-06-26 3:49 ` Kyle Meyer
2022-06-26 14:46 ` [PATCH] " Daniel Fleischer
0 siblings, 1 reply; 25+ messages in thread
From: Kyle Meyer @ 2022-06-26 3:49 UTC (permalink / raw)
To: Ihor Radchenko, Daniel Fleischer; +Cc: emacs-orgmode, emacs
Ihor Radchenko writes:
> Daniel Fleischer <danflscr@gmail.com> writes:
>
>> Thank you very much for the patch. It was merged to master in 4a0d951c.
>> Also, you were added to the orgmode contributes at
>> https://orgmode.org/worg/contributors.html.
>>
>> Thanks for the contribution.
>
> This commit triggers
>
> In org-latex--align-string-tabbing:
> ox-latex.el:3713:54: Warning: Unused lexical variable `align'
>
> Looking at the code, it does not look like align variable serve any
> purpose. Can someone please double check if the patch is working as
> intended?
Thanks for flagging this, Ihor. I was just glancing at this commit
(4a0d951c6) due to seeing this warning. It's doing
(let ((align ...))
(setq align ...))
where the align value is returned, so the align binding can be dropped
altogether.
Daniel, in addition to that, there are at least a few other issues with
4a0d951c6 that should be addressed:
* the first line of the new docstrings should be a complete sentence.
For example
Return an appropriate LaTeX alignment string, for the
latex tabbing environment.
should be changed to something like
Return alignment string for LaTeX tabbing environment.
See (info "(elisp)Documentation Tips")
* the indentation is off in several places, including the start of the
docstrings. Please indent the code with, e.g., indent-region.
* one of org-table--org-tabbing's parameters is a typo (contenst),
which it looks like Ihor pointed out in an earlier review
* comment typo: documets
* several spots put opening and trailing parentheses on their own line
That goes against the usual conventions of this repo:
$ git grep '^ *)' '*.el' | wc -l
42
$ git grep '( *$' '*.el' | wc -l
17
* rather than doing something like
(let ((x ""))
(setq x <something else>)
...)
just do
(let ((x <something else>))
...)
And consider whether it's worth adding a binding at all rather than
inlining the code.
As an extreme case, org-table--org-tabbing does
(let ((output (format ...)))
output)
rather than
(format ...)
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH] Re: ox-latex table tabbing support.
2022-06-26 3:49 ` Kyle Meyer
@ 2022-06-26 14:46 ` Daniel Fleischer
2022-06-26 18:18 ` Kyle Meyer
0 siblings, 1 reply; 25+ messages in thread
From: Daniel Fleischer @ 2022-06-26 14:46 UTC (permalink / raw)
To: Kyle Meyer; +Cc: Ihor Radchenko, emacs-orgmode, emacs
[-- Attachment #1: Type: text/plain, Size: 1786 bytes --]
Kyle Meyer [2022-06-25 Sat 23:49] wrote:
> Thanks for flagging this, Ihor. I was just glancing at this commit
> (4a0d951c6) due to seeing this warning. It's doing
>
> (let ((align ...))
> (setq align ...))
>
> where the align value is returned, so the align binding can be dropped
> altogether.
>
> Daniel, in addition to that, there are at least a few other issues with
> 4a0d951c6 that should be addressed:
>
> * the first line of the new docstrings should be a complete sentence.
>
> For example
>
> Return an appropriate LaTeX alignment string, for the
> latex tabbing environment.
>
> should be changed to something like
>
> Return alignment string for LaTeX tabbing environment.
>
> See (info "(elisp)Documentation Tips")
>
> * the indentation is off in several places, including the start of the
> docstrings. Please indent the code with, e.g., indent-region.
>
> * one of org-table--org-tabbing's parameters is a typo (contenst),
> which it looks like Ihor pointed out in an earlier review
>
> * comment typo: documets
>
> * several spots put opening and trailing parentheses on their own line
>
> That goes against the usual conventions of this repo:
>
> $ git grep '^ *)' '*.el' | wc -l
> 42
> $ git grep '( *$' '*.el' | wc -l
> 17
>
> * rather than doing something like
>
> (let ((x ""))
> (setq x <something else>)
> ...)
>
> just do
>
> (let ((x <something else>))
> ...)
>
> And consider whether it's worth adding a binding at all rather than
> inlining the code.
>
> As an extreme case, org-table--org-tabbing does
>
> (let ((output (format ...)))
> output)
>
> rather than
>
> (format ...)
Thanks for the code feedback; patch attached.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 4810 bytes --]
From b041dd62cbeea924ea6d2b6dee9b1142aef968ec Mon Sep 17 00:00:00 2001
From: Daniel Fleischer <danflscr@gmail.com>
Date: Sun, 26 Jun 2022 17:25:00 +0300
Subject: [PATCH] lisp/ox-latex.el: tabbing code refactor
* lisp/ox-latex.el: documentation, indentation, cleaning
(org-latex-table)
(org-latex--align-string-tabbing)
(org-table--org-tabbing)
See
https://lists.gnu.org/archive/html/emacs-orgmode/2022-06/msg00700.html.
---
lisp/ox-latex.el | 66 +++++++++++++++++++++++-------------------------
1 file changed, 31 insertions(+), 35 deletions(-)
diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el
index 898fa34dd..1446b7fca 100644
--- a/lisp/ox-latex.el
+++ b/lisp/ox-latex.el
@@ -3667,7 +3667,8 @@ (defun org-latex-table (table contents info)
((or (string= type "math") (string= type "inline-math"))
(org-latex--math-table table info))
;; Case 3: Tabbing
- ((string= type "tabbing") (org-table--org-tabbing table contents info))
+ ((string= type "tabbing")
+ (org-table--org-tabbing table contents info))
;; Case 4: Standard table.
(t (concat (org-latex--org-table table contents info)
;; When there are footnote references within the
@@ -3706,32 +3707,29 @@ (defun org-latex--align-string (table info &optional math?)
(apply 'concat (nreverse align)))))
(defun org-latex--align-string-tabbing (table info)
- "Return an appropriate LaTeX alignment string, for the
-latex tabbing environment.
+ "Return LaTeX alignment string using tabbing environment.
TABLE is the considered table. INFO is a plist used as
a communication channel."
- (or (org-export-read-attribute :attr_latex table :align)
- (let ((align "")
- (count 0)
- (separator ""))
- ;; Count the number of cells in the first row.
- (setq count (length
- (org-element-map
- (org-element-map table 'table-row
- (lambda (row)
- (and (eq (org-element-property :type row) 'standard) row))
- info 'first-match)
- 'table-cell
- (lambda (cell) cell))))
- ;; Calculate the column width, using a proportion of the documets
- ;; textwidth.
- (setq separator (format
- "\\hspace{%s\\textwidth} \\= "
- (- (/ 1.0 count) 0.01)))
- (setq align (concat
- (apply 'concat (make-list count separator))
- "\\kill")))
- ))
+ (or (org-export-read-attribute :attr_latex table :align)
+ (let* ((count
+ ;; Count the number of cells in the first row.
+ (length
+ (org-element-map
+ (org-element-map table 'table-row
+ (lambda (row)
+ (and (eq (org-element-property :type row)
+ 'standard)
+ row))
+ info 'first-match)
+ 'table-cell
+ (lambda (cell) cell))))
+ ;; Calculate the column width, using a proportion of
+ ;;the documets textwidth.
+ (separator
+ (format "\\hspace{%s\\textwidth} \\= "
+ (- (/ 1.0 count) 0.01))))
+ (concat (apply 'concat (make-list count separator))
+ "\\kill"))))
(defun org-latex--decorate-table (table attributes caption above? info)
"Decorate TABLE string with caption and float environment.
@@ -3836,21 +3834,19 @@ (defun org-latex--org-table (table contents info)
(org-latex--decorate-table output attr caption above? info))))))
-(defun org-table--org-tabbing (table contenst info)
- "Return appropriate LaTeX code for an Org table, using the
-latex tabbing syntax.
+(defun org-table--org-tabbing (table contents info)
+ "Return tabbing environment latex code for Org table.
TABLE is the table type element to transcode. CONTENTS is its
contents, as a string. INFO is a plist used as a communication
channel.
+
This function assumes TABLE has `org' as its `:type' property and
`tabbing' as its `:mode' attribute."
- (let ((output (format "\\begin{%s}\n%s\n%s\\end{%s}"
- "tabbing"
- (org-latex--align-string-tabbing table info )
- contenst
- "tabbing")))
- output)
- )
+ (format "\\begin{%s}\n%s\n%s\\end{%s}"
+ "tabbing"
+ (org-latex--align-string-tabbing table info)
+ contents
+ "tabbing"))
(defun org-latex--table.el-table (table info)
"Return appropriate LaTeX code for a table.el table.
--
2.36.0
[-- Attachment #3: Type: text/plain, Size: 22 bytes --]
--
Daniel Fleischer
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH] Re: ox-latex table tabbing support.
2022-06-26 14:46 ` [PATCH] " Daniel Fleischer
@ 2022-06-26 18:18 ` Kyle Meyer
2022-06-26 18:48 ` Daniel Fleischer
0 siblings, 1 reply; 25+ messages in thread
From: Kyle Meyer @ 2022-06-26 18:18 UTC (permalink / raw)
To: Daniel Fleischer; +Cc: Ihor Radchenko, emacs-orgmode, emacs
Thanks for the follow-up patch.
Daniel Fleischer writes:
> Subject: [PATCH] lisp/ox-latex.el: tabbing code refactor
>
> * lisp/ox-latex.el: documentation, indentation, cleaning
> (org-latex-table)
> (org-latex--align-string-tabbing)
> (org-table--org-tabbing)
This format doesn't quite align to the conventions. Here are two
examples:
,----[ https://orgmode.org/worg/org-contribute.html#commit-messages ]
| * lisp/org-capture.el (org-capture-set-plist): Make sure txt is a
| string before calling `string-match'.
| (org-capture-templates): Fix customization type.
`----
,----[ https://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html#Style-of-Change-Logs ]
| * lisp/term.el (term-emulate-terminal): Avoid errors if the whole
| decoded string is eight-bit characters. Don't attempt to save the
| string for next iteration in that case.
| * test/lisp/term-tests.el (term-decode-partial)
| (term-undecodable-input): New tests.
`----
[...]
> + (or (org-export-read-attribute :attr_latex table :align)
> + (let* ((count
> + ;; Count the number of cells in the first row.
> + (length
> + (org-element-map
> + (org-element-map table 'table-row
> + (lambda (row)
> + (and (eq (org-element-property :type row)
> + 'standard)
> + row))
> + info 'first-match)
> + 'table-cell
> + (lambda (cell) cell))))
Fine as is, but (lambda (cell) cell) could be reduced to #'identity
> + ;; Calculate the column width, using a proportion of
> + ;;the documets textwidth.
nit: missing space before "the"
typo: documets -> document's
> +(defun org-table--org-tabbing (table contents info)
> + "Return tabbing environment latex code for Org table.
Perhaps s/latex/LaTeX/ for consistency?
Otherwise, looks good to me. Thanks again.
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2022-07-02 4:21 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-28 14:38 ox-latex table tabbing support emacs--- via General discussions about Org-mode.
2022-04-04 10:33 ` Ihor Radchenko
[not found] ` <87wng5nno3.fsf@localhost-Mzo7eKN----2>
2022-04-04 14:03 ` emacs--- via General discussions about Org-mode.
2022-06-21 4:43 ` Daniel Fleischer
2022-06-24 13:37 ` Robert Pluim
2022-06-24 14:20 ` Daniel Fleischer
2022-06-24 15:01 ` Robert Pluim
2022-06-24 15:50 ` Daniel Fleischer
2022-06-24 19:32 ` emacs--- via General discussions about Org-mode.
2022-06-25 3:32 ` Ihor Radchenko
2022-06-26 10:08 ` Robert Pluim
2022-06-26 13:47 ` [PATCH] describe how to override Author Robert Pluim
2022-06-26 14:04 ` Daniel Fleischer
2022-06-27 9:53 ` Ihor Radchenko
2022-06-28 12:07 ` Robert Pluim
2022-06-29 10:10 ` Ihor Radchenko
2022-06-30 8:18 ` Robert Pluim
2022-06-30 13:19 ` Ihor Radchenko
2022-06-30 15:17 ` Robert Pluim
2022-07-02 4:21 ` Ihor Radchenko
2022-06-26 1:54 ` ox-latex table tabbing support Ihor Radchenko
2022-06-26 3:49 ` Kyle Meyer
2022-06-26 14:46 ` [PATCH] " Daniel Fleischer
2022-06-26 18:18 ` Kyle Meyer
2022-06-26 18:48 ` Daniel Fleischer
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).