From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id aHe9IZtcTmFnTQEAgWs5BA (envelope-from ) for ; Sat, 25 Sep 2021 01:17:47 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id SE8oHZtcTmE0HAAAbx9fmQ (envelope-from ) for ; Fri, 24 Sep 2021 23:17:47 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B896F9C26 for ; Sat, 25 Sep 2021 01:17:46 +0200 (CEST) Received: from localhost ([::1]:41342 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTuRt-00059n-TM for larch@yhetil.org; Fri, 24 Sep 2021 19:17:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55396) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTuQl-00059c-N6 for emacs-orgmode@gnu.org; Fri, 24 Sep 2021 19:16:35 -0400 Received: from mail-qk1-x731.google.com ([2607:f8b0:4864:20::731]:36799) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mTuQg-00033N-2R for emacs-orgmode@gnu.org; Fri, 24 Sep 2021 19:16:35 -0400 Received: by mail-qk1-x731.google.com with SMTP id p4so30124281qki.3 for ; Fri, 24 Sep 2021 16:16:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version; bh=H0c6jux405S0qvS0S5xfLF025VDiceR7eicrEBKs0A4=; b=GAk8zH8oSOdLgYkFa+GJgqHGRIz+/s4AuYqHeg/Rio4xGTyNJggXAcJdTwy9HEyukQ GlT6qlVql2xuPGV14xO2xzHIkXvEsb2EHB1tkiFRWLCVn2Tb6zkAliUBjGr6VJYqIPPH yKMdVmanDqozbwV9RkatQQW3sXNxVGGUDGbTRKRnyrBOVC+coQG9Sc0ybYR+TtPy/j5T 5hNkEsn4/bQ/Pp40ZI06W3bsH6Ot84B4afrjy9nJKpUwpQ5nLVrTkCqAilANURIriJKj STu3uBGFccsCPUGNwJQWtSSFOScKIhKY3RjgOPpvMYSUzY6ez+Pm+DCGKl9cyoyWlPYb /puw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=H0c6jux405S0qvS0S5xfLF025VDiceR7eicrEBKs0A4=; b=DlK9X3kQYgv3qWy5qydak4mcsGOz3m9XPHyJcYDhRDzsRMbsyVXE9RCdTr4Q9yPm1Z mzrg8acUNyJ1jrUK1ZMXqtoAUuAkBiA+ZThDaEZSQt9UKpFHj+qoXJUtOWbwXuWQ0/eu 2ymm4HxZhFG4bCsw17Foc14G0XTGjrWUIwLzcQY6LBJVEsl/TUbDOfBOjQLPi3eHUiOd 4LAI0I9VDCnh/rvnuL7sj/NYUqGDjwPF5ZB/AV4NP4KnbmUVC1pYC0P35femcNjnEFGf dV8TCi1k0L+gz/lQu923UWCyU+bmfAj8rIWfLyLE+LXKM7nIA6Uxm5MlwiqpPIfcz1V3 SBHA== X-Gm-Message-State: AOAM533g3gDqfSuNo9oR4xHMBmPU7P5Fa5uR0V3RACK7zZEM2Il1/UC0 PNMbbVJEc5nlq1WJbnBcnkMXLuxYNGVBlA== X-Google-Smtp-Source: ABdhPJzp+cBK1K+5g7YUrLRzXZhrqiRoJTa1Mczz2vRw4VC4h7jGtmFZaXV1i8Biz2TtmIvFAaOh7A== X-Received: by 2002:a05:620a:1983:: with SMTP id bm3mr13136850qkb.340.1632525387641; Fri, 24 Sep 2021 16:16:27 -0700 (PDT) Received: from r1 ([190.239.232.213]) by smtp.gmail.com with ESMTPSA id j21sm6225019qkl.25.2021.09.24.16.16.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 16:16:27 -0700 (PDT) From: Rodrigo Morales To: emacs-orgmode@gnu.org Subject: Bug: org-element-map doesn't consider all links in the current buffer [9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/)] Date: Fri, 24 Sep 2021 18:14:52 -0500 Message-ID: <877df5sh03.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=2607:f8b0:4864:20::731; envelope-from=moralesrodrigo1100@gmail.com; helo=mail-qk1-x731.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632525466; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=H0c6jux405S0qvS0S5xfLF025VDiceR7eicrEBKs0A4=; b=e/RSZMmhnORQt8D1tgqGkAU2AN/ezF42Nd3XoqyGOyWLdS14mx4TLvOXEQIZaOfS0NUpDk HxvBHVgXgK3RtaCbL7yVdPyL4phspqx5bppxWuOGNSl0jHaVYlb5LAL6EzdgecWrqPr69g wH7mYMsmHi1F9NLW6UVtBnftVVoP4PR3y1+RInGTqzuwFkATPA2MRhlbMFOMKCvlCG8qfC On/0ZjSY2k9GF/ti6zPeWTchUuLtcko9oaXGmHoSoByWGcVwSCGXFBrZJdxTJqjXJpbRlP 2Nxqlbn+vJrxDVjGnBnT3E/pqP7yOdleUwIMiFYdnYvRl1SBkni0PeaVjRf55Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632525466; a=rsa-sha256; cv=none; b=LfmpxmgOzOffiiZ0igYBqgV1wsRWzyL3YTtJD/zdNToUPwng5B02v2B0ED6yvn0dMZ3GqA 4lHNYp4mYQMacNvArU5cCnu+hVipSfxXcgGXPg0K3IdfBt8y+POAhRI4ddp3v316XaqYg6 577u/nzD7F8DKBMBBJrItV2ctzxwDNVfRaoyQOV/uuxdCit8bRfUUTiPJJJW+CSCyAMczq qVIZNzjP0mFf3dSJdL23LjMXjcF8svND4kOFUQMQMmEafRECbKzS/m351c83EKr/DDtYnD BNi3G3UIMkKzSU6RwrVFF5P0kVpYotEaOgWxX4GjGYunA03L51LEgdKVsJp9IA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=GAk8zH8o; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.59 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=GAk8zH8o; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: B896F9C26 X-Spam-Score: -1.59 X-Migadu-Scanner: scn0.migadu.com X-TUID: OTsXRUj1Gsa9 Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. ------------------------------------------------------------------------ * Introduction This bug report show examples where it is noticeable that =org-element-map=, when =link= is the value for the =TYPES= argument, doesn't consider all links in the current buffer. * Examples without errors :PROPERTIES: :CREATED: [2021-09-24 13:23:45 -05] :END: This section show examples where =org-element-map= correctly iterates through all links. The following is an example. #+begin_src elisp (let ((lines '("|-----------------------|" "| [[https://link1.com]] |" "| [[https://link2.com]] |" "| [[https://link3.com]] |" "|-----------------------|"))) (with-temp-buffer (org-mode) (insert (string-join lines "\n")) (org-element-map (org-element-parse-buffer) 'link (lambda (link) (org-element-property :raw-link link))))) #+end_src #+RESULTS: #+begin_example ("https://link1.com" "https://link2.com" "https://link3.com") #+end_example The following is another example. #+begin_src elisp (let ((lines '("#+BEGIN_QUOTE" "[[https://link1.org]]" "#+END_QUOTE"))) (with-temp-buffer (org-mode) (insert (string-join lines "\n")) (org-element-map (org-element-parse-buffer) 'link (lambda (link) (org-element-property :raw-link link))))) #+end_src #+RESULTS: #+begin_example ("https://link1.org") #+end_example The following is another example. #+begin_src elisp (let ((lines '("This is [[https://link1.com][a link]]" "#+BEGIN_SRC python" "print('[[https://link2.com][a link]]')" "#+END_SRC" "This is [[https://link3.com][a link]]"))) (with-temp-buffer (org-mode) (insert (string-join lines "\n")) (org-element-map (org-element-parse-buffer) 'link (lambda (link) (org-element-property :raw-link link))))) #+end_src #+RESULTS: #+begin_example ("https://link1.com" "https://link3.com") #+end_example * Examples with errors :PROPERTIES: :CREATED: [2021-09-24 13:24:03 -05] :END: This section show examples where =org-element-map= doesn't iterate through all links in the buffer. The following is an example. Links in properties drawers are not considered. I expect those links to be considered. #+begin_src elisp (let ((lines '("* John Doe" ":PROPERTIES:" ":ONE: [[https://link1.com]]" ":TWO: [[https://link2.com]]" ":END:" "[[https://link3.com]]"))) (with-temp-buffer (org-mode) (insert (string-join lines "\n")) (org-element-map (org-element-parse-buffer) 'link (lambda (link) (org-element-property :raw-link link))))) #+end_src #+RESULTS: #+begin_example ("https://link3.com") #+end_example The following is another example. The link in the =#+TITLE= line is not considered. I expect that links to be considered. #+begin_src elisp (let ((lines '("#+TITLE: A line with [[https://link1.com][a]] link" "" "[[https://link2.com]]"))) (with-temp-buffer (org-mode) (insert (string-join lines "\n")) (org-element-map (org-element-parse-buffer) 'link (lambda (link) (org-element-property :raw-link link))))) #+end_src #+RESULTS: #+begin_example ("https://link2.com") #+end_example The following is another example. In general, links in keyword lines (i.e. those starting with =#+=) are not considered. I expect those links to be considered. #+begin_src elisp (let ((lines '("#+TITLE: A line with [[https://link1.com][a link]]" "#+SUBTITLE: A line with [[https://link2.com][a link]]" "#+AUTHOR: A line with [[https://link3.com][a link]]" "#+SUBAUTHOR: A line with [[https://link4.com][a link]]" "" "A simple paragraph with [[https://link5.com][a link]]"))) (with-temp-buffer (org-mode) (insert (string-join lines "\n")) (org-element-map (org-element-parse-buffer) 'link (lambda (link) (org-element-property :raw-link link))))) #+end_src #+RESULTS: #+begin_example ("https://link5.com") #+end_example * Personal thoughts :PROPERTIES: :CREATED: [2021-09-24 17:41:12 -05] :END: I think that links in properties drawers and keyword lines should be considered by =org-element-map= because there are use cases for having links at these locations. I will mention a use case for each context ** Links in property drawers :PROPERTIES: :CREATED: [2021-09-24 17:49:32 -05] :END: For storing contacts' information #+BEGIN_SRC org ,* John Doe :PROPERTIES: :LANGUAGE_NATIVE: SPA :LANGUAGE_FLUENT: ENG :PERSONAL_SITE: https://www.jhondoe.com :END: #+END_SRC ** Links in the =#+TITLE= line :PROPERTIES: :CREATED: [2021-09-24 17:50:04 -05] :END: For making a specific part of the title clickable. #+BEGIN_SRC org ,#+TITLE: My article on [[https://www.gnu.org/software/emacs/][GNU Emacs]] ,#+AUTHOR: John Doe ,* My section This is a paragraph. ,* My second section This is a paragraph. #+END_SRC * System information Emacs : GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.17.4) of 2021-03-26 Package: Org mode version 9.4.4 (release_9.4.4 @ /usr/share/emacs/27.2/lisp/org/) [[[ If you see a signature in spanish below this message, please omit it. It is automatically inserted in all my messages due to the internal privacy policies of the organization that owns the domain of my email address. ]]]