Re: bug#45915: 28.2; delete-char deletes two letters
>>> One other possibility is to use a slightly different :relative-width >>> factor for the two spaces in a table cell: one with the value of 1, >>> the other with 1.001 (say). They will be indistinguishable on >>> display, but since the values are not equal, both stretch gfyphs will >>> be displayed, not just one. >> >> This is a good idea. I used it to fix the reported issue. >> >> Fixed on main. > > Great. So I guess this bug report can be closed? Nice. Yes, please close this bug report.
bug#45915: 28.2; delete-char deletes two letters
I confirmed that delete-char still deletes two letters on emacs-version: 28.2, org-version: 9.5.5. I found out (org-table-align) in (org-table-copy-down) makes this situation. Can someone take a look (org-table-align)? TIA #+begin_src emacs-lisp (defun emacs-bug-reproduce-45915 () "Reproduce bug#45915." ;; (gnus-read-ephemeral-emacs-bug-group 45915) (interactive) (with-current-buffer (get-buffer-create "*temp buffer*") (erase-buffer) (require 'org) (orgtbl-mode 1) (insert (format "emacs-version: %s, org-version: %s\n" emacs-version org-version)) (insert "| 1 |")) (switch-to-buffer-other-window "*temp buffer*") (execute-kbd-macro (kbd "M-< C-n C-f C-f")) (message "I will call #'org-table-copy-down.") (sit-for 2) (call-interactively #'org-table-copy-down) (sit-for 2) (message "I will hit .") (sit-for 2) (execute-kbd-macro (kbd "")) (message "Two letters were deleted unexpectedly.")) ;;; (call-interactively 'emacs-bug-reproduce-45915) #+end_src
bug#45915: 28.1; delete-char deletes two letters
As Ihor pointed out, delete-char deletes two letters. Can someone take a look and evaluate if this is issue with delete-char? I simplified the recipes as shown below. #+begin_src emacs-lisp (defun emacs-bug-reproduce-45915 () "Reproduce bug#45915." ;; (gnus-read-ephemeral-emacs-bug-group 45915) (interactive) (with-current-buffer (get-buffer-create "*temp buffer*") (erase-buffer) (require 'org) (orgtbl-mode 1) (insert (format "emacs-version: %s, org-version: %s\n" emacs-version org-version)) (insert "| 1 |")) (switch-to-buffer-other-window "*temp buffer*") (execute-kbd-macro (kbd "M-< C-n C-f C-f")) (message "I will hit .") (sit-for 2) (execute-kbd-macro (kbd "")) (sit-for 2) (message "I will hit .") (sit-for 2) (execute-kbd-macro (kbd "")) (message "Two letters were deleted unexpectedly.")) ;;; (call-interactively 'emacs-bug-reproduce-45915) #+end_src
bug#45915: 28.0.90; deletechar distorts org-table
Dear Ihor, > However, this (delete-char 1) somehow deletes 2!! chars instead of > 1. This should be some tricky Emacs issue (bug?). In any case, I am > not ready to dig into what is going on in Emacs. I do not think that > such problem is going to appear during normal Emacs usage. At least, I > was unable to reproduce it by other means than your reproducer > function. > > To illustrate the issue, one can use the following version of the > reproducer. Feel free to report this to Emacs upstream. (defun emacs-bug-reproduce-45915 () "Reproduce bug#45915." ;; (gnus-read-ephemeral-emacs-bug-group 45915) (interactive) (with-current-buffer (get-buffer-create "*temp buffer*") (erase-buffer) (require 'org) (orgtbl-mode 1) (insert (format "emacs-version: %s, org-version: %s\n" emacs-version org-version)) (insert "| | rownames | | / | | |---+--| | | a|")) (switch-to-buffer-other-window "*temp buffer*") (execute-kbd-macro (kbd "M-< C-n C-n C-n C-n C-f C-f")) (message "I will hit S-.") (sit-for 2) (execute-kbd-macro (kbd "S-")) (message "I will hit .") (sit-for 2) ;; (execute-kbd-macro (kbd "")) (delete-char 1) (message "I will call previous-line.") (sit-for 2) (call-interactively 'previous-line)) I still see the problem with GNU Emacs 29.0.50 (build 8, x86_64-apple-darwin21.5.0, NS appkit-2113.50 Version 12.4 (Build 21F79)) of 2022-05-23 with org-version 9.5.3. I create org-tables and revise these everyday. On duplication of a cell, I hit S- often. The problem occurs, with my use case, once in 5 minutes. IOW point moves unexpectedly once in 5 minutes. I think that there is an issue in `org-table-copy-down'. However, I cannot tell what specifically is not good. Is this issue of Emacs instead of Org?
bug#45915: 28.0.90; deletechar distorts org-table
Dear Ihor Thank you for the patch. I applied the patch to org-table.el on Emacs 28.0.90. And I still see the problem there. Is the problem solved by the patch on your environment? Tak Ihor Radchenko writes: > Tak Kunihiro writes: > >> I confirm that there still is the problem with org-table on Emacs >> 28.0.90 pretest with org-version 9.5.1. >> >> Here is a recipe to reproduce the problem. I still have to stick to >> 26.3. > > I was able to reproduce. Can you try the attached fix? > > Best, > Ihor > > From 7b1a7d43e090292b6bd821c65a644f8c599b2044 Mon Sep 17 00:00:00 2001 > Message-Id: > <7b1a7d43e090292b6bd821c65a644f8c599b2044.1639918362.git.yanta...@gmail.com> > From: Ihor Radchenko > Date: Sun, 19 Dec 2021 20:49:54 +0800 > Subject: [PATCH] org-table.el: Fix orgtbl-mode not remapping delete key > > * lisp/org-table.el (orgtbl-setup): Remap `delete-forward-char' in > addition to `deleta-char'. The former is called in Emacs >26. > > Fixes > https://orgmode.org/list/1ad1b9b7-5a15-4f86-9274-b04b83694...@misasa.okayama-u.ac.jp > --- > lisp/org-table.el | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lisp/org-table.el b/lisp/org-table.el > index 1546cd563..0560e32a1 100644 > --- a/lisp/org-table.el > +++ b/lisp/org-table.el > @@ -5290,6 +5290,7 @@ (defun orgtbl-setup () >(org-remap orgtbl-mode-map >'self-insert-command 'orgtbl-self-insert-command >'delete-char 'org-delete-char > + 'delete-forward-char 'org-delete-char >'delete-backward-char 'org-delete-backward-char) >(org-defkey orgtbl-mode-map "|" 'org-force-self-insert)) > t))
bug#45915: 28.0.90; deletechar distorts org-table
I confirm that there still is the problem with org-table on Emacs 28.0.90 pretest with org-version 9.5.1. Here is a recipe to reproduce the problem. I still have to stick to 26.3. 1. emacs -Q 2. (defun emacs-bug-reproduce-45915 () ...) 3. (call-interactively 'emacs-bug-reproduce-45915) (defun emacs-bug-reproduce-45915 () "Reproduce bug#45915." ;; (gnus-read-ephemeral-emacs-bug-group 45915) (interactive) (with-current-buffer (get-buffer-create "*temp buffer*") (erase-buffer) (require 'org) (orgtbl-mode 1) (insert (format "emacs-version: %s, org-version: %s\n" emacs-version org-version)) (insert "| | rownames | | / | | |---+--| | | a|")) (switch-to-buffer-other-window "*temp buffer*") (execute-kbd-macro (kbd "M-< C-n C-n C-n C-n C-f C-f")) (message "I will hit S-.") (sit-for 2) (execute-kbd-macro (kbd "S-")) (message "I will hit .") (sit-for 2) (execute-kbd-macro (kbd "")) (message "I will call previous-line.") (sit-for 2) (call-interactively 'previous-line)) > I confirm that there is still problem with org-table > on Emacs 29.0.50 with org-version 9.5. > I confirm that there still is following problem on 27.1.91. Could someone take a look and show me work around? >>> >>> I cannot reproduce this with latest Org stable version 9.4.5. >>> >>> Can you try again and report? >> >> I downloaded Org 9.4.5 and reproduced the problem on 26.3, 27.2, >> and 28.0.50. Here is a recipe again. >> >>> On certain condition, typing distorts alignment of >>> a table. Then, typing moves point to previous line but far >>> right position (column 14 instead of column 2). >>> >>> | | rownames | | | rownames | >>> | / | | | / | | >>> |---+--| -> |---+--| >>> | / | a| | | a| >>> >>> Here is a recipe to reproduce the glitch started from emcas -Q. >>> >>> 1. Create a buffer with (text-mode) and yank following table. >>> >>> | | rownames | >>> | / | | >>> |---+--| >>> | | a| >>> >>> 2. (progn (require 'org) (call-interactively 'orgtbl-mode)) >>> 3. Move point to the first column and the third line with letter 'a'. >>> 4. Hit . >>> 5. Hit . >>> 6. Hit .
bug#45915: 29.0.50; deletechar distorts org-table
I confirm that there is still problem with org-table on Emacs 29.0.50 with org-version 9.5. I created a function to produce the problem as shown below. Can you try again? (defun emacs-bug-reproduce-45915 () "Reproduce bug#45915." ;; (gnus-read-ephemeral-emacs-bug-group 45915) (interactive) (with-current-buffer (get-buffer-create "*temp buffer*") (erase-buffer) (require 'org) (orgtbl-mode 1) (insert (format "emacs-version: %s, org-version: %s\n" emacs-version org-version)) (insert "| | rownames | | / | | |---+--| | | a|")) (switch-to-buffer-other-window "*temp buffer*") (execute-kbd-macro (kbd "M-< C-n C-n C-n C-n C-f C-f")) (message "I will hit S-.") (sit-for 2) (execute-kbd-macro (kbd "S-")) (message "I will hit .") (sit-for 2) (execute-kbd-macro (kbd "")) (message "I will call previous-line.") (sit-for 2) (call-interactively 'previous-line)) ;;; (call-interactively 'emacs-bug-reproduce-45915) >>> I confirm that there still is following problem on 27.1.91. >>> Could someone take a look and show me work around? >> >> I cannot reproduce this with latest Org stable version 9.4.5. >> >> Can you try again and report? > > I downloaded Org 9.4.5 and reproduced the problem on 26.3, 27.2, > and 28.0.50. Here is a recipe again. > >> On certain condition, typing distorts alignment of >> a table. Then, typing moves point to previous line but far >> right position (column 14 instead of column 2). >> >> | | rownames | | | rownames | >> | / | | | / | | >> |---+--| -> |---+--| >> | / | a| | | a| >> >> Here is a recipe to reproduce the glitch started from emcas -Q. >> >> 1. Create a buffer with (text-mode) and yank following table. >> >> | | rownames | >> | / | | >> |---+--| >> | | a| >> >> 2. (progn (require 'org) (call-interactively 'orgtbl-mode)) >> 3. Move point to the first column and the third line with letter 'a'. >> 4. Hit . >> 5. Hit . >> 6. Hit .
bug#45915: 27.2; deletechar distorts org-table
>> I confirm that there still is following problem on 27.1.91. >> Could someone take a look and show me work around? > > I cannot reproduce this with latest Org stable version 9.4.5. > > Can you try again and report? I downloaded Org 9.4.5 and reproduced the problem on 26.3, 27.2, and 28.0.50. Here is a recipe again. > On certain condition, typing distorts alignment of > a table. Then, typing moves point to previous line but far > right position (column 14 instead of column 2). > > | | rownames | | | rownames | > | / | | | / | | > |---+--| -> |---+--| > | / | a| | | a| > > Here is a recipe to reproduce the glitch started from emcas -Q. > > 1. Create a buffer with (text-mode) and yank following table. > > | | rownames | > | / | | > |---+--| > | | a| > > 2. (progn (require 'org) (call-interactively 'orgtbl-mode)) > 3. Move point to the first column and the third line with letter 'a'. > 4. Hit . > 5. Hit . > 6. Hit .
bug#45915: 27.1.91; deletechar distorts org-table
I confirm that there still is following problem on 27.1.91. Could someone take a look and show me work around? > I am using emacs 27.1 with orgtbl-mode. On certain condition, typing > distorts alighment of a table. Then, typing moves > previous line but far right position. > > | | rownames | | | rownames | > | / | | | / | | > |---+--| -> |---+--| > | / | a| | | a| > > Here is a recipe to reproduce the glitch started from emcas -Q. I > hope that together with bug#45091, this would be fixed before 27.2. > > 1. Create a buffer with (text-mode) and yank following table. > > | | rownames | > | / | | > |---+--| > | | a| > > 2. (progn (require 'org) (call-interactively 'orgtbl-mode)) > 3. Move point to the first column and the third line with letter 'a'. > 4. Hit . > 5. Hit . > 6. Hit .
bug#45091: 27.1; M-x org-table-paste-rectangle
Naoya showed me workaround. #+begin_src emacs-lisp (when (equal emacs-major-version 27) (with-eval-after-load "org-compat" (defalias 'org-font-lock-ensure 'ignore))) #+end_src Now I switched from 26.3 to 27.1.
bug#45091: 27.1; M-x org-table-paste-rectangle
>> > I'll keep looking a bit, but at this point it doesn't seem to have >> > anything to do with the antiblink feature. I might be wrong, but I >> > think that only shows up first in the messages buffer because it's >> > unlucky enough to be one of the first users of syntax-ppss after a >> > command. >> >> I confirmed that I can reproduce the problem with 27.1.90. Although the >> recipe seems complicated, I see the problem quite often when I work with >> LaTeX-mode. I still have to stick on 26.3. >> >> I appreciate if the problem would be fixed. > > Are you familiar with `git bisect`? It's a bit of work, but it usually points > to the culprit commit. Emacs history is very good. I don't have > time for this right now, but maybe you have? It's a question > of compiling Emacs methodically and then testing your recipe > each time. I am not familiar with `git bisect` but I understand how to detect the source of the problem. I will ... try.
bug#45091: 27.1; M-x org-table-paste-rectangle
> I'll keep looking a bit, but at this point it doesn't seem to have > anything to do with the antiblink feature. I might be wrong, but I > think that only shows up first in the messages buffer because it's > unlucky enough to be one of the first users of syntax-ppss after a > command. I confirmed that I can reproduce the problem with 27.1.90. Although the recipe seems complicated, I see the problem quite often when I work with LaTeX-mode. I still have to stick on 26.3. I appreciate if the problem would be fixed.
bug#45091: 27.1; M-x org-table-paste-rectangle
> Tak Kunihiro, what is in your opinion the deciding character of these > files? I.e. what did you change from the first file (where I couldn't > reproduce) to the second? The difference between the first and the second files is, the existence of plain sentences after the second org-table. I see the problem randomly when I make a LaTeX table using org-mode radio-table. I was writing a recipe with the two org-tables. I thought that org-tables are the essence of the problem; however, it seems that org-tables followed by plain sentences seems to be the source of the problem. Again, I do not see problem on 26.3.
[O] orgtbl-to-matlab
Since LaTeX + radiotable is so comfortable, I start to use it on MATLAB coding. The translator may be useful for some and I want to let you know. %{ #+ORGTBL: SEND tbl:radiotable orgtbl-to-matlab :no-escape t |x | y | symbol | |--+---+| | 0.79 | 0.243 | + | | 0.78 | 0.230 | x | | 0.78 | 0.242 | . | %} % BEGIN RECEIVE ORGTBL tbl:radiotable x = [0.79 0.78 0.78]; y = [0.243 0.230 0.242]; symbol = {'+','x','.'}; % END RECEIVE ORGTBL tbl:radiotable (defun orgtbl-to-matlab (table params) Convert the orgtbl-mode table to MATLAB statements. (let* ((*list-is-num* org-table-last-alignment) (*table-flip* (orgtbl-to-orgtbl-flip table)) (*index* (number-sequence 0 (1- (length *table-flip*) (mapconcat (lambda (ii) (orgtbl-to-matlab--column (nth ii *table-flip*) params (nth ii *list-is-num*))) *index* \n))) (defun orgtbl-to-matlab--column (table-nth-col params is-num-p) Convert a column of the orgtbl-mode table to a MATLAB statement. (let ((params2 (list :lstart (if is-num-p [ {') :sep(if is-num-p ',') :lend (if is-num-p ]; '};) :no-escape t)) (*var-name* (car table-nth-col)) (*dataset* (cdr table-nth-col))) (if is-num-p ;; return NaN when a cell in orgtbl is empty (setq *dataset* (mapcar (lambda (x) (if (string= x ) NaN x)) *dataset*))) (format %s = %s *var-name* (orgtbl-to-generic (list *dataset*) (org-combine-plists params2 params) (defun orgtbl-to-orgtbl-flip (table) Flip the orgtbl-mode table. (with-temp-buffer (insert (orgtbl-to-orgtbl table nil)) (goto-char (1+ (org-table-begin))) (org-table-transpose-table-at-point) (goto-char (1+ (org-table-begin))) (org-table-to-lisp)))
Re: [O] Create a longtable in LaTeX from orgtbl
http://lists.gnu.org/archive/html/emacs-orgmode/2014-06/msg00634.html Thank you for responses in regard to making a longtable using a radio table. I found a way and want to let you know. \begin{footnotesize} \begin{center} % BEGIN RECEIVE ORGTBL tbl:greate-results % END RECEIVE ORGTBL tbl:greate-results \iffalse #+ORGTBL: SEND tbl:greate-results orgtbl-to-latex-long :no-escape t |+-+-| | date | session | remarks | |+-+-| | 2014-10-11 | s141011 | foo | |+-+-| \fi \end{center} \end{footnotesize} (defun orgtbl-to-latex-long (table params) Convert the orgtbl-mode TABLE to long TABLE in LaTeX. (let* ((alignment (mapconcat (lambda (x) (if x r l)) org-table-last-alignment )) (params-common (list :lstart:lend :sep :efmt %s\\,(%s) :hline \\hline)) (params0 (list :tstart (concat \\begin{longtable}{ alignment }\n \\caption{ (orgtbl-util-last-latex caption) } % 1ST HEADER) :tend (concat\\endfirsthead\n \\caption{Continued} % 2ND HEADER))) (params2 (list :tstart (concat \\endhead\n % ) :tend (concat% \n \\label{ (orgtbl-util-last-latex label) }\n \\end{longtable}))) (table-head (list (car table))) ; store 1st row (table-body (cdr table)) head0 head1 body *table-head-rtn*) ;; look for hline as head-body separator (when (memq 'hline table-body) (setq *table-head-rtn* (reverse table-head)) ; to use `push' instead of `append' (while (not (eq 'hline (car table-body))) ; check for 2nd+ row (push (car table-body) *table-head-rtn*) (pop table-body)) (push 'hline *table-head-rtn*) (pop table-body) (setq table-head (reverse *table-head-rtn*))) ;; create text (setq head0 (orgtbl-to-generic table-head (org-combine-plists params-common params0 params))) (setq head1 (orgtbl-to-generic table-head (org-combine-plists params-common params))) (setq body (orgtbl-to-generic table-body (org-combine-plists params-common params2 params))) (concat head0 \n head1 \n body))) (defun orgtbl-util-last-latex (command) Go backward until `begin{longtable}' or beginning of current buffer and obtain first content in curly bracket of COMMAND. (save-excursion (let* ((end (point)) (start (or (search-backward begin{longtable} nil t) (point-min))) (string-to-search (buffer-substring start end))) (string-match (concat \\ command {\\([^}]*\\)}) string-to-search) (match-string 1 string-to-search
[O] Emacs speaks to spreadsheet
To make a plot using org-babel/R with org-table (as data.frame) is an ultimate weapon for me. Thank you for development. Occasionally I want to transport datasets between Excel and org-table. Two essential operations are (a) to copy cells from Excel and paste into org-table and (b) other way around. How those would work is describe as below. (a) Copy cells from Excel and paste into org-table - Datasets copied at Excel are stored in kill-ring as tabulated text. Tabulated text would be converted into org-table-clip. - A user selects a cell in org-table and pastes the datasets by (org-table-paste-rectangle) (b) Copy cells from org-table and paste into Excel - A user selects cells by mouse drag on org-table and copies datasets by (org-table-copy-region). - The datasets are store as org-table-clip. They would be converted into tabulated text and stored in kill-ring. - A user will paste the datasets in Excel When those are assigned to (a) M-s-v and (b) M-s-c, Emacs speaks to spreadsheet nicer than I expected. I want to let you know! Followings barely work. -- (global-set-key (kbd M-s-x) 'orgtbl-cell-cut) (global-set-key (kbd M-s-c) 'orgtbl-cell-copy) (global-set-key (kbd M-s-v) 'orgtbl-cell-paste) (defun orgtbl-cell-copy () Copy cells in org-table and store as tabulated text in kill-ring. (interactive) (if (org-at-table-p) (progn (call-interactively 'org-table-copy-region) (clip-orgtbl2tab) (exchange-point-and-mark)) (call-interactively 'copy-rectangle-as-kill) (clip-rectangle2text))) (defun orgtbl-cell-cut () Cut cells in org-table and store as tabulated text in kill-ring. (interactive) (if (org-at-table-p) (progn (call-interactively 'org-table-cut-region) (clip-orgtbl2tab)) (call-interactively 'kill-rectangle) (clip-rectangle2text))) (defun orgtbl-cell-paste (optional arg) Paste tabulated text stored in kill-ring into org-table. If point is not on org-table, this creates a new org-table. (interactive P) (cond (arg (org-table-paste-rectangle)) ((org-at-table-p) ; (org-table-check-inside-data-field t) (clip-tab2orgtbl) (org-table-paste-rectangle)) (t (let (tempclip-in-orgtbl) (with-temp-buffer (org-table-create 1x1) (goto-char (+ 1 (point))) (clip-tab2orgtbl) (org-table-paste-rectangle) (mark-whole-buffer) (setq tempclip-in-orgtbl (buffer-substring (point-min) (point-max (insert tempclip-in-orgtbl) (defun clip-tab2orgtbl () Create org-table-clip from tabulated text stored in kill-ring. (with-temp-buffer (org-mode) (yank) (orochi-tbl-tab2org (point-min) (point-max)) (goto-char (+ 1 (point-min))) (org-table-align) (org-table-copy-region (+ 1 (point-min)) (- (point-max) 2 (defun clip-orgtbl2tab () Store tabulated text to kill-ring that was converted from org-table-clip. (with-temp-buffer (org-mode) (org-table-create 1x1) (goto-char (+ 1 (point-min))) (org-table-paste-rectangle) (mark-whole-buffer) (call-interactively 'orochi-tbl-org2tab) (mark-whole-buffer) (call-interactively 'kill-region))) (defun clip-rectangle2text () Convert killed-rectangle to normal text and store in kill-ring. (with-temp-buffer (yank-rectangle) (mark-whole-buffer) (call-interactively 'kill-region))) (defun orochi-tbl-org2tab (start end) Convert orgtbl on region to tab delimited text (interactive r) (orochi-replace-regexps '((^\s*\|\-.*\n . ) (^\s*\|\s*. ) (\s*\|\s*$. ) (\s*\|\s* . )) start end)) (defun orochi-replace-regexps (rep-list start end) Find and replace region for a set of regexps (save-excursion (save-restriction (narrow-to-region start end) (dolist (re-rep rep-list) (goto-char (point-min)) (while (re-search-forward (car re-rep) nil t) (replace-match (cdr re-rep)))
[O] Create a longtable in LaTeX from orgtbl
Dear all, Can you show how to create a longtable in LaTeX from orgtbl? When a table in short, I create a LaTeX table in following way, as demonstrated in manual. https://www.gnu.org/software/emacs/manual/html_node/org/A-LaTeX-example.html #+BEGIN_SRC LaTeX \begin{table}[htdp] \begin{center} \caption{My great results} % BEGIN RECEIVE ORGTBL tbl:my-short-table % END RECEIVE ORGTBL tbl:my-short-table \iffalse #+ORGTBL: SEND tbl:my-short-table orgtbl-to-latex :no-escape t |+-+| | date | session | remark | |+-+| | 2014-06-18 | s140618 || |+-+| \fi \label{tbl:my-short-table} \end{center} \end{table} #+END_SRC For longtable, I do in following way. It barely works, but I have to copy and paste header every time orgtbl is tossed to RECEIVE. Can you show how to create a longtable in LaTeX from orgtbl? Thank you in advance. Tak #+BEGIN_SRC LaTeX %% \usepackage{longtable} \begin{center} \begin{longtable}{ rll } \caption{My great results}\\ \hline % --- for 1st page --- date session remarks \\ % \hline \endfirsthead \caption{Continued}\\ \hline % --- for 2nd+ page -- date session remarks \\ % \hline \endhead % % BEGIN RECEIVE ORGTBL tbl:my-long-table % END RECEIVE ORGTBL tbl:my-long-table \iffalse #+ORGTBL: SEND tbl:my-long-table orgtbl-to-longtbl :no-escape t :splice nil :skip 0 | % date | session | remarks | | 2014-06-18 | s140618 | foo | \fi % \hline \label{tbl:my-long-table} \end{longtable} \end{center} #+END_SRC #+BEGIN_SRC emacs-lisp (defun orgtbl-to-longtbl (table params) Convert the Orgtbl mode TABLE to LaTeX. (let* ((alignment (mapconcat (lambda (x) (if x r l)) org-table-last-alignment )) (params2 (list :tstart (concat % \\begin{longtable}{ alignment }) :lstart :lend :sep :efmt %s\\,(%s) :hline \\hline))) (orgtbl-to-generic table (org-combine-plists params2 params #+END_SRC