From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yu Han Quek Subject: =?UTF-8?B?QnVnOiBvcmctdGFibGUtaW5zZXJ0LWNvbHVtbiBlZGl0cyBmb3Jt?= =?UTF-8?B?dWxhcyB3cm9uZ2x5IFs5LjMgKHJlbGVhc2VfOS4zIEAgL3Vzci9sb2NhbC9D?= =?UTF-8?B?ZWxsYXIvZW1hY3MtcGx1cy9IRUFELTlkMzg1NjQvc2hhcmUvZW1hY3MvMjgu?= =?UTF-8?B?MC41MC9saXNwL29yZy8pXQ==?= Date: Tue, 31 Mar 2020 00:04:50 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000072e4c05a2149d8a" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:45241) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jIwuS-00065z-K5 for emacs-orgmode@gnu.org; Mon, 30 Mar 2020 12:05:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jIwuP-0008K7-Ip for emacs-orgmode@gnu.org; Mon, 30 Mar 2020 12:05:08 -0400 Received: from mail-yb1-xb2a.google.com ([2607:f8b0:4864:20::b2a]:41740) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jIwuP-0008GW-8a for emacs-orgmode@gnu.org; Mon, 30 Mar 2020 12:05:05 -0400 Received: by mail-yb1-xb2a.google.com with SMTP id t10so1818687ybk.8 for ; Mon, 30 Mar 2020 09:05:02 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane-mx.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --000000000000072e4c05a2149d8a Content-Type: text/plain; charset="UTF-8" Calling org-table-insert-column in a table with formulas wrongly increments the column number left of the newly inserted column. Minimal example: | 1 | 2 | 3 | #+TBLFM: $3=$1+$2 With cursor in the `1` cell, call `M-x org-table-insert-column`. Expected output: | 1 | | 2 | 3 | #+TBLFM: $4=$1+$3 Actual output ($1 wrongly changed to $2): | 1 | | 2 | 3 | #+TBLFM: $4=$2+$3 The bug seems to be in the last 2 lines of the function org-table-insert-column: (org-table-fix-formulas "$" nil (1- col) 1) (org-table-fix-formulas "$LR" nil (1- col) 1) Changing `(1- col)` to `col` solves the issue. ------------------------------------------------------------------------ Emacs : GNU Emacs 28.0.50 (build 2, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G1012)) of 2020-01-05 Package: Org mode version 9.3 (release_9.3 @ /usr/local/Cellar/emacs-plus/HEAD-9d38564/share/emacs/28.0.50/lisp/org/) current state: ============== (setq org-src-mode-hook '(org-src-babel-configure-edit-buffer org-src-mode-configure-edit-buffer) org-link-shell-confirm-function 'yes-or-no-p org-metadown-hook '(org-babel-pop-to-session-maybe) org-clock-out-hook '(org-clock-remove-empty-clock-drawer) org-mode-hook '(#[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-show-all append local] 5] #[0 "\300\301\302\303\304$\207" [add-hook change-major-mode-hook org-babel-show-result-all append local] 5] org-babel-result-hide-spec org-babel-hide-all-hashes) org-archive-hook '(org-attach-archive-delete-maybe) org-confirm-elisp-link-function 'yes-or-no-p org-agenda-before-write-hook '(org-agenda-add-entry-text) org-metaup-hook '(org-babel-load-in-session-maybe) org-bibtex-headline-format-function #[257 "\300 \236A\207" [:title] 3 "\n\n(fn ENTRY)"] org-babel-pre-tangle-hook '(save-buffer) org-tab-first-hook '(org-babel-hide-result-toggle-maybe org-babel-header-arg-expand) org-occur-hook '(org-first-headline-recenter) org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show-empty-lines org-optimize-window-after-visibility-change) org-speed-command-hook '(org-speed-command-activate org-babel-speed-command-activate) org-confirm-shell-link-function 'yes-or-no-p org-link-parameters '(("attachment" :follow org-attach-open-link :export org-attach-export-link :complete org-attach-complete-link) ("id" :follow org-id-open) ("eww" :follow eww :store org-eww-store-link) ("rmail" :follow org-rmail-open :store org-rmail-store-link) ("mhe" :follow org-mhe-open :store org-mhe-store-link) ("irc" :follow org-irc-visit :store org-irc-store-link :export org-irc-export) ("info" :follow org-info-open :export org-info-export :store org-info-store-link) ("gnus" :follow org-gnus-open :store org-gnus-store-link) ("docview" :follow org-docview-open :export org-docview-export :store org-docview-store-link) ("bibtex" :follow org-bibtex-open :store org-bibtex-store-link) ("bbdb" :follow org-bbdb-open :export org-bbdb-export :complete org-bbdb-complete-link :store org-bbdb-store-link) ("w3m" :store org-w3m-store-link) ("file+sys") ("file+emacs") ("shell" :follow org-link--open-shell) ("news" :follow #[257 "\301\300\302 Q!\207" ["news" browse-url ":"] 5 "\n\n(fn URL)"] ) ("mailto" :follow #[257 "\301\300\302 Q!\207" ["mailto" browse-url ":"] 5 "\n\n(fn URL)"] ) ("https" :follow #[257 "\301\300\302 Q!\207" ["https" browse-url ":"] 5 "\n\n(fn URL)"] ) ("http" :follow #[257 "\301\300\302 Q!\207" ["http" browse-url ":"] 5 "\n\n(fn URL)"] ) ("ftp" :follow #[257 "\301\300\302 Q!\207" ["ftp" browse-url ":"] 5 "\n\n(fn URL)"] ) ("help" :follow org-link--open-help) ("file" :complete org-link-complete-file) ("elisp" :follow org-link--open-elisp) ("doi" :follow org-link--open-doi)) org-link-elisp-confirm-function 'yes-or-no-p ) --000000000000072e4c05a2149d8a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Calling org-table-insert-column in a table with formu= las wrongly increments the column number left of the newly inserted column.=

Minimal example:

| 1 | 2= | 3 |
#+TBLFM: $3=3D$1+$2

With cursor in t= he `1` cell, call `M-x org-table-insert-column`.

E= xpected output:

| 1 | =C2=A0 | 2 | 3 |
#+TBLFM:= $4=3D$1+$3

Actual output ($1 wrongly changed = to $2):=C2=A0

| 1 | =C2=A0 | 2 | 3 |
#+TBLFM: $= 4=3D$2+$3


The bug seems to be i= n the last 2 lines of the function=C2=A0org-table-insert-column:
=
=C2=A0 =C2=A0 =C2=A0 (org-table-fix-formulas "$" n= il (1- col) 1)
=C2=A0 =C2=A0 =C2=A0 (org-table-fix-formulas &= quot;$LR" nil (1- col) 1)

Changing `(1- c= ol)` to `col` solves the issue.


-------------------= -----------------------------------------------------

Emacs =C2=A0: = GNU Emacs 28.0.50 (build 2, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Ve= rsion 10.14.6 (Build 18G1012))
=C2=A0of 2020-01-05
Package: Org mode = version 9.3 (release_9.3 @ /usr/local/Cellar/emacs-plus/HEAD-9d38564/share/= emacs/28.0.50/lisp/org/)

current state:
=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D
(setq
=C2=A0org-src-mode-hook '(org-src-babel-= configure-edit-buffer
=C2=A0 =C2=A0 org-src-mode-configure-edit-buffe= r)
=C2=A0org-link-shell-confirm-function 'yes-or-no-p
=C2=A0org-m= etadown-hook '(org-babel-pop-to-session-maybe)
=C2=A0org-clock-out-h= ook '(org-clock-remove-empty-clock-drawer)
=C2=A0org-mode-hook '= (#[0 "\300\301\302\303\304$\207"
=C2=A0 [add-hook change-ma= jor-mode-hook org-show-all append local]
=C2=A0 5]
#[0 "\3= 00\301\302\303\304$\207"
=C2=A0 [add-hook change-major-mode-hook= org-babel-show-result-all
=C2=A0 =C2=A0append local]
=C2=A0 5]=
org-babel-result-hide-spec org-babel-hide-all-hashes)
=C2=A0org-a= rchive-hook '(org-attach-archive-delete-maybe)
=C2=A0org-confirm-eli= sp-link-function 'yes-or-no-p
=C2=A0org-agenda-before-write-hook = 9;(org-agenda-add-entry-text)
=C2=A0org-metaup-hook '(org-babel-load= -in-session-maybe)
=C2=A0org-bibtex-headline-format-function #[257 "= ;\300 \236A\207" [:title] 3 "\n\n(fn ENTRY)"]
=C2=A0org-b= abel-pre-tangle-hook '(save-buffer)
=C2=A0org-tab-first-hook '(o= rg-babel-hide-result-toggle-maybe
=C2=A0 =C2=A0 =C2=A0org-babel-heade= r-arg-expand)
=C2=A0org-occur-hook '(org-first-headline-recenter)=C2=A0org-cycle-hook '(org-cycle-hide-archived-subtrees org-cycle-show= -empty-lines
=C2=A0org-optimize-window-after-visibility-change)
= =C2=A0org-speed-command-hook '(org-speed-command-activate
=C2=A0= org-babel-speed-command-activate)
=C2=A0org-confirm-shell-link-function = 'yes-or-no-p
=C2=A0org-link-parameters '(("attachment"= :follow org-attach-open-link :export
org-attach-export-link :complet= e
org-attach-complete-link)
=C2=A0 =C2=A0 =C2=A0 ("id"= ; :follow org-id-open)
=C2=A0 =C2=A0 =C2=A0 ("eww" :follow = eww :store org-eww-store-link)
=C2=A0 =C2=A0 =C2=A0 ("rmail"= ; :follow org-rmail-open :store
org-rmail-store-link)
=C2=A0 = =C2=A0 =C2=A0 ("mhe" :follow org-mhe-open :store org-mhe-store-li= nk)
=C2=A0 =C2=A0 =C2=A0 ("irc" :follow org-irc-visit :stor= e org-irc-store-link
:export org-irc-export)
=C2=A0 =C2=A0 =C2= =A0 ("info" :follow org-info-open :export org-info-export
:= store org-info-store-link)
=C2=A0 =C2=A0 =C2=A0 ("gnus" :fo= llow org-gnus-open :store
org-gnus-store-link)
=C2=A0 =C2=A0 = =C2=A0 ("docview" :follow org-docview-open :export
org-docv= iew-export :store org-docview-store-link)
=C2=A0 =C2=A0 =C2=A0 ("= ;bibtex" :follow org-bibtex-open :store
org-bibtex-store-link) =C2=A0 =C2=A0 =C2=A0 ("bbdb" :follow org-bbdb-open :export o= rg-bbdb-export
:complete org-bbdb-complete-link :store
org-bbdb= -store-link)
=C2=A0 =C2=A0 =C2=A0 ("w3m" :store org-w3m-sto= re-link) ("file+sys")
=C2=A0 =C2=A0 =C2=A0 ("file+emac= s") ("shell" :follow org-link--open-shell)
=C2=A0 =C2= =A0 =C2=A0 ("news" :follow
#[257 "\301\300\302 Q!\207&= quot; ["news" browse-url ":"] 5
=C2=A0"\n\n= (fn URL)"]
)
=C2=A0 =C2=A0 =C2=A0 ("mailto" :fol= low
#[257 "\301\300\302 Q!\207" ["mailto" browse-= url ":"]
=C2=A05 "\n\n(fn URL)"]
)
= =C2=A0 =C2=A0 =C2=A0 ("https" :follow
#[257 "\301\300\= 302 Q!\207" ["https" browse-url ":"]
=C2=A0= 5 "\n\n(fn URL)"]
)
=C2=A0 =C2=A0 =C2=A0 ("http&= quot; :follow
#[257 "\301\300\302 Q!\207" ["http"= browse-url ":"] 5
=C2=A0"\n\n(fn URL)"]
)=
=C2=A0 =C2=A0 =C2=A0 ("ftp" :follow
#[257 "\301= \300\302 Q!\207" ["ftp" browse-url ":"] 5
= =C2=A0"\n\n(fn URL)"]
)
=C2=A0 =C2=A0 =C2=A0 ("h= elp" :follow org-link--open-help)
=C2=A0 =C2=A0 =C2=A0 ("fi= le" :complete org-link-complete-file)
=C2=A0 =C2=A0 =C2=A0 (&quo= t;elisp" :follow org-link--open-elisp)
=C2=A0 =C2=A0 =C2=A0 (&qu= ot;doi" :follow org-link--open-doi))
=C2=A0org-link-elisp-confirm-f= unction 'yes-or-no-p
=C2=A0)
--000000000000072e4c05a2149d8a--