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--