From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: org-element-context in table.el behavior Date: Thu, 2 Jan 2020 07:18:18 -0500 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000e49dbd059b27301b" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:50256) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1imzQw-0008U6-9S for emacs-orgmode@gnu.org; Thu, 02 Jan 2020 07:18:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1imzQu-0003lU-U9 for emacs-orgmode@gnu.org; Thu, 02 Jan 2020 07:18:34 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:54681) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1imzQu-0003hD-Hc for emacs-orgmode@gnu.org; Thu, 02 Jan 2020 07:18:32 -0500 Received: by mail-wm1-x32c.google.com with SMTP id b19so5396957wmj.4 for ; Thu, 02 Jan 2020 04:18:32 -0800 (PST) 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.org@gnu.org Sender: "Emacs-orgmode" To: org-mode-email --000000000000e49dbd059b27301b Content-Type: text/plain; charset="UTF-8" Hi, I have run into a surprise with org-element-context on a link in a table.el cell. It is best illustrated here: +---+------------+ | # | name | +---+------------+ | 1 | [[./test.org]] | +---+------------+ #+BEGIN_SRC emacs-lisp :results code (save-excursion (re-search-backward (concat "test." "org")) (org-element-context)) #+END_SRC #+RESULTS: #+begin_src emacs-lisp (table (:begin 1463 :end 1563 :type table\.el :tblfm nil :contents-begin nil :contents-end nil :value "+---+------------+\n| # | name |\n+---+------------+\n| 1 | [[./test.org]] |\n+---+------------+\n" :post-blank 1 :post-affiliated 1463 :parent nil)) #+end_src I expected the element in this code to be a link, e.g. like in this next example: [[./test.org]] #+BEGIN_SRC emacs-lisp :results code (save-excursion (re-search-backward (concat "test." "org")) (org-element-context)) #+END_SRC #+RESULTS: #+begin_src emacs-lisp (link (:type "file" :path "./test.org" :format bracket :raw-link "./test.org" :application nil :search-option nil :begin 908 :end 922 :contents-begin nil :contents-end nil :post-blank 0 :parent (paragraph (:begin 907 :end 924 :contents-begin 907 :contents-end 923 :post-blank 1 :post-affiliated 907 :parent nil)))) #+end_src Is this expected behavior, or a bug? John ----------------------------------- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu --000000000000e49dbd059b27301b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

I have run into a surprise with org= -element-context on a link in a table.el cell. It is best illustrated here:=

+---+------------+
| # | name =C2=A0 =C2=A0 = =C2=A0 |
+---+------------+
| 1 | [[./tes= t.org]] |
+---+------------+

#+BEGIN_SRC emacs-lisp :results = code
(save-excursion
=C2=A0 (re-search-backward (concat "test.&q= uot; "org"))
=C2=A0 (org-element-context))
#+END_SRC
#+RESULTS:
#+begin_src emacs-lisp
(table
=C2=A0(:begin 1463 :end = 1563 :type table\.el :tblfm nil :contents-begin nil :contents-end nil :valu= e "+---+------------+\n| # | name =C2=A0 =C2=A0 =C2=A0 |\n+---+-------= -----+\n| 1 | [[./test.org]] |\n+---+------= ------+\n" :post-blank 1 :post-affiliated 1463 :parent nil))
#+end_= src


I expected the element in t= his code to be a link, e.g. like in this next example:

=
=C2=A0[[./test.org]]

#+BEGIN_SR= C emacs-lisp :results code
(save-excursion
=C2=A0 (re-search-backward= (concat "test." "org"))
=C2=A0 (org-element-context= ))
#+END_SRC

#+RESULTS:
#+begin_src emacs-lisp
(link
=C2= =A0(:type "file" :path "./test.o= rg" :format bracket :raw-link "./= test.org" :application nil :search-option nil :begin 908 :end 922 = :contents-begin nil :contents-end nil :post-blank 0 :parent
(paragraph<= br> (:begin 907 :end 924 :contents-begin 907 :contents-end 923 :post-blank= 1 :post-affiliated 907 :parent nil))))
#+end_src

Is this expected behavior, or a = bug?

John

---------------------= --------------
Professor John Kitchin=C2=A0
Doherty Hall A207F
Dep= artment of Chemical Engineering
Carnegie Mellon University
Pittsburgh= , PA 15213
412-268-7803
--000000000000e49dbd059b27301b-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: org-element-context in table.el behavior Date: Thu, 02 Jan 2020 15:50:13 +0100 Message-ID: <8736cxykt6.fsf@nicolasgoaziou.fr> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:42544) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1in1no-0004eI-6c for emacs-orgmode@gnu.org; Thu, 02 Jan 2020 09:50:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1in1nm-0005G8-L3 for emacs-orgmode@gnu.org; Thu, 02 Jan 2020 09:50:19 -0500 Received: from relay6-d.mail.gandi.net ([217.70.183.198]:48165) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1in1nm-0005EW-FP for emacs-orgmode@gnu.org; Thu, 02 Jan 2020 09:50:18 -0500 In-Reply-To: (John Kitchin's message of "Thu, 2 Jan 2020 07:18:18 -0500") 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.org@gnu.org Sender: "Emacs-orgmode" To: John Kitchin Cc: org-mode-email Hello, John Kitchin writes: > I have run into a surprise with org-element-context on a link in a table.el > cell. It is best illustrated here: > > +---+------------+ > | # | name | > +---+------------+ > | 1 | [[./test.org]] | > +---+------------+ > > #+BEGIN_SRC emacs-lisp :results code > (save-excursion > (re-search-backward (concat "test." "org")) > (org-element-context)) > #+END_SRC > > > #+RESULTS: > #+begin_src emacs-lisp > (table > (:begin 1463 :end 1563 :type table\.el :tblfm nil :contents-begin nil > :contents-end nil :value "+---+------------+\n| # | name > |\n+---+------------+\n| 1 | [[./test.org]] |\n+---+------------+\n" > :post-blank 1 :post-affiliated 1463 :parent nil)) > #+end_src > [...] > Is this expected behavior, or a bug? This is expected: table.el tables, as their name suggest, are opaque to Org mode. In particular, it doesn't know how to parse them. It just feeds table.el with them at export time. Regards, -- Nicolas Goaziou From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: org-element-context in table.el behavior Date: Thu, 02 Jan 2020 11:03:46 -0500 Message-ID: References: <8736cxykt6.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:55180) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1in2ww-0001Ia-Um for emacs-orgmode@gnu.org; Thu, 02 Jan 2020 11:03:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1in2wv-0006Us-HT for emacs-orgmode@gnu.org; Thu, 02 Jan 2020 11:03:50 -0500 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]:43261) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1in2wv-0006UZ-DX for emacs-orgmode@gnu.org; Thu, 02 Jan 2020 11:03:49 -0500 Received: by mail-qt1-x830.google.com with SMTP id d18so32265093qtj.10 for ; Thu, 02 Jan 2020 08:03:49 -0800 (PST) In-reply-to: <8736cxykt6.fsf@nicolasgoaziou.fr> 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.org@gnu.org Sender: "Emacs-orgmode" To: Nicolas Goaziou Cc: org-mode-email Ok, thanks for confirming! Nicolas Goaziou writes: > Hello, > > John Kitchin writes: > >> I have run into a surprise with org-element-context on a link in a table.el >> cell. It is best illustrated here: >> >> +---+------------+ >> | # | name | >> +---+------------+ >> | 1 | [[./test.org]] | >> +---+------------+ >> >> #+BEGIN_SRC emacs-lisp :results code >> (save-excursion >> (re-search-backward (concat "test." "org")) >> (org-element-context)) >> #+END_SRC >> >> >> #+RESULTS: > >> #+begin_src emacs-lisp >> (table >> (:begin 1463 :end 1563 :type table\.el :tblfm nil :contents-begin nil >> :contents-end nil :value "+---+------------+\n| # | name >> |\n+---+------------+\n| 1 | [[./test.org]] |\n+---+------------+\n" >> :post-blank 1 :post-affiliated 1463 :parent nil)) >> #+end_src >> > > [...] > >> Is this expected behavior, or a bug? > > This is expected: table.el tables, as their name suggest, are opaque to > Org mode. In particular, it doesn't know how to parse them. It just > feeds table.el with them at export time. > > Regards, -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu